]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/sections.ld
Updates to support FreeRTOS MPU in FreeRTOS V9.0.0 - including a GCC project that...
[freertos] / FreeRTOS / Demo / CORTEX_MPU_Simulator_Keil_GCC / GCC_Specific / sections.ld
1 /* Default memory layout. */\r
2 MEMORY\r
3 {\r
4   ROM (rx)         : ORIGIN = 0x00, LENGTH = 0x80000\r
5   RAM (rw)         : ORIGIN = 0x20000000, LENGTH = 0x8000\r
6 }\r
7 \r
8 /* Variables required by FreeRTOS MPU. */\r
9 _Privileged_Functions_Region_Size = 16K;\r
10 _Privileged_Data_Region_Size = 256;\r
11 \r
12 __FLASH_segment_start__ = ORIGIN( ROM );\r
13 __FLASH_segment_end__ = __FLASH_segment_start__ + LENGTH( ROM );\r
14 \r
15 __privileged_functions_start__ = ORIGIN( ROM );\r
16 __privileged_functions_end__ = __privileged_functions_start__ + _Privileged_Functions_Region_Size;\r
17 \r
18 __SRAM_segment_start__ = ORIGIN( RAM );\r
19 __SRAM_segment_end__ = __SRAM_segment_start__ + LENGTH( RAM );\r
20 \r
21 __privileged_data_start__ = ORIGIN( RAM );\r
22 __privileged_data_end__ = ORIGIN( RAM ) + _Privileged_Data_Region_Size;\r
23 \r
24 /* Variables used by FreeRTOS-MPU. */\r
25 _Privileged_Functions_Region_Size = 16K;\r
26 _Privileged_Data_Region_Size = 256;\r
27 \r
28 __FLASH_segment_start__ = ORIGIN( ROM );\r
29 __FLASH_segment_end__ = __FLASH_segment_start__ + LENGTH( ROM );\r
30 \r
31 __privileged_functions_start__ = ORIGIN( ROM );\r
32 __privileged_functions_end__ = __privileged_functions_start__ + _Privileged_Functions_Region_Size;\r
33 \r
34 __SRAM_segment_start__ = ORIGIN( RAM );\r
35 __SRAM_segment_end__ = __SRAM_segment_start__ + LENGTH( RAM );\r
36 \r
37 __privileged_data_start__ = ORIGIN( RAM );\r
38 __privileged_data_end__ = ORIGIN( RAM ) + _Privileged_Data_Region_Size;\r
39 \r
40 \r
41 /*\r
42  * The '__stack' definition is required by crt0, do not remove it.\r
43  */\r
44 /* Place top of stack immediate before ROM Log\r
45  *__stack = ORIGIN(RAM) + LENGTH(RAM);\r
46  */\r
47 __stack = ORIGIN(RAM) + LENGTH(RAM);\r
48 \r
49 _estack = __stack;\r
50 \r
51 /*\r
52  * Default stack sizes.\r
53  * These are used by the startup in order to allocate stacks\r
54  * for the different modes.\r
55  */\r
56 \r
57 __Main_Stack_Size = 2048 ;\r
58 \r
59 PROVIDE ( _Main_Stack_Size = __Main_Stack_Size ) ;\r
60 \r
61 __Main_Stack_Limit = __stack  - __Main_Stack_Size ;\r
62 \r
63 /*"PROVIDE" allows to easily override these values from an object file or the command line. */\r
64 PROVIDE ( _Main_Stack_Limit = __Main_Stack_Limit ) ;\r
65 \r
66 /*\r
67  * There will be a link error if there is not this amount of\r
68  * RAM free at the end.\r
69  */\r
70 _Minimum_Stack_Size = 256 ;\r
71 \r
72 /*\r
73  * Default heap definitions.\r
74  * The heap start immediately after the last statically allocated\r
75  * .sbss/.noinit section, and extends up to the main stack limit.\r
76  */\r
77 PROVIDE ( _Heap_Begin = _end_noinit ) ;\r
78 PROVIDE ( _Heap_Limit = __stack - __Main_Stack_Size ) ;\r
79 \r
80 /*\r
81  * The entry point is informative, for debuggers and simulators,\r
82  * since the Cortex-M vector points to it anyway.\r
83  */\r
84 ENTRY(_start)\r
85 \r
86 /* Sections Definitions */\r
87 \r
88 SECTIONS\r
89 {\r
90     /*\r
91      * For Cortex-M devices, the beginning of the startup code is stored in\r
92      * the .isr_vector section, which goes to ROM\r
93      */\r
94     privileged_functions :\r
95     {\r
96         . = ALIGN(4);\r
97         _isr_vector = .;\r
98         KEEP(*(.isr_vector))\r
99         *(privileged_functions)\r
100         . = ALIGN(4);\r
101     } > ROM\r
102 \r
103 \r
104 \r
105     .text :\r
106     {\r
107         /* Non privileged code kept out of the first 16K or flash. */\r
108         . = __privileged_functions_start__ + _Privileged_Functions_Region_Size;\r
109 \r
110         . = ALIGN(4);\r
111 \r
112 \r
113         /*\r
114          * This section is here for convenience, to store the\r
115          * startup code at the beginning of the flash area, hoping that\r
116          * this will increase the readability of the listing.\r
117          */\r
118         KEEP(*(.after_vectors .after_vectors.*))    /* Startup code and ISR */\r
119 \r
120         . = ALIGN(4);\r
121 \r
122         /*\r
123          * These are the old initialisation sections, intended to contain\r
124          * naked code, with the prologue/epilogue added by crti.o/crtn.o\r
125          * when linking with startup files. The standalone startup code\r
126          * currently does not run these, better use the init arrays below.\r
127          */\r
128         KEEP(*(.init))\r
129         KEEP(*(.fini))\r
130 \r
131         . = ALIGN(4);\r
132 \r
133         /*\r
134          * The preinit code, i.e. an array of pointers to initialisation\r
135          * functions to be performed before constructors.\r
136          */\r
137         PROVIDE_HIDDEN (__preinit_array_start = .);\r
138 \r
139         /*\r
140          * Used to run the SystemInit() before anything else.\r
141          */\r
142         KEEP(*(.preinit_array_sysinit .preinit_array_sysinit.*))\r
143 \r
144         /*\r
145          * Used for other platform inits.\r
146          */\r
147         KEEP(*(.preinit_array_platform .preinit_array_platform.*))\r
148 \r
149         /*\r
150          * The application inits. If you need to enforce some order in\r
151          * execution, create new sections, as before.\r
152          */\r
153         KEEP(*(.preinit_array .preinit_array.*))\r
154 \r
155         PROVIDE_HIDDEN (__preinit_array_end = .);\r
156 \r
157         . = ALIGN(4);\r
158 \r
159         /*\r
160          * The init code, i.e. an array of pointers to static constructors.\r
161          */\r
162         PROVIDE_HIDDEN (__init_array_start = .);\r
163         KEEP(*(SORT(.init_array.*)))\r
164         KEEP(*(.init_array))\r
165         PROVIDE_HIDDEN (__init_array_end = .);\r
166 \r
167         . = ALIGN(4);\r
168 \r
169         /*\r
170          * The fini code, i.e. an array of pointers to static destructors.\r
171          */\r
172         PROVIDE_HIDDEN (__fini_array_start = .);\r
173         KEEP(*(SORT(.fini_array.*)))\r
174         KEEP(*(.fini_array))\r
175         PROVIDE_HIDDEN (__fini_array_end = .);\r
176         . = ALIGN(4);\r
177 \r
178         . = ALIGN(4);\r
179 \r
180         *(.text*)            /* all remaining code */\r
181 \r
182         *(vtable)                   /* C++ virtual tables */\r
183 \r
184     } >ROM\r
185 \r
186     .rodata :\r
187     {\r
188         *(.rodata*)        /* read-only data (constants) */\r
189     } >ROM\r
190 \r
191     .glue :\r
192     {\r
193         KEEP(*(.eh_frame*))\r
194 \r
195         /*\r
196         * Stub sections generated by the linker, to glue together\r
197         * ARM and Thumb code. .glue_7 is used for ARM code calling\r
198         * Thumb code, and .glue_7t is used for Thumb code calling\r
199         * ARM code. Apparently always generated by the linker, for some\r
200         * architectures, so better leave them here.\r
201         */\r
202         *(.glue_7)\r
203         *(.glue_7t)\r
204     } >ROM\r
205 \r
206     /* ARM magic sections */\r
207     .ARM.extab :\r
208     {\r
209        *(.ARM.extab* .gnu.linkonce.armextab.*)\r
210     } > ROM\r
211 \r
212     __exidx_start = .;\r
213     .ARM.exidx :\r
214     {\r
215        *(.ARM.exidx* .gnu.linkonce.armexidx.*)\r
216     } > ROM\r
217     __exidx_end = .;\r
218 \r
219     . = ALIGN(4);\r
220     _etext = .;\r
221     __etext = .;\r
222 \r
223     /*\r
224      * This address is used by the startup code to\r
225      * initialise the .data section.\r
226      */\r
227     _sidata = _etext;\r
228 \r
229     /* MEMORY_ARRAY */\r
230     /*\r
231     .ROarraySection :\r
232     {\r
233         *(.ROarraySection .ROarraySection.*)\r
234     } >MEMORY_ARRAY\r
235     */\r
236 \r
237 \r
238     privileged_data :\r
239     {\r
240         *(privileged_data)\r
241         /* Non kernel data is kept out of the first 256 bytes of SRAM. */\r
242     } > RAM\r
243 \r
244     . = ORIGIN( RAM ) + _Privileged_Data_Region_Size;\r
245 \r
246     /*\r
247      * The initialised data section.\r
248      * The program executes knowing that the data is in the RAM\r
249      * but the loader puts the initial values in the ROM (inidata).\r
250      * It is one task of the startup to copy the initial values from\r
251      * ROM to RAM.\r
252      */\r
253     .data  : AT ( _sidata )\r
254     {\r
255         . = ALIGN(4);\r
256 \r
257         /* This is used by the startup code to initialise the .data section */\r
258         _sdata = . ;            /* STM specific definition */\r
259         __data_start__ = . ;\r
260         *(.data_begin .data_begin.*)\r
261 \r
262         *(.data .data.*)\r
263 \r
264         *(.data_end .data_end.*)\r
265         . = ALIGN(4);\r
266 \r
267         /* This is used by the startup code to initialise the .data section */\r
268         _edata = . ;            /* STM specific definition */\r
269         __data_end__ = . ;\r
270 \r
271     } >RAM\r
272 \r
273 \r
274     /*\r
275      * The uninitialised data section. NOLOAD is used to avoid\r
276      * the "section `.bss' type changed to PROGBITS" warning\r
277      */\r
278     .bss (NOLOAD) :\r
279     {\r
280         . = ALIGN(4);\r
281         __bss_start__ = .;      /* standard newlib definition */\r
282         _sbss = .;              /* STM specific definition */\r
283         *(.bss_begin .bss_begin.*)\r
284 \r
285         *(.bss .bss.*)\r
286         *(COMMON)\r
287 \r
288         *(.bss_end .bss_end.*)\r
289         . = ALIGN(4);\r
290         __bss_end__ = .;        /* standard newlib definition */\r
291         _ebss = . ;             /* STM specific definition */\r
292     } >RAM\r
293 \r
294     .noinit (NOLOAD) :\r
295     {\r
296         . = ALIGN(4);\r
297         _noinit = .;\r
298 \r
299         *(.noinit .noinit.*)\r
300 \r
301          . = ALIGN(4) ;\r
302         _end_noinit = .;\r
303     } > RAM\r
304 \r
305     /* Mandatory to be word aligned, _sbrk assumes this */\r
306     PROVIDE ( end = _end_noinit ); /* was _ebss */\r
307     PROVIDE ( _end = _end_noinit );\r
308     PROVIDE ( __end = _end_noinit );\r
309     PROVIDE ( __end__ = _end_noinit );\r
310     PROVIDE ( ROM_DATA_START = __data_start__ );\r
311 \r
312     /*\r
313      * Used for validation only, do not allocate anything here!\r
314      *\r
315      * This is just to check that there is enough RAM left for the Main\r
316      * stack. It should generate an error if it's full.\r
317      */\r
318     ._check_stack :\r
319     {\r
320         . = ALIGN(4);\r
321 \r
322         . = . + _Minimum_Stack_Size ;\r
323 \r
324         . = ALIGN(4);\r
325     } >RAM\r
326 \r
327     ._check_rom_log :\r
328     {\r
329         . = ALIGN(4);\r
330 \r
331 /*        . = . + __ROM_Log_Size ; */\r
332 \r
333         . = ALIGN(4);\r
334     } >RAM\r
335 \r
336 /*\r
337     .bss_CCMRAM : ALIGN(4)\r
338     {\r
339         *(.bss.CCMRAM .bss.CCMRAM.*)\r
340     } > CCMRAM\r
341 */\r
342     /*\r
343      * The ROM Bank1.\r
344      * The C or assembly source must explicitly place the code\r
345      * or data there using the "section" attribute.\r
346      */\r
347 \r
348 \r
349     /* remaining code */\r
350     /* read-only data (constants) */\r
351 /*\r
352     .b1text :\r
353     {\r
354         *(.b1text)\r
355         *(.b1rodata)\r
356         *(.b1rodata.*)\r
357     } >ROMB1\r
358 */\r
359     /*\r
360      * The EXTMEM.\r
361      * The C or assembly source must explicitly place the code or data there\r
362      * using the "section" attribute.\r
363      */\r
364 \r
365     /* EXTMEM Bank0 */\r
366 /*\r
367     .eb0text :\r
368     {\r
369         *(.eb0text)\r
370         *(.eb0rodata)\r
371         *(.eb0rodata.*)\r
372     } >EXTMEMB0\r
373 */\r
374     /* EXTMEM Bank1 */\r
375 /*\r
376     .eb1text :\r
377     {\r
378         *(.eb1text)\r
379         *(.eb1rodata)\r
380         *(.eb1rodata.*)\r
381     } >EXTMEMB1\r
382 */\r
383     /* EXTMEM Bank2 */\r
384 /*\r
385     .eb2text :\r
386     {\r
387         *(.eb2text)\r
388         *(.eb2rodata)\r
389         *(.eb2rodata.*)\r
390     } >EXTMEMB2\r
391 */\r
392     /* EXTMEM Bank0 */\r
393 /*\r
394     .eb3text :\r
395     {\r
396         *(.eb3text)\r
397         *(.eb3rodata)\r
398         *(.eb3rodata.*)\r
399     } >EXTMEMB3\r
400 */\r
401 \r
402     /* After that there are only debugging sections. */\r
403 \r
404     /* This can remove the debugging information from the standard libraries */\r
405     /*\r
406     DISCARD :\r
407     {\r
408      libc.a ( * )\r
409      libm.a ( * )\r
410      libgcc.a ( * )\r
411      }\r
412      */\r
413 \r
414     /* Stabs debugging sections.  */\r
415     .stab          0 : { *(.stab) }\r
416     .stabstr       0 : { *(.stabstr) }\r
417     .stab.excl     0 : { *(.stab.excl) }\r
418     .stab.exclstr  0 : { *(.stab.exclstr) }\r
419     .stab.index    0 : { *(.stab.index) }\r
420     .stab.indexstr 0 : { *(.stab.indexstr) }\r
421     .comment       0 : { *(.comment) }\r
422     /*\r
423      * DWARF debug sections.\r
424      * Symbols in the DWARF debugging sections are relative to the beginning\r
425      * of the section so we begin them at 0.\r
426      */\r
427     /* DWARF 1 */\r
428     .debug          0 : { *(.debug) }\r
429     .line           0 : { *(.line) }\r
430     /* GNU DWARF 1 extensions */\r
431     .debug_srcinfo  0 : { *(.debug_srcinfo) }\r
432     .debug_sfnames  0 : { *(.debug_sfnames) }\r
433     /* DWARF 1.1 and DWARF 2 */\r
434     .debug_aranges  0 : { *(.debug_aranges) }\r
435     .debug_pubnames 0 : { *(.debug_pubnames) }\r
436     /* DWARF 2 */\r
437     .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }\r
438     .debug_abbrev   0 : { *(.debug_abbrev) }\r
439     .debug_line     0 : { *(.debug_line) }\r
440     .debug_frame    0 : { *(.debug_frame) }\r
441     .debug_str      0 : { *(.debug_str) }\r
442     .debug_loc      0 : { *(.debug_loc) }\r
443     .debug_macinfo  0 : { *(.debug_macinfo) }\r
444     /* SGI/MIPS DWARF 2 extensions */\r
445     .debug_weaknames 0 : { *(.debug_weaknames) }\r
446     .debug_funcnames 0 : { *(.debug_funcnames) }\r
447     .debug_typenames 0 : { *(.debug_typenames) }\r
448     .debug_varnames  0 : { *(.debug_varnames) }\r
449 }\r