Subversion Repositories DevTools

Rev

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

Rev 369 Rev 371
Line 257... Line 257...
257
###############################################################################
257
###############################################################################
258
 
258
 
259
sub ToolsetLD
259
sub ToolsetLD
260
{
260
{
261
    my( $name, $pArgs, $pObjs, $pLibs ) = @_;
261
    my( $name, $pArgs, $pObjs, $pLibs ) = @_;
-
 
262
    my $progName = $name;
262
    my( $script );
263
    my $script;
263
    my $img_file = 1;
264
    my $img_file = 1;
-
 
265
    my $noVersion;
264
 
266
 
265
 
267
 
266
#.. Parse arguments
268
#.. Parse arguments
267
#
269
#
268
    foreach $_ ( @$pArgs )
270
    foreach $_ ( @$pArgs )
Line 277... Line 279...
277
            $script .= ".cmd" unless ( $script =~ m~\.cmd$~ );
279
            $script .= ".cmd" unless ( $script =~ m~\.cmd$~ );
278
 
280
 
279
        } elsif (/^--NoImg/i ) {
281
        } elsif (/^--NoImg/i ) {
280
            $img_file = undef;
282
            $img_file = undef;
281
 
283
 
-
 
284
        } elsif (/^--NoVersion/i ) {
-
 
285
            $noVersion = 1;
-
 
286
 
282
        } else {
287
        } else {
283
            Message( "Prog: unknown option $_ -- ignored\n" );
288
            Message( "Prog: unknown option $_ -- ignored\n" );
284
        }
289
        }
285
    }
290
    }
286
 
291
 
Line 325... Line 330...
325
        }
330
        }
326
    }
331
    }
327
}
332
}
328
 
333
 
329
#
334
#
-
 
335
#   Insert version number into the output name
-
 
336
#
-
 
337
    unless ( $noVersion )
-
 
338
    {
-
 
339
        $name .= "_\$(BUILDVERNUM)";
-
 
340
    }
-
 
341
 
-
 
342
#
330
#   Create a ToolsetPrinter
343
#   Create a ToolsetPrinter
331
#
344
#
332
    my ($io) = ToolsetPrinter::New();
345
    my ($io) = ToolsetPrinter::New();
333
    my $dep = $io->SetLdTarget( $name );
346
    my $dep = $io->SetLdTarget( $name );
334
 
347
 
335
#
348
#
336
#   Determine the target output name
349
#   Determine the target output name(s)
337
#
350
#
338
    my $root = "\$(BINDIR)/$name";
351
    my $root = "\$(BINDIR)/${name}";
-
 
352
    my $phonyProgName = "\$(BINDIR)/${progName}" . $::exe;
339
    my $full = $root . $::exe;
353
    my $full = $root . $::exe;
340
    my $img = $img_file ? $root . '.img' : '';
354
    my $img = $img_file ? $root . '.img' : '';
-
 
355
    my $hex = $root . '.hex';
341
    my $map = $root . '.map';
356
    my $map = $root . '.map';
342
 
357
 
343
 
-
 
344
#
358
#
345
#   Add runtime support libaries
359
#   Add runtime support libaries
346
#   These are transparent to the user
360
#   These are transparent to the user
347
#
361
#
348
    push @$pLibs, 'libc.a';
362
    push @$pLibs, 'libc.a';
Line 360... Line 374...
360
#   created when a "program" is required
374
#   created when a "program" is required
361
#
375
#
362
#       These are:
376
#       These are:
363
#               User linker script file
377
#               User linker script file
364
#               Library dependency file
378
#               Library dependency file
365
# 
379
#
-
 
380
    unless ( $noVersion )
-
 
381
    {
-
 
382
        $io->Label( "Program", $progName );                     # label
-
 
383
        $io->Prt( ".PHONY:\t$phonyProgName\n" );                # Mark as phony
-
 
384
        $io->Prt( "$phonyProgName: \t$full\n" );                # Dependencies
-
 
385
        $io->Newline();
-
 
386
    }
-
 
387
 
-
 
388
    #
-
 
389
    #   Rules to generate the program
-
 
390
    #
366
    $io->Label( "Program", $name );                     # label
391
    $io->Label( "Program", $name );                     # label
367
    $io->Prt( "$full $img: \t$dep" );                   # Dependencies
392
    $io->Prt( "$full $img: \t$dep" );                   # Dependencies
368
    $io->Prt( "\\\n\t\t$script" );
393
    $io->Prt( "\\\n\t\t$script" );
369
    $io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );  # Object Files
394
    $io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );  # Object Files
370
    $io->Prt( "\n\t\$(LD)" );
395
    $io->Prt( "\n\t\$(LD)" );
Line 373... Line 398...
373
 
398
 
374
    #
399
    #
375
    #   Specify files created by the linker
400
    #   Specify files created by the linker
376
    #   These will be added to the clean list
401
    #   These will be added to the clean list
377
    #
402
    #
-
 
403
    ToolsetGenerate( $full );
378
    ToolsetGenerate( $map );
404
    ToolsetGenerate( $map );
379
    ToolsetGenerate( $root . '.ld' );
405
    ToolsetGenerate( $root . '.ld' );
380
    if ( $img )
406
    if ( $img )
381
    {
407
    {
382
        ToolsetGenerate( $img );
408
        ToolsetGenerate( $img );
383
        ToolsetGenerate( $root . '.hex' );
409
        ToolsetGenerate( $hex );
384
    }
410
    }
385
 
411
 
386
    #
412
    #
387
    #   Create a linker command file
413
    #   Create a linker command file
388
    #   Piecing together a variable $(name_ld) which ends up in the command file.
414
    #   Piecing together a variable $(name_ld) which ends up in the command file.
Line 420... Line 446...
420
    $io->LDDEPEND(); 
446
    $io->LDDEPEND(); 
421
 
447
 
422
    #
448
    #
423
    #   Add the MAP file to the program package
449
    #   Add the MAP file to the program package
424
    #
450
    #
425
    PackageProgAddFiles ( $name, $full );
451
    PackageProgAddFiles ( $progName, $full );
426
    PackageProgAddFiles ( $name, $img ) if ($img);
452
    PackageProgAddFiles ( $progName, $img ) if ($img);
-
 
453
    PackageProgAddFiles ( $progName, $hex ) if ($img);
427
    PackageProgAddFiles ( $name, $map , 'Class=map' );
454
    PackageProgAddFiles ( $progName, $map , 'Class=map' );
428
}
455
}
429
 
456
 
430
########################################################################
457
########################################################################
431
#
458
#
432
#   Generate a linker object recipe.  This is a helper function used 
459
#   Generate a linker object recipe.  This is a helper function used