2 * Memory Spaces Definitions.
\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
10 * The values below can be addressed in further linker scripts
\r
11 * using functions like 'ORIGIN(RAM)' or 'LENGTH(RAM)'.
\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
22 /* Variables used by FreeRTOS-MPU. */
\r
23 _Privileged_Functions_Region_Size = 32K;
\r
24 _Privileged_Data_Region_Size = 512;
\r
26 __FLASH_segment_start__ = ORIGIN( ROM );
\r
27 __FLASH_segment_end__ = __FLASH_segment_start__ + LENGTH( ROM );
\r
29 __privileged_functions_start__ = ORIGIN( ROM );
\r
30 __privileged_functions_end__ = __privileged_functions_start__ + _Privileged_Functions_Region_Size;
\r
32 __SRAM_segment_start__ = ORIGIN( RAM );
\r
33 __SRAM_segment_end__ = __SRAM_segment_start__ + LENGTH( RAM );
\r
35 __privileged_data_start__ = ORIGIN( RAM );
\r
36 __privileged_data_end__ = ORIGIN( RAM ) + _Privileged_Data_Region_Size;
\r
40 * The '__stack' definition is required by crt0, do not remove it.
\r
42 __stack = ORIGIN(RAM) + LENGTH(RAM);
\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
51 __Main_Stack_Size = 2048 ;
\r
53 PROVIDE ( _Main_Stack_Size = __Main_Stack_Size ) ;
\r
55 __Main_Stack_Limit = __stack - __Main_Stack_Size ;
\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
61 * There will be a link error if there is not this amount of
\r
62 * RAM free at the end.
\r
64 _Minimum_Stack_Size = 1024 ;
\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
71 PROVIDE ( _Heap_Begin = _end_noinit ) ;
\r
72 PROVIDE ( _Heap_Limit = __stack - __Main_Stack_Size ) ;
\r
75 * The entry point is informative, for debuggers and simulators,
\r
76 * since the Cortex-M vector points to it anyway.
\r
80 /* Sections Definitions */
\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
92 KEEP(*(.isr_vector))
\r
95 privileged_functions :
\r
98 *(privileged_functions)
\r
100 /* Non privileged code is after _Privileged_Functions_Region_Size. */
\r
101 __privileged_functions_actual_end__ = .;
\r
102 . = _Privileged_Functions_Region_Size;
\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
116 KEEP(*(.after_vectors .after_vectors.*)) /* Startup code and ISR */
\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
132 * The preinit code, i.e. an array of pointers to initialisation
\r
133 * functions to be performed before constructors.
\r
135 PROVIDE_HIDDEN (__preinit_array_start = .);
\r
138 * Used to run the SystemInit() before anything else.
\r
140 KEEP(*(.preinit_array_sysinit .preinit_array_sysinit.*))
\r
143 * Used for other platform inits.
\r
145 KEEP(*(.preinit_array_platform .preinit_array_platform.*))
\r
148 * The application inits. If you need to enforce some order in
\r
149 * execution, create new sections, as before.
\r
151 KEEP(*(.preinit_array .preinit_array.*))
\r
153 PROVIDE_HIDDEN (__preinit_array_end = .);
\r
158 * The init code, i.e. an array of pointers to static constructors.
\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
168 * The fini code, i.e. an array of pointers to static destructors.
\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
178 *(.text*) /* all remaining code */
\r
180 *(vtable) /* C++ virtual tables */
\r
186 *(.rodata*) /* read-only data (constants) */
\r
191 KEEP(*(.eh_frame*))
\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
204 /* ARM magic sections */
\r
207 *(.ARM.extab* .gnu.linkonce.armextab.*)
\r
213 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
\r
222 * This address is used by the startup code to
\r
223 * initialise the .data section.
\r
231 *(.ROarraySection .ROarraySection.*)
\r
239 /* Non kernel data is kept out of the first _Privileged_Data_Region_Size
\r
241 __privileged_data_actual_end__ = .;
\r
242 . = _Privileged_Data_Region_Size;
\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
252 .data : AT ( _sidata )
\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
263 *(.data_end .data_end.*)
\r
266 /* This is used by the startup code to initialise the .data section */
\r
267 _edata = . ; /* STM specific definition */
\r
274 * The uninitialised data section. NOLOAD is used to avoid
\r
275 * the "section `.bss' type changed to PROGBITS" warning
\r
280 __bss_start__ = .; /* standard newlib definition */
\r
281 _sbss = .; /* STM specific definition */
\r
282 *(.bss_begin .bss_begin.*)
\r
287 *(.bss_end .bss_end.*)
\r
289 __bss_end__ = .; /* standard newlib definition */
\r
290 _ebss = . ; /* STM specific definition */
\r
298 *(.noinit .noinit.*)
\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
312 * Used for validation only, do not allocate anything here!
\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
321 . = . + _Minimum_Stack_Size ;
\r
326 /* After that there are only debugging sections. */
\r
328 /* This can remove the debugging information from the standard libraries */
\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
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
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
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