| 227 |
dpurdie |
1 |
#..
|
| 6177 |
dpurdie |
2 |
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
|
| 227 |
dpurdie |
3 |
#
|
|
|
4 |
# Module name : avr_air
|
|
|
5 |
# Module type : Makefile system
|
|
|
6 |
# Compiler(s) : ANSI C
|
|
|
7 |
# Environment(s): Atmel AVR
|
|
|
8 |
#
|
|
|
9 |
# Description:
|
|
|
10 |
# This file provides Toolset initialisation and plugin functions
|
|
|
11 |
# to makelib.pl2
|
|
|
12 |
#
|
|
|
13 |
# Contents: IAR rules as used for the AVR
|
|
|
14 |
#
|
|
|
15 |
# Revision History:
|
|
|
16 |
# 16-Aug-04 DDP Created
|
|
|
17 |
# 13-Jul-06 DCP Added AT90SC7272C chipset
|
| 235 |
dpurdie |
18 |
# 02-Oct-07 DCP Added AT90SC144144CT chipset
|
| 227 |
dpurdie |
19 |
#............................................................................#
|
|
|
20 |
|
|
|
21 |
use strict;
|
|
|
22 |
use JatsVersionUtils;
|
|
|
23 |
|
|
|
24 |
our $s;
|
|
|
25 |
our $o;
|
|
|
26 |
our $so;
|
|
|
27 |
our $exe;
|
|
|
28 |
our $ScmBuildVersionFull;
|
|
|
29 |
|
|
|
30 |
##############################################################################
|
|
|
31 |
# ToolsetInit()
|
|
|
32 |
# Runtime initialisation
|
|
|
33 |
#
|
|
|
34 |
##############################################################################
|
|
|
35 |
|
|
|
36 |
ToolsetInit();
|
|
|
37 |
|
|
|
38 |
sub ToolsetInit
|
|
|
39 |
{
|
|
|
40 |
my( @args ) = @::ScmToolsetArgs; # Toolset arguments
|
|
|
41 |
my( $version, $product, @defines, @dirs, @flags, @asflags, @asdefines );
|
|
|
42 |
my $productFound;
|
|
|
43 |
|
|
|
44 |
#.. Parse arguments
|
|
|
45 |
#
|
|
|
46 |
Debug( "avr_iar(@args)\n" );
|
|
|
47 |
|
|
|
48 |
foreach $_ ( @args ) {
|
|
|
49 |
if (/^--Version=(.*)/) { # Compiler version
|
|
|
50 |
$version = "$1";
|
|
|
51 |
} else {
|
|
|
52 |
Message( "avr_iar: unknown toolset argument $_ -- ignored\n" );
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
#.. Parse Platform Arguments
|
|
|
57 |
#
|
| 261 |
dpurdie |
58 |
@args = @::ScmPlatformArgs; # Platform arguments
|
| 227 |
dpurdie |
59 |
foreach $_ ( @args ) {
|
|
|
60 |
if (/^--product=(.*)/) { # GBE product
|
|
|
61 |
$product = $1;
|
|
|
62 |
} else {
|
|
|
63 |
Message( "avr_iar: unknown platform argument $_ -- ignored\n" );
|
|
|
64 |
}
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
#
|
|
|
68 |
# Definitions common to all products
|
|
|
69 |
# These will be picked up when no platform has been defined
|
|
|
70 |
#
|
|
|
71 |
|
|
|
72 |
push @defines, 'JATS_BUILD';
|
|
|
73 |
push @dirs, '$(COMPILER_HOME_AVR)/inc/clib';
|
|
|
74 |
push @dirs, '$(COMPILER_HOME_AVR)/inc';
|
|
|
75 |
|
|
|
76 |
#
|
|
|
77 |
# Platform specific definitions
|
|
|
78 |
#
|
|
|
79 |
if ( $product eq "AT3232" || $product eq "AT90SC3232CS" )
|
|
|
80 |
{
|
|
|
81 |
$productFound = $product;
|
|
|
82 |
push @flags , '--eeprom_size=32768';
|
|
|
83 |
|
|
|
84 |
# Compiler flags and definitions
|
|
|
85 |
push @defines, '_AT90SC3232CS';
|
|
|
86 |
|
|
|
87 |
# Assembler flags and definitions
|
|
|
88 |
push @asdefines, '_AT90SC3232CS';
|
|
|
89 |
}
|
|
|
90 |
elsif ( $product eq "AT90SC7272C" )
|
|
|
91 |
{
|
|
|
92 |
$productFound = $product;
|
|
|
93 |
push @flags , '--eeprom_size=65536'; # maximum size allowed by IAR
|
|
|
94 |
|
|
|
95 |
# Compiler flags and definitions
|
|
|
96 |
push @defines, '_AT90SC7272C';
|
|
|
97 |
|
|
|
98 |
# Assembler flags and definitions
|
|
|
99 |
push @asdefines, '_AT90SC7272C';
|
|
|
100 |
}
|
| 235 |
dpurdie |
101 |
elsif ( $product eq "AT90SC144144CT" )
|
|
|
102 |
{
|
|
|
103 |
$productFound = $product;
|
|
|
104 |
push @flags , '--eeprom_size=65536'; # maximum size allowed by IAR
|
|
|
105 |
|
|
|
106 |
# Compiler flags and definitions
|
|
|
107 |
push @defines, '_AT90SC144144CT';
|
|
|
108 |
|
|
|
109 |
# Assembler flags and definitions
|
|
|
110 |
push @asdefines, '_AT90SC144144CT';
|
|
|
111 |
}
|
| 227 |
dpurdie |
112 |
elsif ( $product )
|
|
|
113 |
{
|
|
|
114 |
Message( "avr_iar: Unknown product: $product -- ignored\n" );
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
# common flags
|
|
|
118 |
if ( $productFound )
|
|
|
119 |
{
|
|
|
120 |
#
|
|
|
121 |
# Compiler flags and definitions
|
|
|
122 |
#
|
|
|
123 |
push @flags , '-v6';
|
|
|
124 |
push @flags , '-ms';
|
|
|
125 |
push @flags , '-y';
|
|
|
126 |
push @flags , '--enhanced_core';
|
|
|
127 |
push @flags , '--diag_suppress=pa050';
|
|
|
128 |
push @flags , '--initializers_in_flash';
|
|
|
129 |
push @flags , '--require_prototypes';
|
|
|
130 |
|
|
|
131 |
push @defines, '_EEP_EOW_MODE=IDLE_EEP_WRITE';
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
#
|
|
|
135 |
# Assembler flags and definitions
|
|
|
136 |
#
|
|
|
137 |
push @asflags , '-v6'; # processor configuration
|
|
|
138 |
push @asflags , '-s+'; # Case-sensitive user symbols
|
|
|
139 |
push @asflags , '-t8'; # tab spacing...
|
|
|
140 |
push @asflags , '-u_enhancedCore'; # enable AVR-specific enhanced instructions
|
|
|
141 |
|
|
|
142 |
push @asdefines, '__MEMORY_MODEL__=2';
|
|
|
143 |
push @asdefines, '__HAS_ELPM__=1 ';
|
|
|
144 |
push @asdefines, '__HAS_ENHANCED_CORE__=1 ';
|
|
|
145 |
push @asdefines, 'ASSEMBLER';
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
#.. Standard.rul requirements
|
|
|
149 |
#
|
|
|
150 |
$s = 's90'; # Assembler source file
|
|
|
151 |
$o = 'r90'; # Object file
|
|
|
152 |
$a = 'r90'; # Library file
|
|
|
153 |
$so = ''; # Shared library
|
|
|
154 |
$exe = '.s19'; # Linked binary images
|
|
|
155 |
|
|
|
156 |
AddSourceType( ".$s", '.asm' );
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
#.. Toolset configuration
|
|
|
160 |
#
|
|
|
161 |
$::ScmToolsetVersion = "1.0.0"; # our version
|
|
|
162 |
$::ScmToolsetGenerate = 0; # generate optional
|
| 335 |
dpurdie |
163 |
$::ScmToolsetProgDependancies = 0; # handle Prog dependancies myself
|
| 227 |
dpurdie |
164 |
|
|
|
165 |
#.. Cleanup rules
|
|
|
166 |
#
|
| 5677 |
dpurdie |
167 |
# 9 Files that appear to be created by the USB licence dongle
|
| 227 |
dpurdie |
168 |
#
|
|
|
169 |
ToolsetGenerate( "clauth1.dll" );
|
|
|
170 |
ToolsetGenerate( "clauth2.dll" );
|
|
|
171 |
ToolsetGenerate( "lsprst7.dll" );
|
|
|
172 |
ToolsetGenerate( "lsprst7.tgz" );
|
|
|
173 |
ToolsetGenerate( "ssprs.dll" );
|
|
|
174 |
ToolsetGenerate( "ssprs.tgz" );
|
|
|
175 |
ToolsetGenerate( "sysprs7.dll" );
|
|
|
176 |
ToolsetGenerate( "sysprs7.tgz" );
|
|
|
177 |
ToolsetGenerate( "tmpPrst.tgz" );
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
#.. Define IAR environment
|
|
|
181 |
#
|
|
|
182 |
#
|
|
|
183 |
# Define initialisation targets
|
|
|
184 |
# These will be used to ensure that correct versions of the toolset are present
|
|
|
185 |
#
|
|
|
186 |
Init( "iar" );
|
|
|
187 |
|
|
|
188 |
ToolsetDefine ( "#################################################" );
|
|
|
189 |
ToolsetDefine ( "# AVR IAR compiler version" );
|
|
|
190 |
ToolsetDefine ( "#" );
|
|
|
191 |
ToolsetDefine ( "avr_iar_ver = $version" );
|
|
|
192 |
ToolsetDefine ( "avr_iar_prod = $product" );
|
|
|
193 |
ToolsetDefine ( "" );
|
|
|
194 |
ToolsetDefine ( "#" );
|
|
|
195 |
ToolsetDefines( "avr_iar.def" );
|
|
|
196 |
ToolsetRules ( "avr_iar.rul" );
|
|
|
197 |
ToolsetRules ( "standard.rul" );
|
|
|
198 |
|
|
|
199 |
#
|
|
|
200 |
# Specify compiler parameters
|
|
|
201 |
# Note: AVR_IAR_INCLUDES is ";" seperated as it may contain spaces
|
|
|
202 |
# when expanded ("Program Files")
|
|
|
203 |
#
|
|
|
204 |
|
|
|
205 |
PlatformEntry( "AVR_IAR_DEFINES\t=", "\n", "\\\n\t", "", @defines )
|
|
|
206 |
if ( scalar @defines );
|
|
|
207 |
PlatformEntry( "AVR_IAR_INCLUDES\t=", "\n", "\\\n\t", ";", @dirs )
|
|
|
208 |
if ( scalar @dirs );
|
|
|
209 |
PlatformEntry( "AVR_IAR_FLAGS\t=", "\n", "\\\n\t", "", @flags )
|
|
|
210 |
if ( scalar @flags );
|
|
|
211 |
|
|
|
212 |
PlatformEntry( "AVR_IAR_ASFLAGS\t=", "\n", "\\\n\t", "", @asflags )
|
|
|
213 |
if ( scalar @asflags );
|
|
|
214 |
PlatformEntry( "AVR_IAR_ASDEFINES\t=", "\n", "\\\n\t", "", @asdefines )
|
|
|
215 |
if ( scalar @asdefines );
|
|
|
216 |
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
##############################################################################
|
|
|
221 |
# ToolsetPreprocess()
|
|
|
222 |
# Process collected data before the makefile is generated
|
|
|
223 |
# This, optional, routine is called from within MakefileGenerate()
|
|
|
224 |
# It allows the toolset to massage any of the collected data before
|
|
|
225 |
# the makefile is created
|
|
|
226 |
#
|
|
|
227 |
##############################################################################
|
|
|
228 |
|
|
|
229 |
#sub ToolsetPreprocess
|
|
|
230 |
#{
|
|
|
231 |
#}
|
|
|
232 |
|
|
|
233 |
###############################################################################
|
|
|
234 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
235 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
236 |
# required to compile the source file 'source' to 'obj'
|
|
|
237 |
#
|
|
|
238 |
###############################################################################
|
|
|
239 |
|
|
|
240 |
sub ToolsetCC
|
|
|
241 |
{
|
|
|
242 |
MakePrint( "\n\t\$(CC)\n" );
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
###############################################################################
|
|
|
246 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
247 |
# This subroutine takes the user options and builds the
|
|
|
248 |
# rule(s) required to build the dependencies for the source
|
|
|
249 |
# files 'sources' to 'depend'.
|
|
|
250 |
#
|
|
|
251 |
###############################################################################
|
|
|
252 |
|
|
|
253 |
sub ToolsetCCDepend
|
|
|
254 |
{
|
|
|
255 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
256 |
}
|
|
|
257 |
|
|
|
258 |
|
|
|
259 |
###############################################################################
|
|
|
260 |
# ToolsetCXX( $source, $obj, \@args )
|
|
|
261 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
262 |
# required to compile the source file 'source' to 'obj'
|
|
|
263 |
#
|
|
|
264 |
###############################################################################
|
|
|
265 |
|
|
|
266 |
sub ToolsetCXX
|
|
|
267 |
{
|
|
|
268 |
MakePrint( "\n\t\$(CXX)\n" );
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
###############################################################################
|
|
|
272 |
# ToolsetCXXDepend( $depend, \@sources )
|
|
|
273 |
# This subroutine takes the user options and builds the
|
|
|
274 |
# rule(s) required to build the dependencies for the source
|
|
|
275 |
# files 'sources' to 'depend'.
|
|
|
276 |
#
|
|
|
277 |
###############################################################################
|
|
|
278 |
|
|
|
279 |
sub ToolsetCXXDepend
|
|
|
280 |
{
|
| 287 |
dpurdie |
281 |
ToolsetCCDepend();
|
| 227 |
dpurdie |
282 |
}
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
###############################################################################
|
|
|
286 |
# ToolsetAS( $source, $obj, \@args )
|
|
|
287 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
288 |
# required to compile the source file 'source' to 'obj'
|
|
|
289 |
#
|
|
|
290 |
###############################################################################
|
|
|
291 |
|
|
|
292 |
sub ToolsetAS
|
|
|
293 |
{
|
|
|
294 |
MakePrint( "\n\t\$(AS)\n" );
|
|
|
295 |
}
|
|
|
296 |
|
|
|
297 |
sub ToolsetASDepend
|
|
|
298 |
{
|
|
|
299 |
}
|
|
|
300 |
|
|
|
301 |
###############################################################################
|
|
|
302 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
303 |
# This subroutine takes the user options and builds the rules
|
|
|
304 |
# required to build the library 'name'.
|
|
|
305 |
|
|
|
306 |
#
|
|
|
307 |
# Arguments:
|
|
|
308 |
# --xxx No arguments currently defined
|
|
|
309 |
#
|
|
|
310 |
# Output:
|
|
|
311 |
# [ $(BINDIR)/name$.${a}: .... ]
|
|
|
312 |
# $(AR)
|
|
|
313 |
#
|
|
|
314 |
###############################################################################
|
|
|
315 |
|
|
|
316 |
sub ToolsetAR
|
|
|
317 |
{
|
|
|
318 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
319 |
|
|
|
320 |
Debug("ToolsetAR");
|
|
|
321 |
|
|
|
322 |
#.. Parse arguments
|
|
|
323 |
#
|
|
|
324 |
foreach $_ ( @$pArgs ) {
|
|
|
325 |
if (/^--/) {
|
|
|
326 |
Message( "AR: unknown option $_ -- ignored\n" );
|
|
|
327 |
}
|
|
|
328 |
}
|
|
|
329 |
|
|
|
330 |
#.. Target
|
|
|
331 |
#
|
|
|
332 |
MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t", "", " \\\n\t\t", ".${o}", @$pObjs );
|
|
|
333 |
|
|
|
334 |
#.. Build library rule (just append to standard rule)
|
|
|
335 |
#
|
|
|
336 |
MakePrint( "\n\t\$(AR)\n\n" );
|
|
|
337 |
}
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
###############################################################################
|
|
|
341 |
# ToolsetARMerge()
|
|
|
342 |
# Generate the recipe to merge libraries.
|
|
|
343 |
# The dependency list is created by the caller.
|
|
|
344 |
#
|
|
|
345 |
###############################################################################
|
|
|
346 |
|
|
|
347 |
sub ToolsetARMerge
|
|
|
348 |
{
|
|
|
349 |
MakePrint( "\n\t\$(ARMERGE)\n\n" );
|
|
|
350 |
}
|
|
|
351 |
|
|
|
352 |
|
|
|
353 |
###############################################################################
|
|
|
354 |
# ToolsetLD( $name, \@args, \@objs, \@libraries )
|
|
|
355 |
# This subroutine takes the user options and builds the rules
|
|
|
356 |
# required to link the program 'name'.
|
|
|
357 |
#
|
|
|
358 |
# Arguments:
|
|
|
359 |
# --xxx No Arguments currently specified
|
|
|
360 |
#
|
|
|
361 |
# Linker specific:
|
|
|
362 |
# --LinkScript=filename Specify the name of a linker script file
|
|
|
363 |
# --Loader=filename Specify a loader file to be merged
|
|
|
364 |
# This will be a program
|
|
|
365 |
# --Type=typetext Text to be placed in type field
|
|
|
366 |
#
|
|
|
367 |
# Output:
|
|
|
368 |
#
|
|
|
369 |
# name.map - Loadable module
|
|
|
370 |
# name.s19 -
|
|
|
371 |
# name.d90 -
|
|
|
372 |
# name.sxml - Wrapped s19 file
|
|
|
373 |
#
|
|
|
374 |
# Linker Flags
|
|
|
375 |
#
|
|
|
376 |
# -O[format]=filename Specify output filename and format
|
|
|
377 |
# -o filename Specify an output file
|
|
|
378 |
# -r Output file indebug format
|
|
|
379 |
# -z Reduce segment overlap errors
|
|
|
380 |
# -l filename Generate a listing file
|
|
|
381 |
# -xmsn Add info to the map file
|
|
|
382 |
# -Pnnn Number of line per page
|
|
|
383 |
# -Ipath Specify a path to search for object files
|
|
|
384 |
# -f filename Read arguments from file
|
|
|
385 |
# -C filename Load filename as a library
|
|
|
386 |
|
|
|
387 |
###############################################################################
|
|
|
388 |
|
|
|
389 |
sub ToolsetLD
|
|
|
390 |
{
|
|
|
391 |
my( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
392 |
my( $script );
|
|
|
393 |
my( $loader, $loader_file);
|
|
|
394 |
my $type_text = '';
|
|
|
395 |
|
|
|
396 |
|
|
|
397 |
#.. Parse arguments
|
|
|
398 |
#
|
|
|
399 |
foreach $_ ( @$pArgs )
|
|
|
400 |
{
|
|
|
401 |
#.. Target specific
|
|
|
402 |
#
|
|
|
403 |
|
|
|
404 |
#.. Toolset specific
|
|
|
405 |
#
|
|
|
406 |
if (/^--Script=(.*)/) { # External file
|
|
|
407 |
$script = $1;
|
|
|
408 |
$script .= ".xcl" unless ( $script =~ m~\.xcl$~ );
|
|
|
409 |
|
|
|
410 |
} elsif ( /^--ProgLoader=(.*)/ ) { # Loader/Burner file
|
|
|
411 |
$loader = $1;
|
|
|
412 |
$loader =~ s~$exe$~~;
|
|
|
413 |
|
|
|
414 |
} elsif ( /^--Type=(.*)/ ) { # Type of Payload
|
|
|
415 |
$type_text = $1;
|
|
|
416 |
|
|
|
417 |
} else {
|
|
|
418 |
Message( "Prog: unknown option $_ -- ignored\n" );
|
|
|
419 |
}
|
|
|
420 |
}
|
|
|
421 |
|
|
|
422 |
#
|
|
|
423 |
# Sanity check
|
|
|
424 |
# - Ensure a linker script has been provided
|
|
|
425 |
#
|
|
|
426 |
unless ( $script )
|
|
|
427 |
{
|
|
|
428 |
$script = "$name.xcl";
|
|
|
429 |
Warning( "Prog: Linker Script file not provided. Using $script" );
|
|
|
430 |
}
|
|
|
431 |
|
|
|
432 |
#
|
|
|
433 |
# Locate the true path of the provided script file
|
|
|
434 |
# If it is a generate file so it will be in the SRCS hash
|
|
|
435 |
# Other wise the use will have to use Src to locate the file
|
|
|
436 |
#
|
|
|
437 |
$script = MakeSrcResolve ( $script );
|
|
|
438 |
|
|
|
439 |
#
|
|
|
440 |
# Locate the loader file, if it has been provided
|
|
|
441 |
# The file must be a program and should be created within this makefile
|
|
|
442 |
#
|
|
|
443 |
if ( $loader )
|
|
|
444 |
{
|
| 295 |
dpurdie |
445 |
if ( $::PROGS->Get( $loader) )
|
| 227 |
dpurdie |
446 |
{
|
|
|
447 |
$loader_file = "\$(BINDIR)/$loader$exe";
|
|
|
448 |
}
|
|
|
449 |
elsif ( $::SRCS{$loader} )
|
|
|
450 |
{
|
|
|
451 |
$loader_file = $::SRCS{$loader};
|
|
|
452 |
}
|
|
|
453 |
else
|
|
|
454 |
{
|
|
|
455 |
Error ("Prog: ProgLoader file not found" );
|
|
|
456 |
}
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
#
|
|
|
460 |
# Extend the list of libraries with compiler specific libraries
|
|
|
461 |
#
|
|
|
462 |
push( @$pLibs, "\$(avr_linker_lib)" );
|
|
|
463 |
|
|
|
464 |
#
|
|
|
465 |
# Create a ToolsetPrinter
|
|
|
466 |
#
|
|
|
467 |
my ($io) = ToolsetPrinter::New();
|
| 335 |
dpurdie |
468 |
my $dep = $io->SetLdTarget( $name );
|
| 227 |
dpurdie |
469 |
|
| 335 |
dpurdie |
470 |
#
|
|
|
471 |
# Determine the target output name
|
|
|
472 |
#
|
|
|
473 |
my $root = "\$(BINDIR)/$name";
|
|
|
474 |
my $full = $root . $::exe;
|
|
|
475 |
my $map = $root . '.map';
|
|
|
476 |
my $d90 = $root . '.d90';
|
|
|
477 |
my $s19 = $root . '.s19';
|
|
|
478 |
|
|
|
479 |
|
| 227 |
dpurdie |
480 |
########################################################################
|
|
|
481 |
#
|
|
|
482 |
# Before this function was called, makelib.pl2 has generated a
|
|
|
483 |
# partial rule consisting of:
|
|
|
484 |
#
|
|
|
485 |
# $(BINDIR)/${name}${exe} :
|
|
|
486 |
# All the specified object files
|
|
|
487 |
#
|
|
|
488 |
# Add the names of all the other files required in the process
|
|
|
489 |
# This will then serve as a target fo all things that need to be
|
|
|
490 |
# created when a "program" is required
|
|
|
491 |
#
|
|
|
492 |
# These are:
|
|
|
493 |
# User linker script file
|
|
|
494 |
# Library dependency file
|
| 335 |
dpurdie |
495 |
#
|
|
|
496 |
$io->Label( "Program", $name ); # label
|
|
|
497 |
$io->Prt( "$full : \t$dep" ); # Dependencies
|
|
|
498 |
$io->Prt( "\\\n\t\t$script" );
|
| 227 |
dpurdie |
499 |
$io->Prt( " \\\n\t\t$loader_file" ) if ($loader_file);
|
| 335 |
dpurdie |
500 |
$io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs ); # Object Files
|
|
|
501 |
$io->Prt( "\n\t\$(LD_IAR)\n" );
|
| 227 |
dpurdie |
502 |
|
|
|
503 |
#
|
|
|
504 |
# Insert post processing call if a program loader is needed
|
|
|
505 |
#
|
|
|
506 |
$io->Prt( "\t\$(call LD_IAR_PROCESS, \\" .
|
| 335 |
dpurdie |
507 |
"\n\t\t$full, \\" .
|
| 227 |
dpurdie |
508 |
"\n\t\t$loader_file)\n"
|
|
|
509 |
) if ($loader_file);
|
|
|
510 |
|
|
|
511 |
$io->Newline();
|
|
|
512 |
|
|
|
513 |
#
|
|
|
514 |
# Specify files created by the linker
|
|
|
515 |
# These will be added to the clean list
|
|
|
516 |
#
|
| 335 |
dpurdie |
517 |
ToolsetGenerate( $d90 );
|
|
|
518 |
ToolsetGenerate( $map );
|
|
|
519 |
ToolsetGenerate( "$full.keep" );
|
| 227 |
dpurdie |
520 |
|
|
|
521 |
#
|
|
|
522 |
# Create a linker command file
|
|
|
523 |
# Piecing together a variable $(name_ld) which ends up in the command file.
|
|
|
524 |
# This bit of magic will be performed by the LD_IAR recipe
|
|
|
525 |
#
|
|
|
526 |
$io->SetTag( "${name}_ld" ); # macro tag
|
|
|
527 |
$io->Label( "Linker commands", $name ); # label
|
|
|
528 |
|
|
|
529 |
$io->Cmd("-S" ); # Silent
|
| 335 |
dpurdie |
530 |
$io->Cmd("-Omotorola=$s19" ); # Output file
|
|
|
531 |
$io->Cmd("-o $d90" ); # Output file
|
|
|
532 |
$io->Cmd("-l $map" ); # Map file
|
| 227 |
dpurdie |
533 |
$io->Cmd("-r" ); # Output with debug
|
|
|
534 |
$io->Cmd("-z" ); # Reduce segment overlap errors
|
|
|
535 |
$io->Cmd("-xmsn" ); # Add info to the map file
|
|
|
536 |
$io->Cmd("-p100" ); # Number of line per page
|
|
|
537 |
$io->Cmd("-f $script" ); # User script file
|
|
|
538 |
|
|
|
539 |
$io->ObjList( $name, $pObjs, \&ToolsetObjRecipe ); # Object files
|
|
|
540 |
|
|
|
541 |
#
|
|
|
542 |
# Specify the library files
|
|
|
543 |
#
|
|
|
544 |
$io->Cmd( '"-I$(avr_linker_lib_dir)"' ); # Toolset library directory
|
|
|
545 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe ); # Specify the libraries too
|
|
|
546 |
$io->Newline();
|
|
|
547 |
|
| 335 |
dpurdie |
548 |
#.. Dependency link,
|
| 227 |
dpurdie |
549 |
# Create a library dependency file
|
| 335 |
dpurdie |
550 |
# Create command file to build applicaton dependency list
|
|
|
551 |
# from the list of dependent libraries
|
| 227 |
dpurdie |
552 |
#
|
| 335 |
dpurdie |
553 |
# Create makefile directives to include the dependency
|
|
|
554 |
# list into the makefile.
|
| 227 |
dpurdie |
555 |
#
|
| 335 |
dpurdie |
556 |
$io->DepRules( $pLibs, \&ToolsetLibRecipe, $s19 );
|
|
|
557 |
$io->LDDEPEND();
|
| 227 |
dpurdie |
558 |
|
|
|
559 |
#
|
|
|
560 |
# Add the MAP file to the program package
|
|
|
561 |
#
|
| 335 |
dpurdie |
562 |
PackageProgAddFiles ( $name, $full );
|
|
|
563 |
PackageProgAddFiles ( $name, $map , 'Class=map' );
|
| 227 |
dpurdie |
564 |
|
|
|
565 |
|
|
|
566 |
#
|
|
|
567 |
# Create the .sxml file
|
|
|
568 |
#
|
|
|
569 |
my $sxml = "\$(BINDIR)/${name}.sxml";
|
|
|
570 |
my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($ScmBuildVersionFull);
|
|
|
571 |
|
|
|
572 |
$io->Label( "SXML File", $name );
|
| 335 |
dpurdie |
573 |
$io->Prt( "$sxml: $s19\n");
|
| 227 |
dpurdie |
574 |
$io->Prt( "\t\$(call GENERATE_SXML, \\" .
|
|
|
575 |
"\n\t\t\$(BINDIR)/${name}$exe, \\" .
|
| 5679 |
dpurdie |
576 |
"\n\t\t$sxml,$type_text,$major,$minor,$patch,$build,Atmel)\n"
|
| 227 |
dpurdie |
577 |
);
|
|
|
578 |
$io->Newline();
|
|
|
579 |
|
|
|
580 |
#
|
|
|
581 |
# Generated files to be added to the program file list
|
|
|
582 |
#
|
|
|
583 |
ToolsetGenerate( $sxml );
|
|
|
584 |
PackageProgAddFiles( $name, $sxml, 'Class=extras' );
|
|
|
585 |
ProgAddExtra( $name, $sxml );
|
|
|
586 |
|
|
|
587 |
}
|
|
|
588 |
|
|
|
589 |
########################################################################
|
|
|
590 |
#
|
|
|
591 |
# Generate a linker object recipe. This is a helper function used
|
|
|
592 |
# within this toolset.
|
|
|
593 |
#
|
|
|
594 |
# Arguments:
|
|
|
595 |
# $io I/O stream
|
|
|
596 |
#
|
|
|
597 |
# $target Name of the target
|
|
|
598 |
#
|
|
|
599 |
# $obj Library specification
|
|
|
600 |
#
|
|
|
601 |
########################################################################
|
|
|
602 |
|
|
|
603 |
sub ToolsetObjRecipe
|
|
|
604 |
{
|
|
|
605 |
my ($io, $target, $obj) = @_;
|
|
|
606 |
|
|
|
607 |
$io->Cmd("$obj.$::o" );
|
|
|
608 |
}
|
|
|
609 |
|
|
|
610 |
########################################################################
|
|
|
611 |
#
|
|
|
612 |
# Generate a linker/depend library recipe. This is a helper function
|
|
|
613 |
# used within this toolset.
|
|
|
614 |
#
|
|
|
615 |
# Arguments:
|
|
|
616 |
# $io I/O stream
|
|
|
617 |
#
|
|
|
618 |
# $target Name of the target
|
|
|
619 |
#
|
|
|
620 |
# $lib Library specification
|
|
|
621 |
#
|
|
|
622 |
# $dp If building a depend list, the full target name.
|
|
|
623 |
#
|
|
|
624 |
########################################################################
|
|
|
625 |
|
|
|
626 |
sub ToolsetLibRecipe
|
|
|
627 |
{
|
|
|
628 |
my ($io, $target, $lib, $dp) = @_;
|
|
|
629 |
|
|
|
630 |
if ( !defined($dp) ) { # linker
|
|
|
631 |
$io->Cmd("-C @(vpath2,\"$lib.$::a\",IAR_LIB)" );
|
|
|
632 |
} else { # depend
|
|
|
633 |
$io->Cmd( "$dp:\t@(vlib2,\"$lib.$::a\",IAR_LIB)" );
|
|
|
634 |
}
|
|
|
635 |
}
|
|
|
636 |
|
|
|
637 |
#.. Successful termination
|
|
|
638 |
1;
|
|
|
639 |
|