]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/sections.ld
Increase the test coverage of the GCC MPU demo that runs in the Keil simulator.
[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 used by FreeRTOS-MPU. */\r
9 _Privileged_Functions_Region_Size = 32K;\r
10 _Privileged_Data_Region_Size = 512;\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 \r
25 /*\r
26  * The '__stack' definition is required by crt0, do not remove it.\r
27  */\r
28 __stack = ORIGIN(RAM) + LENGTH(RAM);\r
29 _estack = __stack;\r
30 \r
31 /*\r
32  * Default stack sizes.\r
33  * These are used by the startup in order to allocate stacks\r
34  * for the different modes.\r
35  */\r
36 \r
37 __Main_Stack_Size = 2048 ;\r
38 \r
39 PROVIDE ( _Main_Stack_Size = __Main_Stack_Size ) ;\r
40 \r
41 __Main_Stack_Limit = __stack  - __Main_Stack_Size ;\r
42 \r
43 /*"PROVIDE" allows to easily override these values from an object file or the command line. */\r
44 PROVIDE ( _Main_Stack_Limit = __Main_Stack_Limit ) ;\r
45 \r
46 /*\r
47  * There will be a link error if there is not this amount of\r
48  * RAM free at the end.\r
49  */\r
50 _Minimum_Stack_Size = 1024 ;\r
51 \r
52 /*\r
53  * Default heap definitions.\r
54  * The heap start immediately after the last statically allocated\r
55  * .sbss/.noinit section, and extends up to the main stack limit.\r
56  */\r
57 PROVIDE ( _Heap_Begin = _end_noinit ) ;\r
58 PROVIDE ( _Heap_Limit = __stack - __Main_Stack_Size ) ;\r
59 \r
60 /*\r
61  * The entry point is informative, for debuggers and simulators,\r
62  * since the Cortex-M vector points to it anyway.\r
63  */\r
64 ENTRY(_start)\r
65 \r
66 /* Sections Definitions */\r
67 \r
68 SECTIONS\r
69 {\r
70     /*\r
71      * For Cortex-M devices, the beginning of the startup code is stored in\r
72      * the .isr_vector section, which goes to ROM\r
73      */\r
74     privileged_functions :\r
75     {\r
76         . = ALIGN(4);\r
77         _isr_vector = .;\r
78         KEEP(*(.isr_vector))\r
79         *(privileged_functions)\r
80         . = ALIGN(4);\r
81 \r
82         /* Non privileged code is after _Privileged_Functions_Region_Size. */\r
83         __privileged_functions_actual_end__ = .;\r
84         . = _Privileged_Functions_Region_Size;\r
85     } > ROM\r
86 \r
87 \r
88 \r
89     .text :\r
90     {\r
91         . = ALIGN(4);\r
92 \r
93 \r
94         /*\r
95          * This section is here for convenience, to store the\r
96          * startup code at the beginning of the flash area, hoping that\r
97          * this will increase the readability of the listing.\r
98          */\r
99         KEEP(*(.after_vectors .after_vectors.*))    /* Startup code and ISR */\r
100 \r
101         . = ALIGN(4);\r
102 \r
103         /*\r
104          * These are the old initialisation sections, intended to contain\r
105          * naked code, with the prologue/epilogue added by crti.o/crtn.o\r
106          * when linking with startup files. The standalone startup code\r
107          * currently does not run these, better use the init arrays below.\r
108          */\r
109         KEEP(*(.init))\r
110         KEEP(*(.fini))\r
111 \r
112         . = ALIGN(4);\r
113 \r
114         /*\r
115          * The preinit code, i.e. an array of pointers to initialisation\r
116          * functions to be performed before constructors.\r
117          */\r
118         PROVIDE_HIDDEN (__preinit_array_start = .);\r
119 \r
120         /*\r
121          * Used to run the SystemInit() before anything else.\r
122          */\r
123         KEEP(*(.preinit_array_sysinit .preinit_array_sysinit.*))\r
124 \r
125         /*\r
126          * Used for other platform inits.\r
127          */\r
128         KEEP(*(.preinit_array_platform .preinit_array_platform.*))\r
129 \r
130         /*\r
131          * The application inits. If you need to enforce some order in\r
132          * execution, create new sections, as before.\r
133          */\r
134         KEEP(*(.preinit_array .preinit_array.*))\r
135 \r
136         PROVIDE_HIDDEN (__preinit_array_end = .);\r
137 \r
138         . = ALIGN(4);\r
139 \r
140         /*\r
141          * The init code, i.e. an array of pointers to static constructors.\r
142          */\r
143         PROVIDE_HIDDEN (__init_array_start = .);\r
144         KEEP(*(SORT(.init_array.*)))\r
145         KEEP(*(.init_array))\r
146         PROVIDE_HIDDEN (__init_array_end = .);\r
147 \r
148         . = ALIGN(4);\r
149 \r
150         /*\r
151          * The fini code, i.e. an array of pointers to static destructors.\r
152          */\r
153         PROVIDE_HIDDEN (__fini_array_start = .);\r
154         KEEP(*(SORT(.fini_array.*)))\r
155         KEEP(*(.fini_array))\r
156         PROVIDE_HIDDEN (__fini_array_end = .);\r
157         . = ALIGN(4);\r
158 \r
159         . = ALIGN(4);\r
160 \r
161         *(.text*)            /* all remaining code */\r
162 \r
163         *(vtable)                   /* C++ virtual tables */\r
164 \r
165     } >ROM\r
166 \r
167     .rodata :\r
168     {\r
169         *(.rodata*)        /* read-only data (constants) */\r
170     } >ROM\r
171 \r
172     .glue :\r
173     {\r
174         KEEP(*(.eh_frame*))\r
175 \r
176         /*\r
177         * Stub sections generated by the linker, to glue together\r
178         * ARM and Thumb code. .glue_7 is used for ARM code calling\r
179         * Thumb code, and .glue_7t is used for Thumb code calling\r
180         * ARM code. Apparently always generated by the linker, for some\r
181         * architectures, so better leave them here.\r
182         */\r
183         *(.glue_7)\r
184         *(.glue_7t)\r
185     } >ROM\r
186 \r
187     /* ARM magic sections */\r
188     .ARM.extab :\r
189     {\r
190        *(.ARM.extab* .gnu.linkonce.armextab.*)\r
191     } > ROM\r
192 \r
193     __exidx_start = .;\r
194     .ARM.exidx :\r
195     {\r
196        *(.ARM.exidx* .gnu.linkonce.armexidx.*)\r
197     } > ROM\r
198     __exidx_end = .;\r
199 \r
200     . = ALIGN(4);\r
201     _etext = .;\r
202     __etext = .;\r
203 \r
204     /*\r
205      * This address is used by the startup code to\r
206      * initialise the .data section.\r
207      */\r
208     _sidata = _etext;\r
209 \r
210     /* MEMORY_ARRAY */\r
211     /*\r
212     .ROarraySection :\r
213     {\r
214         *(.ROarraySection .ROarraySection.*)\r
215     } >MEMORY_ARRAY\r
216     */\r
217 \r
218 \r
219     privileged_data :\r
220     {\r
221         *(privileged_data)\r
222         /* Non kernel data is kept out of the first _Privileged_Data_Region_Size\r
223         bytes of SRAM. */\r
224         __privileged_data_actual_end__ = .;\r
225         . = _Privileged_Data_Region_Size;\r
226     } > RAM\r
227 \r
228     /*\r
229      * The initialised data section.\r
230      * The program executes knowing that the data is in the RAM\r
231      * but the loader puts the initial values in the ROM (inidata).\r
232      * It is one task of the startup to copy the initial values from\r
233      * ROM to RAM.\r
234      */\r
235     .data  : AT ( _sidata )\r
236     {\r
237         . = ALIGN(4);\r
238 \r
239         /* This is used by the startup code to initialise the .data section */\r
240         _sdata = . ;            /* STM specific definition */\r
241         __data_start__ = . ;\r
242         *(.data_begin .data_begin.*)\r
243 \r
244         *(.data .data.*)\r
245 \r
246         *(.data_end .data_end.*)\r
247         . = ALIGN(4);\r
248 \r
249         /* This is used by the startup code to initialise the .data section */\r
250         _edata = . ;            /* STM specific definition */\r
251         __data_end__ = . ;\r
252 \r
253     } >RAM\r
254 \r
255 \r
256     /*\r
257      * The uninitialised data section. NOLOAD is used to avoid\r
258      * the "section `.bss' type changed to PROGBITS" warning\r
259      */\r
260     .bss (NOLOAD) :\r
261     {\r
262         . = ALIGN(4);\r
263         __bss_start__ = .;      /* standard newlib definition */\r
264         _sbss = .;              /* STM specific definition */\r
265         *(.bss_begin .bss_begin.*)\r
266 \r
267         *(.bss .bss.*)\r
268         *(COMMON)\r
269 \r
270         *(.bss_end .bss_end.*)\r
271         . = ALIGN(4);\r
272         __bss_end__ = .;        /* standard newlib definition */\r
273         _ebss = . ;             /* STM specific definition */\r
274     } >RAM\r
275 \r
276     .noinit (NOLOAD) :\r
277     {\r
278         . = ALIGN(4);\r
279         _noinit = .;\r
280 \r
281         *(.noinit .noinit.*)\r
282 \r
283          . = ALIGN(4) ;\r
284         _end_noinit = .;\r
285     } > RAM\r
286 \r
287     /* Mandatory to be word aligned, _sbrk assumes this */\r
288     PROVIDE ( end = _end_noinit ); /* was _ebss */\r
289     PROVIDE ( _end = _end_noinit );\r
290     PROVIDE ( __end = _end_noinit );\r
291     PROVIDE ( __end__ = _end_noinit );\r
292     PROVIDE ( ROM_DATA_START = __data_start__ );\r
293 \r
294     /*\r
295      * Used for validation only, do not allocate anything here!\r
296      *\r
297      * This is just to check that there is enough RAM left for the Main\r
298      * stack. It should generate an error if it's full.\r
299      */\r
300     ._check_stack :\r
301     {\r
302         . = ALIGN(4);\r
303 \r
304         . = . + _Minimum_Stack_Size ;\r
305 \r
306         . = ALIGN(4);\r
307     } >RAM\r
308 \r
309     /* After that there are only debugging sections. */\r
310 \r
311     /* This can remove the debugging information from the standard libraries */\r
312     /*\r
313     DISCARD :\r
314     {\r
315      libc.a ( * )\r
316      libm.a ( * )\r
317      libgcc.a ( * )\r
318      }\r
319      */\r
320 \r
321     /* Stabs debugging sections.  */\r
322     .stab          0 : { *(.stab) }\r
323     .stabstr       0 : { *(.stabstr) }\r
324     .stab.excl     0 : { *(.stab.excl) }\r
325     .stab.exclstr  0 : { *(.stab.exclstr) }\r
326     .stab.index    0 : { *(.stab.index) }\r
327     .stab.indexstr 0 : { *(.stab.indexstr) }\r
328     .comment       0 : { *(.comment) }\r
329     /*\r
330      * DWARF debug sections.\r
331      * Symbols in the DWARF debugging sections are relative to the beginning\r
332      * of the section so we begin them at 0.\r
333      */\r
334     /* DWARF 1 */\r
335     .debug          0 : { *(.debug) }\r
336     .line           0 : { *(.line) }\r
337     /* GNU DWARF 1 extensions */\r
338     .debug_srcinfo  0 : { *(.debug_srcinfo) }\r
339     .debug_sfnames  0 : { *(.debug_sfnames) }\r
340     /* DWARF 1.1 and DWARF 2 */\r
341     .debug_aranges  0 : { *(.debug_aranges) }\r
342     .debug_pubnames 0 : { *(.debug_pubnames) }\r
343     /* DWARF 2 */\r
344     .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }\r
345     .debug_abbrev   0 : { *(.debug_abbrev) }\r
346     .debug_line     0 : { *(.debug_line) }\r
347     .debug_frame    0 : { *(.debug_frame) }\r
348     .debug_str      0 : { *(.debug_str) }\r
349     .debug_loc      0 : { *(.debug_loc) }\r
350     .debug_macinfo  0 : { *(.debug_macinfo) }\r
351     /* SGI/MIPS DWARF 2 extensions */\r
352     .debug_weaknames 0 : { *(.debug_weaknames) }\r
353     .debug_funcnames 0 : { *(.debug_funcnames) }\r
354     .debug_typenames 0 : { *(.debug_typenames) }\r
355     .debug_varnames  0 : { *(.debug_varnames) }\r
356 }\r