CMSIS2000  0.0.7
 Указатель Структуры данных Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Макросы Группы Страницы
lpc2xxx_generic_ram.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 /** \page nxp_port_gerenric_linker_ram NXP GENERIC 2xxx LINKER SCRIPT FOR DEBUG PURPOSES (breakpoints in RAM)
34 
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.ld *
41  * INCLUDE ../CMSIS/Device/NXP/LPC2xxx/Source/GCC/lpc2xxx_generic_ram.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  * . |---------------------------------| *
113  * . | | *
114  * . | C code | *
115  * . | *(.text) | *
116  * .-------> |---------------------------------|0x00000xxx <----------- _data *
117  * . |---------------------------------|0x40000040 *
118  * . | |0x4000003F *
119  * . | Interrupt Vectors (re-mapped) | *
120  * . | 56-64 bytes |0x40000000 *
121  * .-------->|---------------------------------| *
122  * | | *
123  * *
124  * *
125  * *
126  * | | *
127  * .--------> |---------------------------------| *
128  * . | |0x00xxxFFF *
129  * . | | *
130  * . | | *
131  * . | | *
132  * . | | *
133  * . | | *
134  * . | unused flash eprom | *
135  * . | | *
136  * . |.................................| *
137  * . | | *
138  * . | | *
139  * . | | *
140  * . | copy of .data area | *
141  * flash | (.data) | *
142  * . | (.text.ram_code) | *
143  * . | | *
144  * . |---------------------------------|
145  * . | | *
146  * . | copy of C code | *
147  * . | *(.text) | *
148  * . |---------------------------------|0x00000xxx <----------- _etext *
149  * . | | *
150  * . | READ ONLY DATA | *
151  * . | *(.rodata*) | *
152  * . | | *
153  * . |---------------------------------| *
154  * . | |0x0000xxxx *
155  * . | Startup Code | *
156  * . | (assembler) | *
157  * . | *(.text.vectors) | *
158  * . |---------------------------------|0x00000064 Reset_Handler *
159  * . | SELF COPY CODE HERE (assembler) | *
160  * . | *(.text.vectors) |0x00000040 sc_here *
161  * . |---------------------------------| *
162  * . | Interrupt Vector Table | *
163  * . | 56-64 bytes | *
164  * .--------->|---------------------------------|0x00000000 _vectors, *
165  * _vectors_start,_startup *
166  * *
167  * *
168  * *
169  * Author: James P. Lynch *
170  * Author: Dmitriy A. Cherepanov *
171 \endverbatim
172 /* *****************************************************************************************/
173 default_align = 4; /* 32 bit arch and 8 bit in byte -- 4 byte align*/
174 /* identify the Entry Point */
175 ENTRY(_vectors) /* image file will be started from this symbol*/
176 vectors_size_in_RAM = _vectors_end - _vectors_start;
177 
178 /* Library configurations */
179 GROUP(libgcc.a libc.a libm.a libnosys.a)
180 
181 /* now define the output sections */
182 SECTIONS
183 {
184  . = 0; /* set location counter to address zero */
185  .vectors_in_flash :
186  {
187  *(.text.vectors*)
188  *(.text.systeminit*) /*__attribute__ ((section (".text.systeminit")))*/
189  *(.text.rom_code*) /*__attribute__ ((section (".text.rom_code")))*/
190  . = ALIGN(default_align);
191  *(.rodata*) /* all .rodata sections (constants, strings, etc.) */
192  . = ALIGN(default_align);
193  } >flash
194 
195 
196  . = ALIGN(default_align);
197  _etext = . - ORIGIN(flash);/* define a global symbol _etext just at the firs data byte in flash image */
198 
199 
200  .vectors_in_ram INTERNAL_RAM_START (NOLOAD) :
201  {
202  . = ALIGN(default_align);
203  . = . + vectors_size_in_RAM;
204  . = ALIGN(default_align);
205  } > ram
206 
207  .text : /* collect all sections that should go into FLASH after startup */
208  {
209  __data_start = .; /* create a global symbol marking the start of the .text + .data sections */
210  KEEP(*(.text.keep.vector*))/* interrupt handlers */
211  . = ALIGN(default_align);
212  *(.text.ram_code*) /*__attribute__ ((section (".text.ram_code")))*/
213  . = ALIGN(default_align);
214  *(.text*) /* all .text sections (code) */
215 
216  . = ALIGN(default_align);
217  *(.glue_7*) /* all .glue_7 sections (arm/thump interwork code) */
218  *(.glue_7t*) /* all .glue_7t sections (arm/thump interwork code) */
219  *(.eh_frame*) /* all .glue_7t sections (no idea what these are) */
220  *(.vfp11_veneer*)/* all .glue_7t sections (no idea what these are) */
221  *(.v4_bx*) /* all .glue_7t sections (no idea what these are) */
222  } >ram AT >flash /* put all the above into RAM */
223 
224  .ARM.extab :
225  {
226  *(.ARM.extab* .gnu.linkonce.armextab.*)
227  } >ram AT > flash
228 
229  __exidx_start = .;
230  .ARM.exidx :
231  {
232  *(.ARM.exidx* .gnu.linkonce.armexidx.*)
233  } >ram AT > flash
234  __exidx_end = .;
235 
236  .data : /* collect all initialized .data sections that go into RAM */
237  {
238  *(.data*) /* all .data sections */
239  __data_end = .; /* define a global symbol marking the end of the .data section */
240  }>ram AT >flash
241  .bss (NOLOAD) : /* collect all uninitialized .bss sections that go into RAM */
242  {
243  __bss_start = .;/* define a global symbol marking the start of the .bss section */
244  *(EXCLUDE_FILE (*heap_data*.o) .bss*) /* all .bss sections */
245  *heap_data*.o (.bss*) /* let put heap at the end*/
246  } >ram /* put all the above in RAM (it will be cleared in the startup code */
247 
248  . = ALIGN(default_align);/* advance location counter to the next 32-bit boundary */
249  __bss_end = . ; /* define a global symbol marking the end of the .bss section */
250 
251  _end = .; /* define a global symbol marking the end of application RAM */
252  PROVIDE (end = .);
253 
254  .rtcram_sect (NOLOAD):
255  {
256  *(.ram_battery*)
257  }>rtcram
258 
259  .usbram_sect (NOLOAD):
260  {
261  *(.usbram*)
262  *(.usb_ram*)
263  *(.USB_RAM*)
264  }>usbram
265  .ethram_sect (NOLOAD):
266  {
267  *(.ethram*)
268  *(.eth_ram*)
269  *(.eth_RAM*)
270  }>usbram
271 }