1 //*************************************************************************
\r
2 // XLINK command file template for EWARM/ICCARM
\r
4 // Usage: xlink -f lnkarm <your_object_file(s)>
\r
5 // -s <program start label> <C/C++ runtime library>
\r
8 //*************************************************************************
\r
10 //*************************************************************************
\r
11 // In this file it is assumed that the system has the following
\r
14 // ROMSTART--ROMEND [00000000--00001FFF] Flash
\r
15 // RAMSTART--RAMEND [20000000--200007FF] RAM
\r
18 // Code segments - may be placed anywhere in memory (except INTVEC).
\r
21 // INTVEC -- Exception vector table.
\r
22 // SWITAB -- Software interrupt vector table.
\r
23 // ICODE -- Startup (cstartup) and exception code.
\r
24 // DIFUNCT -- Dynamic initialization vectors used by C++.
\r
25 // CODE -- Compiler generated code.
\r
26 // CODE_I -- Compiler generated code declared __ramfunc (executes in RAM)
\r
27 // CODE_ID -- Initializer for CODE_I (ROM).
\r
30 // Data segments - may be placed anywhere in memory.
\r
33 // CSTACK -- The stack used by C/C++ programs (system and user mode).
\r
34 // HEAP -- The heap used by malloc and free in C and new and
\r
36 // INITTAB -- Table containing addresses and sizes of segments that
\r
37 // need to be initialized at startup (by cstartup).
\r
38 // CHECKSUM -- The linker places checksum byte(s) in this segment,
\r
39 // when the -J linker command line option is used.
\r
40 // DATA_y -- Data objects.
\r
42 // Where _y can be one of:
\r
44 // _AN -- Holds uninitialized located objects, i.e. objects with
\r
45 // an absolute location given by the @ operator or the
\r
46 // #pragma location directive. Since these segments
\r
47 // contain objects which already have a fixed address,
\r
48 // they should not be mentioned in this linker command
\r
50 // _C -- Constants (ROM).
\r
51 // _I -- Initialized data (RAM).
\r
52 // _ID -- The original content of _I (copied to _I by cstartup) (ROM).
\r
53 // _N -- Uninitialized data (RAM).
\r
54 // _Z -- Zero initialized data (RAM).
\r
56 // Note: Be sure to use end values for the defined address ranges.
\r
57 // Otherwise, the linker may allocate space outside the
\r
58 // intended memory range.
\r
59 //*************************************************************************
\r
62 //************************************************
\r
63 // Inform the linker about the CPU family used.
\r
64 //************************************************
\r
68 //*************************************************************************
\r
69 // Segment placement - General information
\r
71 // All numbers in the segment placement command lines below are interpreted
\r
72 // as hexadecimal unless they are immediately preceded by a '.', which
\r
73 // denotes decimal notation.
\r
75 // When specifying the segment placement using the -P instead of the -Z
\r
76 // option, the linker is free to split each segment into its segment parts
\r
77 // and randomly place these parts within the given ranges in order to
\r
78 // achieve a more efficient memory usage. One disadvantage, however, is
\r
79 // that it is not possible to find the start or end address (using
\r
80 // the assembler operators .sfb./.sfe.) of a segment which has been split
\r
83 // When generating an output file which is to be used for programming
\r
84 // external ROM/Flash devices, the -M linker option is very useful
\r
85 // (see xlink.pdf for details).
\r
86 //*************************************************************************
\r
89 //*************************************************************************
\r
90 // Read-only segments mapped to ROM.
\r
91 //*************************************************************************
\r
96 //************************************************
\r
97 // Address range for reset and exception
\r
98 // vectors (INTVEC).
\r
99 // The vector area is at least 8 bytes,
\r
100 // and is normally located at address 0.
\r
101 // It may be changed to a RAM address when
\r
102 // debugging in RAM (aligned to 2^7).
\r
103 //************************************************
\r
105 -Z(CODE)INTVEC=ROMSTART-ROMEND
\r
107 //************************************************
\r
108 // Startup code and exception routines (ICODE).
\r
109 //************************************************
\r
111 -Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND
\r
112 -Z(CODE)SWITAB=ROMSTART-ROMEND
\r
114 //************************************************
\r
115 // Code segments may be placed anywhere.
\r
116 //************************************************
\r
118 -Z(CODE)CODE=ROMSTART-ROMEND
\r
120 //************************************************
\r
121 // Original ROM location for __ramfunc code copied
\r
122 // to and executed from RAM.
\r
123 //************************************************
\r
125 -Z(CONST)CODE_ID=ROMSTART-ROMEND
\r
127 //************************************************
\r
128 // Various constants and initializers.
\r
129 //************************************************
\r
131 -Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND
\r
132 -Z(CONST)CHECKSUM=ROMSTART-ROMEND
\r
134 //*************************************************************************
\r
135 // Read/write segments mapped to RAM.
\r
136 //*************************************************************************
\r
138 -DRAMSTART=20000000
\r
141 //************************************************
\r
143 //************************************************
\r
145 -Z(DATA)VTABLE=RAMSTART-RAMEND
\r
147 -Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND
\r
149 //************************************************
\r
150 // __ramfunc code copied to and executed from RAM.
\r
151 //************************************************
\r
153 -Z(DATA)CODE_I=RAMSTART-RAMEND
\r
155 //************************************************
\r
156 // ICCARM produces code for __ramfunc functions in
\r
157 // CODE_I segments. The -Q XLINK command line
\r
158 // option redirects XLINK to emit the code in the
\r
159 // CODE_ID segment instead, but to keep symbol and
\r
160 // debug information associated with the CODE_I
\r
161 // segment, where the code will execute.
\r
162 //************************************************
\r
166 //*************************************************************************
\r
167 // Stack and heap segments.
\r
168 //*************************************************************************
\r
171 -D_IRQ_STACK_SIZE=100
\r
174 -Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
\r
175 -Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND
\r
177 //*************************************************************************
\r
178 // ELF/DWARF support.
\r
180 // Uncomment the line "-Felf" below to generate ELF/DWARF output.
\r
181 // Available format specifiers are:
\r
183 // "-yn": Suppress DWARF debug output
\r
184 // "-yp": Multiple ELF program sections
\r
185 // "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag)
\r
187 // "-Felf" and the format specifiers can also be supplied directly as
\r
188 // command line options, or selected from the Xlink Output tab in the
\r
189 // IAR Embedded Workbench.
\r
190 //*************************************************************************
\r