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