2 *****************************************************************************
4 ** File : stm32f2_flash.ld
6 ** Abstract : Linker script for STM32F205 Device with
7 ** 0.5MByte FLASH, 128KByte SRAM
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 = 0x20020000; /* end of 128K SRAM */
25 /* Generate a link error if heap and stack don't fit into RAM */
26 _Min_Heap_Size = 0; /* required amount of heap */
27 _Main_Stack_Size = 1024; /* required amount of stack for interrupt stack (Main stack) */
30 _main_stack_start = _estack - _Main_Stack_Size;
31 _heap_end = _main_stack_start;
33 /* Specify the memory areas */
36 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
37 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
38 MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
41 /* Define output sections */
44 /* The startup code goes first into FLASH */
46 /* The program code and other data goes into FLASH */
53 KEEP(*(.bootloader)) /* Bootloader code */
55 . = 32768; /* Set the start of the main program */
56 _stext = .; /* Provide the name for the start of this section */
58 KEEP(*(.isr_vector)) /* Startup code */
59 KEEP(*(.fwversiondata))
60 *(.text) /* .text sections (code) */
61 *(.text*) /* .text* sections (code) */
62 *(.rodata) /* .rodata sections (constants, strings, etc.) */
63 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
64 *(.glue_7) /* glue arm to thumb code */
65 *(.glue_7t) /* glue thumb to arm code */
72 _etext = .; /* define a global symbols at end of code */
76 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
85 PROVIDE_HIDDEN (__preinit_array_start = .);
86 KEEP (*(.preinit_array*))
87 PROVIDE_HIDDEN (__preinit_array_end = .);
91 PROVIDE_HIDDEN (__init_array_start = .);
92 KEEP (*(SORT(.init_array.*)))
93 KEEP (*(.init_array*))
94 PROVIDE_HIDDEN (__init_array_end = .);
98 PROVIDE_HIDDEN (__fini_array_start = .);
99 KEEP (*(.fini_array*))
100 KEEP (*(SORT(.fini_array.*)))
101 PROVIDE_HIDDEN (__fini_array_end = .);
104 /* used by the startup to initialize data */
107 /* Initialized data sections goes into RAM, load LMA copy after code */
108 .data : AT ( _sidata )
111 _sdata = .; /* create a global symbol at data start */
112 *(.data) /* .data sections */
113 *(.data*) /* .data* sections */
116 _edata = .; /* define a global symbol at data end */
119 /* Uninitialized data section */
123 /* This is used by the startup in order to initialize the .bss secion */
124 _sbss = .; /* define a global symbol at bss start */
125 __bss_start__ = _sbss;
131 _ebss = .; /* define a global symbol at bss end */
135 PROVIDE ( end = _ebss );
136 PROVIDE ( _end = _ebss );
138 /* User_heap_stack section, used to check that there is enough RAM left */
142 . = . + _Min_Heap_Size;
143 . = . + _Main_Stack_Size;
147 /* MEMORY_bank1 section, code must be located here explicitly */
148 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
151 *(.mb1text) /* .mb1text sections (code) */
152 *(.mb1text*) /* .mb1text* sections (code) */
153 *(.mb1rodata) /* read-only data (constants) */
157 /* Remove information from the standard libraries */
165 .ARM.attributes 0 : { *(.ARM.attributes) }