CMSIS2000  0.0.7
 Указатель Структуры данных Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Макросы Группы Страницы
lpc2xxx_generic_flash.ld
См. документацию.
1 /*
2  * CMSIS2000
3  * CMSIS-like sources for LPC2xxx series MCUs
4  *
5  * (C) Copyright 2011-2012, Dmitriy Cherepanov, All Rights Reserved
6  *
7  * Version: 0.0.7
8  * Date of the Last Update: 2013-03-04
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a copy
11  * of this software and associated documentation files (the "Software"), to
12  * deal in the Software without restriction, including without limitation the
13  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14  * sell copies of the Software, and to permit persons to whom the Software is
15  * furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included in
18  * all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26  * IN THE SOFTWARE.
27  *
28  * Do not be lasy! For the latest version see http://irtos.sourceforge.net .
29  *
30  *
31 #*/
32 
33 /* ************************************************************************************** */
34 /** \page nxp_port_gerenric_linker_flash NXP GENERIC 2xxx LINKER SCRIPT FOR APPLICATION IN FLASH
35 \verbatim
36  * *
37  * THIS SCRIPT HAS NO MEMORY SECTIONS DEFENITON !!!!! USE THIS SCRIPT AS A PART OF OTHER *
38  * *
39  * FOR EXAMPLE: *
40  * INCLUDE ../CMSIS/Device/NXP/LPC2xxx/Source/GCC/lpc24x8_sect.ld *
41  * INCLUDE ../CMSIS/Device/NXP/LPC2xxx/Source/GCC/lpc2xxx_generic_flash.ld *
42  * *
43  * The Linker Script defines how the code and data emitted by the GNU C compiler and *
44  * assembler are to be loaded into memory (code goes into FLASH, variables go into RAM). *
45  * *
46  * Any symbols defined in the Linker Script are automatically global and available *
47  * to the rest of the program. *
48  * *
49  * To force the linker to use this LINKER SCRIPT, just add the *
50  * -T demo2106_blink_flash.cmd directive to the linker flags in the makefile. *
51  * *
52  * LFLAGS = -Map main.map -nostartfiles -T YOU_SCRIPT.cmd *
53  * *
54  * *
55  * The Philips boot loader supports the ISP (In System Programming) via the serial port and the IAP *
56  * (In Application Programming) for flash programming from within your application. *
57  * *
58  * The boot loader uses RAM memory and we MUST NOT load variables or code in these areas. *
59  * The easy way to prevent the linker from loading anything into a memory area is to define*
60  * a MEMORY region for it and then avoid assigning any .text, .data or .bss sections into it.*
61  * MEMORY *
62  * { *
63  * ram_isp_low(A) : ORIGIN = 0x40000120, LENGTH = 223 *
64  * *
65  * } *
66  * *
67  * RAM used by boot loader: 0x40000120 - 0x400001FF (223 bytes) for ISP variables *
68  * 0x4000FFE0 - 0x4000FFFF (32 bytes) for ISP and IAP variables*
69  * 0x4000FEE0 - 0x4000FFDF (256 bytes) stack for ISP and IAP *
70  * *
71  *-----------------------------------------------------------------------------------------*
72  * *
73  * *
74  * MEMORY MAP *
75  * | |0x40xx0000 *
76  * END OF RAM.-------->|---------------------------------| *
77  * | SVC Stack 8 bytes |0x40xxxFFC <------- _stack_end *
78  * .-------->|---------------------------------| *
79  * | FIQ Stack X bytes |0x40xxxxxx *
80  * .-------->|---------------------------------| *
81  * | ABT Stack Y bytes |0x40xxxxxx *
82  * .-------->|---------------------------------| *
83  * | UDF Stack Z bytes |0x40xxxxxx *
84  * .-------->|---------------------------------| *
85  * | IRQ Stack I bytes |0x40xxxxxx *
86  * .-------->|---------------------------------| *
87  * . | |0x40xxxxxx *
88  * . | stack area for user program | *
89  * . | | *
90  * . | | *
91  * . | | *
92  * . | | *
93  * . | | *
94  * . | | *
95  * . | free ram | *
96  * ram | | *
97  * . | | *
98  * . | ^^ ^MALLOC HEAP HERE ?^^^^^ | *
99  * . | | *
100  * . |.................................|0x40000xxx <---------- _bss_end *
101  * . | | *
102  * . | .bss uninitialized variables | *
103  * . |.................................|0x40000xxx <- _bss_start, _edata*
104  * . |.................................| *
105  * . | | *
106  * . | | *
107  * . | | *
108  * . | DATA AREA | *
109  * . | (.data) | *
110  * . | (.text.ram_code) | *
111  * . | | *
112  * .-------> |---------------------------------|0x00000xxx <----------- _data *
113  * . |---------------------------------|0x40000040 *
114  * . | |0x4000003F *
115  * . | Interrupt Vectors (re-mapped) | *
116  * . | 56-64 bytes |0x40000000 *
117  * .-------->|---------------------------------| *
118  * | | *
119  * *
120  * *
121  * *
122  * | | *
123  * .--------> |---------------------------------| *
124  * . | |0x00xxxFFF *
125  * . | | *
126  * . | | *
127  * . | | *
128  * . | | *
129  * . | | *
130  * . | unused flash eprom | *
131  * . | | *
132  * . |.................................| *
133  * . | | *
134  * . | | *
135  * . | | *
136  * . | copy of .data area | *
137  * flash | (.data) | *
138  * . | (.text.ram_code) | *
139  * . | | *
140  * . |---------------------------------|0x00000xxx <----------- _etext *
141  * . | | *
142  * . | READ ONLY DATA | *
143  * . | *(.rodata*) | *
144  * . | | *
145  * . |---------------------------------| *
146  * . | | *
147  * . | C code | *
148  * . | *(.text) | *
149  * . |---------------------------------| *
150  * . | |0x00000xxx *
151  * . | Startup Code | *
152  * . | (assembler) | *
153  * . | *(.text.vectors) | *
154  * . |---------------------------------|0x00000064 Reset_Handler *
155  * . | SELF COPY CODE HERE (assembler) | *
156  * . | *(.text.vectors) |0x00000040 sc_here *
157  * . |---------------------------------| *
158  * . | Interrupt Vector Table | *
159  * . | 56-64 bytes | *
160  * .--------->|---------------------------------|0x00000000 _vectors, *
161  * _vectors_start,_startup *
162  * *
163  * *
164  * *
165  * Author: James P. Lynch *
166  * Author: Dmitriy A. Cherepanov *
167 \endverbatim
168  */
169 /* *****************************************************************************************/
170 /* this way you can but some obj file near other
171  * .text :
172  * {
173  * *start .o (. text)
174  * }
175  */
176 /* *****************************************************************************************/
177 default_align = 4; /* 32 bit arch and 8 bit in byte -- 4 byte align*/
178 /* identify the Entry Point */
179 ENTRY(_vectors) /* image file will be started from this symbol*/
180 vectors_size_in_RAM = _vectors_end - _vectors_start;
181 
182 /* Library configurations */
183 GROUP(libgcc.a libc.a libm.a libnosys.a)
184 
185 
186 /* now define the output sections */
187 SECTIONS
188 {
189  . = 0; /* set location counter to address zero */
190  .vectors_in_flash 0 :
191  {
192  *(.text.vectors*)
193  . = ALIGN(default_align);
194  } >flash
195 
196  .text : /* collect all sections that should go into FLASH after startup */
197  {
198  KEEP(*(.text.keep.vector*))/* interrupt handlers */
199  *(.text*) /* all .text sections (code) */
200  . = ALIGN(default_align);
201  *(.rodata*) /* all .rodata* sections (constants, strings, etc.) */
202  . = ALIGN(default_align);
203  *(.glue_7*) /* all .glue_7 sections (arm/thump interwork code) */
204  *(.glue_7t*) /* all .glue_7t sections (arm/thump interwork code) */
205  *(.vfp11_veneer*)/* all .glue_7t sections (no idea what these are) */
206  *(.v4_bx*) /* all .glue_7t sections (no idea what these are) */
207 
208  . = ALIGN(default_align);
209  KEEP(*(.eh_frame*))/* all .glue_7t sections (no idea what these are) */
210  . = ALIGN(default_align);
211  } >flash /* put all the above into FLASH */
212 
213  .ARM.extab :
214  {
215  *(.ARM.extab* .gnu.linkonce.armextab.*)
216  } > flash
217 
218  __exidx_start = .;
219  .ARM.exidx :
220  {
221  *(.ARM.exidx* .gnu.linkonce.armexidx.*)
222  } > flash
223  __exidx_end = .;
224  _etext = . - ORIGIN(flash); /* define a global symbol _etext just at the firs data byte in flash image */
225 
226  .vectors_in_ram INTERNAL_RAM_START (NOLOAD) :
227  {
228  . = ALIGN(default_align);
229  . = . + vectors_size_in_RAM;
230  . = ALIGN(default_align);
231  } > ram
232 
233  .data : AT (_etext) /* collect all initialized .data sections that go into RAM */
234  {
235 
236  __data_start = .; /* create a global symbol marking the start
237  of the .data and .text.ram_code section */
238  *(.text.ram_code*) /*__attribute__ ((section (".text.ram_code")))*/
239  . = ALIGN(default_align);
240  *(.data*) /* all .data sections */
241  __data_end = .; /* define a global symbol marking the end of the .data section */
242  } >ram /* put all the above into RAM (but load the LMA copy into FLASH) */
243 
244  .bss (NOLOAD): /* collect all uninitialized .bss sections that go into RAM */
245  {
246  PROVIDE (__bss_start = .);
247  /* define a global symbol marking the start of the .bss section */
248  _bss_start = .;/* all .bss sections */
249  *(EXCLUDE_FILE (*heap_data*.o) .bss*) /* all .bss sections */
250  *heap_data*.o (.bss*) /* let put heap at the end*/
251  } >ram /* put all the above in RAM (it will be cleared in the startup code */
252 
253  . = ALIGN(default_align);/* advance location counter to the next 32-bit boundary */
254 
255  /* define a global symbol marking the end of the .bss section */
256  __bss_end = . ;
257 
258  .noinit (NOLOAD):
259  {
260  PROVIDE (__noinit_start = .) ;
261  *(.noinit*)
262  PROVIDE (__noinit_end = .) ;
263  _end = . ;
264  PROVIDE (__heap_start = .) ;
265  } > ram
266 
267  _end = .; /* define a global symbol marking the end of application RAM */
268  PROVIDE (end = .);
269 
270  .rtcram_sect (NOLOAD):
271  {
272  *(.ram_battery*)
273  }>rtcram
274 
275  .usbram_sect (NOLOAD):
276  {
277  *(.usbram*)
278  *(.usb_ram*)
279  *(.USB_RAM*)
280  }>usbram
281  .ethram_sect (NOLOAD):
282  {
283  *(.ethram*)
284  *(.eth_ram*)
285  *(.eth_RAM*)
286  }>usbram
287 
288 }