Subversion Repositories DevTools

Rev

Rev 383 | Rev 3559 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 383 Rev 385
Line 266... Line 266...
266
{
266
{
267
    my( $name, $pArgs, $pObjs, $pLibs ) = @_;
267
    my( $name, $pArgs, $pObjs, $pLibs ) = @_;
268
    my $progName = $name;
268
    my $progName = $name;
269
    my $script;
269
    my $script;
270
    my $img_file = 1 unless $itp_mode;
270
    my $img_file = 1 unless $itp_mode;
-
 
271
    my $hex_file = 1 if $itp_mode;
271
    my $noVersion;
272
    my $noVersion;
272
 
273
 
273
 
274
 
-
 
275
 
274
#.. Parse arguments
276
#.. Parse arguments
275
#
277
#
276
    foreach $_ ( @$pArgs )
278
    foreach $_ ( @$pArgs )
277
    {
279
    {
278
    #.. Target specific
280
    #.. Target specific
Line 285... Line 287...
285
            $script .= ".cmd" unless ( $script =~ m~\.cmd$~ );
287
            $script .= ".cmd" unless ( $script =~ m~\.cmd$~ );
286
 
288
 
287
        } elsif (/^--NoImg/i ) {
289
        } elsif (/^--NoImg/i ) {
288
            $img_file = undef;
290
            $img_file = undef;
289
 
291
 
-
 
292
        } elsif (/^--NoHex/i ) {
-
 
293
            $hex_file = undef;
-
 
294
 
290
        } elsif (/^--NoVersion/i ) {
295
        } elsif (/^--NoVersion/i ) {
291
            $noVersion = 1;
296
            $noVersion = 1;
292
 
297
 
293
        } else {
298
        } else {
294
            Message( "Prog: unknown option $_ -- ignored\n" );
299
            Message( "Prog: unknown option $_ -- ignored\n" );
Line 297... Line 302...
297
 
302
 
298
#
303
#
299
#   Sanity check
304
#   Sanity check
300
#       - Ensure a linker script has been provided
305
#       - Ensure a linker script has been provided
301
#
306
#
-
 
307
Error ("Cannot generate 'image' and 'hex' at the same time") if $hex_file and $img_file;
302
unless ( $script )
308
unless ( $script )
303
{
309
{
304
    $script = "$name.cmd";
310
    $script = "$name.cmd";
305
    Warning( "Prog: Linker Script file not provided. Using $script" );
311
    Warning( "Prog: Linker Script file not provided. Using $script" );
306
}
312
}
Line 393... Line 399...
393
 
399
 
394
    #
400
    #
395
    #   Rules to generate the program
401
    #   Rules to generate the program
396
    #
402
    #
397
    $io->Label( "Program", $name );                     # label
403
    $io->Label( "Program", $name );                     # label
398
    $io->Prt( "$full $img: \t$dep" );                   # Dependencies
404
    $io->Prt( "$full $img $hex: \t$dep" );                   # Dependencies
399
    $io->Prt( "\\\n\t\t$script" );
405
    $io->Prt( "\\\n\t\t$script" );
400
    $io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );  # Object Files
406
    $io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );  # Object Files
401
    $io->Prt( "\n\t\$(LD)" );
407
    $io->Prt( "\n\t\$(LD)" );
402
    $io->Prt( "\n\t\$(call COFF2IMG,$full,$img,\$(BUILDVER))\n" ) if ($img);
408
    $io->Prt( "\n\t\$(call COFF2IMG,$full,$img,\$(BUILDVER))\n" ) if ($img);
-
 
409
    $io->Prt( "\n\t\$(call COFF2HEX,$full,$hex)\n" ) if ($hex_file);
403
    $io->Newline();
410
    $io->Newline();
404
 
411
 
405
    #
412
    #
406
    #   Specify files created by the linker
413
    #   Specify files created by the linker
407
    #   These will be added to the clean list
414
    #   These will be added to the clean list
408
    #
415
    #
409
    ToolsetGenerate( $full );
416
    ToolsetGenerate( $full );
410
    ToolsetGenerate( $map );
417
    ToolsetGenerate( $map );
411
    ToolsetGenerate( $root . '.ld' );
418
    ToolsetGenerate( $root . '.ld' );
412
    if ( $img )
-
 
413
    {
-
 
414
        ToolsetGenerate( $img );
419
    ToolsetGenerate( $hex ) if ( $img || $hex_file) ;
415
        ToolsetGenerate( $hex );
420
    ToolsetGenerate( $img ) if ($img );
416
    }
-
 
417
 
421
 
418
    #
422
    #
419
    #   Create a linker command file
423
    #   Create a linker command file
420
    #   Piecing together a variable $(name_ld) which ends up in the command file.
424
    #   Piecing together a variable $(name_ld) which ends up in the command file.
421
    #   This bit of magic will be performed by the LD recipe
425
    #   This bit of magic will be performed by the LD recipe
422
    #
426
    #
423
    $io->SetTag( "${name}_ld" );                            # macro tag
427
    $io->SetTag( "${name}_ld" );                            # macro tag
424
    $io->Label( "Linker commands", $name );                 # label
428
    $io->Label( "Linker commands", $name );                 # label
-
 
429
    unless ( $itp_mode )
-
 
430
    {
425
    $io->Cmd("--stack_size=160");
431
        $io->Cmd("--stack_size=160");
426
    $io->Cmd("--heap_size=160");
432
        $io->Cmd("--heap_size=160");
427
    $io->Cmd("--use_hw_mpy=F5");
433
        $io->Cmd("--use_hw_mpy=F5");
428
    $io->Cmd("-o $full" );                                  # Output file
434
        $io->Cmd("--entry_point=main" );                        # Fixed entry point
-
 
435
    }
-
 
436
    else
-
 
437
    {
-
 
438
        $io->Cmd("--stack_size=50");
-
 
439
        $io->Cmd("--heap_size=0");
-
 
440
#        $io->Cmd("--symdebug:dwarf");
-
 
441
        $io->Cmd("--rom_model");
-
 
442
 
-
 
443
    }
429
    $io->Cmd("-m $map" );                                   # Map file
444
        $io->Cmd("--warn_sections" );                           # Warn if creating unused sections
430
    $io->Cmd("--warn_sections" );                           # Warn if creating unused sections
445
        $io->Cmd("-o $full" );                                  # Output file
431
    $io->Cmd("--entry_point=main" );                        # Fixed entry point
446
        $io->Cmd("-m $map" );                                   # Map file
432
    $io->Cmd("--reread_libs" );                             # Multipass on lib files
447
        $io->Cmd("--reread_libs" );                             # Multipass on lib files
433
    $io->Cmd("-l $script" );                                # User script file
448
        $io->Cmd("-l $script" );                                # User script file
434
 
449
 
435
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );      # Object files
450
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );      # Object files
436
 
451
 
437
    #
452
    #
438
    #   Specify the library files
453
    #   Specify the library files
Line 454... Line 469...
454
    #
469
    #
455
    #   Add the MAP file to the program package
470
    #   Add the MAP file to the program package
456
    #
471
    #
457
    PackageProgAddFiles ( $progName, $full );
472
    PackageProgAddFiles ( $progName, $full );
458
    PackageProgAddFiles ( $progName, $img ) if ($img);
473
    PackageProgAddFiles ( $progName, $img ) if ($img);
459
    PackageProgAddFiles ( $progName, $hex ) if ($img);
474
    PackageProgAddFiles ( $progName, $hex ) if ($img || $hex_file );
460
    PackageProgAddFiles ( $progName, $map , 'Class=map' );
475
    PackageProgAddFiles ( $progName, $map , 'Class=map' );
461
}
476
}
462
 
477
 
463
########################################################################
478
########################################################################
464
#
479
#