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 // Code memory in flash
\r
11 -DROMSTART=0x00000000
\r
16 -DRAMSTART=0x20000000
\r
20 //*************************************************************************
\r
21 // In this file it is assumed that the system has the following
\r
24 // Exception vectors [0x000000--0x00001F] RAM or ROM
\r
25 // ROMSTART--ROMEND [0x008000--0x0FFFFF] ROM (or other non-volatile memory)
\r
26 // RAMSTART--RAMEND [0x100000--0x7FFFFF] RAM (or other read/write memory)
\r
29 // Code segments - may be placed anywhere in memory.
\r
32 // INTVEC -- Exception vector table.
\r
33 // SWITAB -- Software interrupt vector table.
\r
34 // ICODE -- Startup (cstartup) and exception code.
\r
35 // DIFUNCT -- Dynamic initialization vectors used by C++.
\r
36 // CODE -- Compiler generated code.
\r
37 // CODE_I -- Compiler generated code declared __ramfunc (executes in RAM)
\r
38 // CODE_ID -- Initializer for CODE_I (ROM).
\r
41 // Data segments - may be placed anywhere in memory.
\r
44 // CSTACK -- The stack used by C/C++ programs (system and user mode).
\r
45 // IRQ_STACK -- The stack used by IRQ service routines.
\r
46 // SVC_STACK -- The stack used in supervisor mode
\r
47 // (Define other exception stacks as needed for
\r
49 // HEAP -- The heap used by malloc and free in C and new and
\r
51 // INITTAB -- Table containing addresses and sizes of segments that
\r
52 // need to be initialized at startup (by cstartup).
\r
53 // CHECKSUM -- The linker places checksum byte(s) in this segment,
\r
54 // when the -J linker command line option is used.
\r
55 // DATA_y -- Data objects.
\r
57 // Where _y can be one of:
\r
59 // _AN -- Holds uninitialized located objects, i.e. objects with
\r
60 // an absolute location given by the @ operator or the
\r
61 // #pragma location directive. Since these segments
\r
62 // contain objects which already have a fixed address,
\r
63 // they should not be mentioned in this linker command
\r
65 // _C -- Constants (ROM).
\r
66 // _I -- Initialized data (RAM).
\r
67 // _ID -- The original content of _I (copied to _I by cstartup) (ROM).
\r
68 // _N -- Uninitialized data (RAM).
\r
69 // _Z -- Zero initialized data (RAM).
\r
71 // Note: Be sure to use end values for the defined address ranges.
\r
72 // Otherwise, the linker may allocate space outside the
\r
73 // intended memory range.
\r
74 //*************************************************************************
\r
77 //************************************************
\r
78 // Inform the linker about the CPU family used.
\r
79 //************************************************
\r
83 //*************************************************************************
\r
84 // Segment placement - General information
\r
86 // All numbers in the segment placement command lines below are interpreted
\r
87 // as hexadecimal unless they are immediately preceded by a '.', which
\r
88 // denotes decimal notation.
\r
90 // When specifying the segment placement using the -P instead of the -Z
\r
91 // option, the linker is free to split each segment into its segment parts
\r
92 // and randomly place these parts within the given ranges in order to
\r
93 // achieve a more efficient memory usage. One disadvantage, however, is
\r
94 // that it is not possible to find the start or end address (using
\r
95 // the assembler operators .sfb./.sfe.) of a segment which has been split
\r
98 // When generating an output file which is to be used for programming
\r
99 // external ROM/Flash devices, the -M linker option is very useful
\r
100 // (see xlink.pdf for details).
\r
101 //*************************************************************************
\r
104 //*************************************************************************
\r
105 // Read-only segments mapped to ROM.
\r
106 //*************************************************************************
\r
108 //************************************************
\r
109 // Address range for reset and exception
\r
110 // vectors (INTVEC).
\r
111 // The vector area is 32 bytes,
\r
112 // an additional 32 bytes is allocated for the
\r
113 // constant table used by ldr PC in cstartup.s79.
\r
114 //************************************************
\r
116 -Z(CODE)INTVEC=VECSTART:+0x940
\r
118 //************************************************
\r
119 // Startup code and exception routines (ICODE).
\r
120 //************************************************
\r
122 -Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND
\r
123 -Z(CODE)SWITAB=ROMSTART-ROMEND
\r
125 //************************************************
\r
126 // Code segments may be placed anywhere.
\r
127 //************************************************
\r
129 -Z(CODE)CODE=ROMSTART-ROMEND
\r
131 //************************************************
\r
132 // Original ROM location for __ramfunc code copied
\r
133 // to and executed from RAM.
\r
134 //************************************************
\r
136 -Z(CONST)CODE_ID=ROMSTART-ROMEND
\r
138 //************************************************
\r
139 // Various constants and initializers.
\r
140 //************************************************
\r
142 -Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND
\r
143 -Z(CONST)CHECKSUM=ROMSTART-ROMEND
\r
146 //*************************************************************************
\r
147 // Read/write segments mapped to RAM.
\r
148 //*************************************************************************
\r
150 //************************************************
\r
152 //************************************************
\r
154 -Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND
\r
156 //************************************************
\r
157 // __ramfunc code copied to and executed from RAM.
\r
158 //************************************************
\r
160 -Z(DATA)CODE_I=RAMSTART-RAMEND
\r
162 //************************************************
\r
163 // ICCARM produces code for __ramfunc functions in
\r
164 // CODE_I segments. The -Q XLINK command line
\r
165 // option redirects XLINK to emit the code in the
\r
166 // CODE_ID segment instead, but to keep symbol and
\r
167 // debug information associated with the CODE_I
\r
168 // segment, where the code will execute.
\r
169 //************************************************
\r
173 //*************************************************************************
\r
174 // Stack and heap segments.
\r
175 //*************************************************************************
\r
177 //-D_CSTACK_SIZE=400
\r
178 // -D_SVC_STACK_SIZE=10
\r
179 //-D_IRQ_STACK_SIZE=500
\r
182 //-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
\r
183 //-Z(DATA)SVC_STACK+_SVC_STACK_SIZE=RAMSTART-RAMEND
\r
184 //-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE,HEAP+_HEAP_SIZE=RAMSTART-RAMEND
\r
186 //*************************************************************************
\r
187 // ELF/DWARF support.
\r
189 // Uncomment the line "-Felf" below to generate ELF/DWARF output.
\r
190 // Available format specifiers are:
\r
192 // "-yn": Suppress DWARF debug output
\r
193 // "-yp": Multiple ELF program sections
\r
194 // "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag)
\r
196 // "-Felf" and the format specifiers can also be supplied directly as
\r
197 // command line options, or selected from the Xlink Output tab in the
\r
198 // IAR Embedded Workbench.
\r
199 //*************************************************************************
\r