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 >AXIM_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 >AXIM_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 >AXIM_FLASH1
71 *(.ARM.extab* .gnu.linkonce.armextab.*)
77 *(.ARM.exidx*) __exidx_end = .;
78 } >FLASH AT >AXIM_FLASH
82 PROVIDE_HIDDEN (__pg_registry_start = .);
83 KEEP (*(.pg_registry))
84 KEEP (*(SORT(.pg_registry.*)))
85 PROVIDE_HIDDEN (__pg_registry_end = .);
86 } >FLASH AT >AXIM_FLASH
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 = .;
105 } >FLASH_CUSTOM_DEFAULTS
107 PROVIDE_HIDDEN (__custom_defaults_start = DEFINED(USE_CUSTOM_DEFAULTS_EXTENDED) ? ORIGIN(FLASH_CUSTOM_DEFAULTS_EXTENDED) : __custom_defaults_internal_start);
108 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));
110 /* used by the startup to initialize data */
111 _sidata = LOADADDR(.data);
113 /* Initialized data sections goes into RAM, load LMA copy after code */
117 _sdata = .; /* create a global symbol at data start */
118 *(.data) /* .data sections */
119 *(.data*) /* .data* sections */
122 _edata = .; /* define a global symbol at data end */
123 } >RAM AT >AXIM_FLASH1
125 /* Uninitialized data section */
129 /* This is used by the startup in order to initialize the .bss secion */
130 _sbss = .; /* define a global symbol at bss start */
131 __bss_start__ = _sbss;
133 *(SORT_BY_ALIGNMENT(.bss*))
137 _ebss = .; /* define a global symbol at bss end */
141 /* Uninitialized data section */
145 /* This is used by the startup in order to initialize the .sram2 secion */
146 _ssram2 = .; /* define a global symbol at sram2 start */
147 __sram2_start__ = _ssram2;
149 *(SORT_BY_ALIGNMENT(.sram2*))
152 _esram2 = .; /* define a global symbol at sram2 end */
153 __sram2_end__ = _esram2;
156 /* used during startup to initialized fastram_data */
157 _sfastram_idata = LOADADDR(.fastram_data);
159 /* Initialized FAST_DATA section for unsuspecting developers */
163 _sfastram_data = .; /* create a global symbol at data start */
164 *(.fastram_data) /* .data sections */
165 *(.fastram_data*) /* .data* sections */
168 _efastram_data = .; /* define a global symbol at data end */
169 } >FASTRAM AT >AXIM_FLASH1
172 .fastram_bss (NOLOAD) :
175 __fastram_bss_start__ = _sfastram_bss;
177 *(SORT_BY_ALIGNMENT(.fastram_bss*))
181 __fastram_bss_end__ = _efastram_bss;
184 /* User_heap_stack section, used to check that there is enough RAM left */
185 _heap_stack_end = ORIGIN(STACKRAM)+LENGTH(STACKRAM) - 8; /* 8 bytes to allow for alignment */
186 _heap_stack_begin = _heap_stack_end - _Min_Stack_Size - _Min_Heap_Size;
187 . = _heap_stack_begin;
192 PROVIDE ( _end = . );
193 . = . + _Min_Heap_Size;
194 . = . + _Min_Stack_Size;
198 /* MEMORY_bank1 section, code must be located here explicitly */
199 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
202 *(.mb1text) /* .mb1text sections (code) */
203 *(.mb1text*) /* .mb1text* sections (code) */
204 *(.mb1rodata) /* read-only data (constants) */
208 /* Remove information from the standard libraries */
216 .ARM.attributes 0 : { *(.ARM.attributes) }