2 *****************************************************************************
4 ** File : stm32f4_flash.ld
6 ** Abstract : Linker script for STM32F439 Device with
7 ** 2MByte FLASH, 192KByte SRAM, 64KByte CCM
9 ** Set heap size, stack size and stack location according
10 ** to application requirements.
12 ** Set memory bank area and size if external memory is used.
14 ** Target : STMicroelectronics STM32
16 *****************************************************************************
22 /* Highest address of the user mode stack */
23 _estack = 0x20030000; /* end of 192K RAM */
24 _heap_end = 0xD0800000; /* end of 8192K SDRAM */
26 /* Generate a link error if heap and stack don't fit into RAM */
27 _Min_Heap_Size = 0; /* required amount of heap */
28 _Main_Stack_Size = 1024; /* required amount of stack for interrupt stack (Main stack) */
31 _main_stack_start = _estack - _Main_Stack_Size;
33 /* Specify the memory areas */
36 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
37 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
38 CCM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
39 MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
40 SDRAM(xrw) : ORIGIN = 0xD0000000, LENGTH = 8192K
43 /* Define output sections */
46 /* The startup code goes first into FLASH */
48 /* The program code and other data goes into FLASH */
52 KEEP(*(.isr_vector)) /* Startup code */
54 KEEP(*(.bootversiondata))
55 . = ALIGN(4); /* Align the start of the text part */
56 *(.text) /* .text sections (code) */
57 *(.text*) /* .text* sections (code) */
58 *(.rodata) /* .rodata sections (constants, strings, etc.) */
59 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
60 *(.glue_7) /* glue arm to thumb code */
61 *(.glue_7t) /* glue thumb to arm code */
68 _etext = .; /* define a global symbols at end of code */
72 { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
81 PROVIDE_HIDDEN (__preinit_array_start = .);
82 KEEP (*(.preinit_array*))
83 PROVIDE_HIDDEN (__preinit_array_end = .);
88 PROVIDE_HIDDEN (__init_array_start = .);
89 KEEP (*(SORT(.init_array.*)))
90 KEEP (*(.init_array*))
91 PROVIDE_HIDDEN (__init_array_end = .);
96 PROVIDE_HIDDEN (__fini_array_start = .);
97 KEEP (*(.fini_array*))
98 KEEP (*(SORT(.fini_array.*)))
99 PROVIDE_HIDDEN (__fini_array_end = .);
102 /* used by the startup to initialize data */
105 /* Initialized data sections goes into RAM, load LMA copy after code */
106 .data : AT ( _sidata )
109 _sdata = .; /* create a global symbol at data start */
110 *(.data) /* .data sections */
111 *(.data*) /* .data* sections */
113 _edata = .; /* define a global symbol at data end */
116 /* Uninitialized data section */
120 /* This is used by the startup in order to initialize the .bss secion */
121 _sbss = .; /* define a global symbol at bss start */
122 /* __bss_start__ = _sbss; */
127 _ebss = .; /* define a global symbol at bss end */
130 /* Non-zeroed data section */
137 /* collect all uninitialized .ccm sections */
145 /* User_heap_stack section, used to check that there is enough RAM left */
149 . = . + _Min_Heap_Size;
150 . = . + _Main_Stack_Size;
154 /* MEMORY_bank1 section, code must be located here explicitly */
155 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
158 *(.mb1text) /* .mb1text sections (code) */
159 *(.mb1text*) /* .mb1text* sections (code) */
160 *(.mb1rodata) /* read-only data (constants) */
174 PROVIDE ( end = _eram );
175 PROVIDE ( _end = _eram );
177 /* Remove information from the standard libraries */
185 .ARM.attributes 0 : { *(.ARM.attributes) }