2 *****************************************************************************
4 ** File : stm32_flash_f7_split.ld
6 ** Abstract : Common linker script for STM32 devices.
8 *****************************************************************************
14 /* Highest address of the user mode stack */
15 _estack = ORIGIN(STACKRAM) + LENGTH(STACKRAM); /* end of RAM */
17 /* Base address where the config is stored. */
18 __config_start = ORIGIN(FLASH_CONFIG);
19 __config_end = ORIGIN(FLASH_CONFIG) + LENGTH(FLASH_CONFIG);
21 /* Generate a link error if heap and stack don't fit into RAM */
22 _Min_Heap_Size = 0; /* required amount of heap */
23 _Min_Stack_Size = 0x800; /* required amount of stack */
25 /* Define output sections */
28 /* The startup code goes first into FLASH */
32 PROVIDE (isr_vector_table_base = .);
33 KEEP(*(.isr_vector)) /* Startup code */
35 } >FLASH AT >WRITABLE_FLASH
37 /* The program code and other data goes into FLASH */
41 *(.text) /* .text sections (code) */
42 *(.text*) /* .text* sections (code) */
43 *(.rodata) /* .rodata sections (constants, strings, etc.) */
44 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
45 *(.glue_7) /* glue arm to thumb code */
46 *(.glue_7t) /* glue thumb to arm code */
53 _etext = .; /* define a global symbols at end of code */
54 } >FLASH1 AT >WRITABLE_FLASH1
56 /* Critical program code goes into ITCM RAM */
57 /* Copy specific fast-executing code to ITCM RAM */
58 tcm_code = LOADADDR(.tcm_code);
67 } >ITCM_RAM AT >WRITABLE_FLASH1
71 *(.ARM.extab* .gnu.linkonce.armextab.*)
77 *(.ARM.exidx*) __exidx_end = .;
82 PROVIDE_HIDDEN (__pg_registry_start = .);
83 KEEP (*(.pg_registry))
84 KEEP (*(SORT(.pg_registry.*)))
85 PROVIDE_HIDDEN (__pg_registry_end = .);
90 PROVIDE_HIDDEN (__pg_resetdata_start = .);
91 KEEP (*(.pg_resetdata))
92 PROVIDE_HIDDEN (__pg_resetdata_end = .);
95 /* Storage for the address for the configuration section so we can grab it out of the hex file */
99 KEEP (*(.custom_defaults_start_address))
101 KEEP (*(.custom_defaults_end_address))
103 __custom_defaults_internal_start = .;
104 KEEP (*(.custom_defaults))
106 } >FLASH_CUSTOM_DEFAULTS
108 PROVIDE_HIDDEN (__custom_defaults_start = DEFINED(USE_CUSTOM_DEFAULTS_EXTENDED) ? ORIGIN(FLASH_CUSTOM_DEFAULTS_EXTENDED) : __custom_defaults_internal_start);
109 PROVIDE_HIDDEN (__custom_defaults_end = DEFINED(USE_CUSTOM_DEFAULTS_EXTENDED) ? ORIGIN(FLASH_CUSTOM_DEFAULTS_EXTENDED) + LENGTH(FLASH_CUSTOM_DEFAULTS_EXTENDED) : ORIGIN(FLASH_CUSTOM_DEFAULTS) + LENGTH(FLASH_CUSTOM_DEFAULTS));
111 /* used by the startup to initialize data */
112 _sidata = LOADADDR(.data);
114 /* Initialized data sections goes into RAM, load LMA copy after code */
118 _sdata = .; /* create a global symbol at data start */
119 *(.data) /* .data sections */
120 *(.data*) /* .data* sections */
123 _edata = .; /* define a global symbol at data end */
124 } >RAM AT >WRITABLE_FLASH1
126 /* Uninitialized data section */
130 /* This is used by the startup in order to initialize the .bss secion */
131 _sbss = .; /* define a global symbol at bss start */
132 __bss_start__ = _sbss;
134 *(SORT_BY_ALIGNMENT(.bss*))
138 _ebss = .; /* define a global symbol at bss end */
142 /* Uninitialized data section */
146 /* This is used by the startup in order to initialize the .sram2 secion */
147 _ssram2 = .; /* define a global symbol at sram2 start */
148 __sram2_start__ = _ssram2;
150 *(SORT_BY_ALIGNMENT(.sram2*))
153 _esram2 = .; /* define a global symbol at sram2 end */
154 __sram2_end__ = _esram2;
157 /* used during startup to initialized fastram_data */
158 _sfastram_idata = LOADADDR(.fastram_data);
160 /* Initialized FAST_DATA section for unsuspecting developers */
164 _sfastram_data = .; /* create a global symbol at data start */
165 *(.fastram_data) /* .data sections */
166 *(.fastram_data*) /* .data* sections */
169 _efastram_data = .; /* define a global symbol at data end */
170 } >FASTRAM AT >WRITABLE_FLASH1
173 .fastram_bss (NOLOAD) :
176 __fastram_bss_start__ = _sfastram_bss;
178 *(SORT_BY_ALIGNMENT(.fastram_bss*))
182 __fastram_bss_end__ = _efastram_bss;
185 /* User_heap_stack section, used to check that there is enough RAM left */
186 _heap_stack_end = ORIGIN(STACKRAM)+LENGTH(STACKRAM) - 8; /* 8 bytes to allow for alignment */
187 _heap_stack_begin = _heap_stack_end - _Min_Stack_Size - _Min_Heap_Size;
188 . = _heap_stack_begin;
193 PROVIDE ( _end = . );
194 . = . + _Min_Heap_Size;
195 . = . + _Min_Stack_Size;
199 /* MEMORY_bank1 section, code must be located here explicitly */
200 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
203 *(.mb1text) /* .mb1text sections (code) */
204 *(.mb1text*) /* .mb1text* sections (code) */
205 *(.mb1rodata) /* read-only data (constants) */
209 /* Remove information from the standard libraries */
217 .ARM.attributes 0 : { *(.ARM.attributes) }