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