2 *****************************************************************************
4 ** File : stm32_flash_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 /* Define output sections */
24 /* The startup code goes first into FLASH */
28 PROVIDE (isr_vector_table_base = .);
29 KEEP(*(.isr_vector)) /* Startup code */
33 /* The program code and other data goes into FLASH */
37 *(.text) /* .text sections (code) */
38 *(.text*) /* .text* sections (code) */
39 *(.rodata) /* .rodata sections (constants, strings, etc.) */
40 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
41 *(.glue_7) /* glue arm to thumb code */
42 *(.glue_7t) /* glue thumb to arm code */
49 _etext = .; /* define a global symbols at end of code */
52 tcm_code = LOADADDR(.tcm_code);
61 } >ITCM_RAM AT >FLASH1
63 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
72 PROVIDE_HIDDEN (__busdev_registry_start = .);
73 KEEP (*(.busdev_registry))
74 KEEP (*(SORT(.busdev_registry.*)))
75 PROVIDE_HIDDEN (__busdev_registry_end = .);
80 PROVIDE_HIDDEN (__preinit_array_start = .);
81 KEEP (*(.preinit_array*))
82 PROVIDE_HIDDEN (__preinit_array_end = .);
86 PROVIDE_HIDDEN (__init_array_start = .);
87 KEEP (*(SORT(.init_array.*)))
88 KEEP (*(.init_array*))
89 PROVIDE_HIDDEN (__init_array_end = .);
93 PROVIDE_HIDDEN (__fini_array_start = .);
94 KEEP (*(.fini_array*))
95 KEEP (*(SORT(.fini_array.*)))
96 PROVIDE_HIDDEN (__fini_array_end = .);
100 PROVIDE_HIDDEN (__pg_registry_start = .);
101 KEEP (*(.pg_registry))
102 KEEP (*(SORT(.pg_registry.*)))
103 PROVIDE_HIDDEN (__pg_registry_end = .);
107 PROVIDE_HIDDEN (__pg_resetdata_start = .);
108 KEEP (*(.pg_resetdata))
109 PROVIDE_HIDDEN (__pg_resetdata_end = .);
112 /* used by the startup to initialize data */
115 /* Initialized data sections goes into RAM, load LMA copy after code */
119 _sdata = .; /* create a global symbol at data start */
120 *(.data) /* .data sections */
121 *(.data*) /* .data* sections */
124 _edata = .; /* define a global symbol at data end */
127 /* Uninitialized data section */
131 /* This is used by the startup in order to initialize the .bss secion */
132 _sbss = .; /* define a global symbol at bss start */
133 __bss_start__ = _sbss;
135 *(SORT_BY_ALIGNMENT(.bss*))
139 _ebss = .; /* define a global symbol at bss end */
143 .fastram_bss (NOLOAD) :
145 __fastram_bss_start__ = .;
147 *(SORT_BY_ALIGNMENT(.fastram_bss*))
149 __fastram_bss_end__ = .;
155 PROVIDE(dmaram_start = .);
157 _dmaram_start__ = _sdmaram;
159 PROVIDE(dmaram_end = .);
161 _dmaram_end__ = _edmaram;
164 .DMA_RW_D2 (NOLOAD) :
167 PROVIDE(dmarw_start = .);
169 _dmarw_start__ = _sdmarw;
171 PROVIDE(dmarw_end = .);
173 _dmarw_end__ = _edmarw;
176 .DMA_RW_AXI (NOLOAD) :
179 PROVIDE(dmarwaxi_start = .);
181 _dmarwaxi_start__ = _sdmarwaxi;
183 PROVIDE(dmarwaxi_end = .);
185 _dmarwaxi_end__ = _edmarwaxi;
188 /* User_heap_stack section, used to check that there is enough RAM left */
189 _heap_stack_end = ORIGIN(STACKRAM)+LENGTH(STACKRAM) - 8; /* 8 bytes to allow for alignment */
190 _heap_stack_begin = _heap_stack_end - _Min_Stack_Size - _Min_Heap_Size;
191 . = _heap_stack_begin;
196 PROVIDE ( _end = . );
197 . = . + _Min_Heap_Size;
198 . = . + _Min_Stack_Size;
202 /* MEMORY_bank1 section, code must be located here explicitly */
203 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
206 *(.mb1text) /* .mb1text sections (code) */
207 *(.mb1text*) /* .mb1text* sections (code) */
208 *(.mb1rodata) /* read-only data (constants) */
212 /* Remove information from the standard libraries */
220 .ARM.attributes 0 : { *(.ARM.attributes) }