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 = 0x10010000; /* end of 64K CCM */
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 */
55 KEEP(*(.bootloader)) /* Bootloader code */
57 . = 0x20000; /* Set the start of the main program */
58 _stext = .; /* Provide the name for the start of this section */
60 KEEP(*(.isr_vector)) /* Startup code */
61 KEEP(*(.fwversiondata))
62 *(.text) /* .text sections (code) */
63 *(.text*) /* .text* sections (code) */
64 *(.rodata) /* .rodata sections (constants, strings, etc.) */
65 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
66 *(.glue_7) /* glue arm to thumb code */
67 *(.glue_7t) /* glue thumb to arm code */
74 _etext = .; /* define a global symbols at end of code */
78 { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
87 PROVIDE_HIDDEN (__preinit_array_start = .);
88 KEEP (*(.preinit_array*))
89 PROVIDE_HIDDEN (__preinit_array_end = .);
94 PROVIDE_HIDDEN (__init_array_start = .);
95 KEEP (*(SORT(.init_array.*)))
96 KEEP (*(.init_array*))
97 PROVIDE_HIDDEN (__init_array_end = .);
102 PROVIDE_HIDDEN (__fini_array_start = .);
103 KEEP (*(.fini_array*))
104 KEEP (*(SORT(.fini_array.*)))
105 PROVIDE_HIDDEN (__fini_array_end = .);
108 /* used by the startup to initialize data */
111 /* Initialized data sections goes into RAM, load LMA copy after code */
112 .data : AT ( _sidata )
115 _sdata = .; /* create a global symbol at data start */
116 *(.data) /* .data sections */
117 *(.data*) /* .data* sections */
119 _edata = .; /* define a global symbol at data end */
122 /* Uninitialized data section */
126 /* This is used by the startup in order to initialize the .bss secion */
127 _sbss = .; /* define a global symbol at bss start */
128 /* __bss_start__ = _sbss; */
133 _ebss = .; /* define a global symbol at bss end */
136 /* Non-zeroed data section */
143 /* collect all uninitialized .ccm sections */
151 /* User_heap_stack section, used to check that there is enough RAM left */
155 . = . + _Min_Heap_Size;
156 . = . + _Main_Stack_Size;
160 /* MEMORY_bank1 section, code must be located here explicitly */
161 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
164 *(.mb1text) /* .mb1text sections (code) */
165 *(.mb1text*) /* .mb1text* sections (code) */
166 *(.mb1rodata) /* read-only data (constants) */
180 PROVIDE ( end = _eram );
181 PROVIDE ( _end = _eram );
183 /* Remove information from the standard libraries */
191 .ARM.attributes 0 : { *(.ARM.attributes) }