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