2 *****************************************************************************
4 ** File : stm32_flash.ld
6 ** Abstract : Linker script for STM32F407VG Device with
7 ** 1024KByte FLASH, 128KByte RAM
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 ** Environment : Atollic TrueSTUDIO(R)
18 ** Distribution: The file is distributed “as is,” without any warranty
21 ** (c)Copyright Atollic AB.
22 ** You may use this file as-is or modify it according to the needs of your
23 ** project. Distribution of this file (unmodified or modified) is not
24 ** permitted. Atollic AB permit registered Atollic TrueSTUDIO(R) users the
25 ** rights to distribute the assembled, compiled & linked contents of this
26 ** file as part of an application binary file, provided that it is built
27 ** using the Atollic TrueSTUDIO(R) toolchain.
29 *****************************************************************************
35 /* Generate a link error if heap and stack don't fit into RAM */
36 _Min_Heap_Size = 0x2000; /* required amount of heap */
37 _Min_Stack_Size = 0x4000; /* required amount of stack */
39 /* Specify the memory areas */
42 0x08000000 to 0x08100000 1024kb full flash,
43 0x08000000 to 0x08020000 128kb OPBL,
44 0x08020000 to 0x08080000 384kb firmware,
45 0x08080000 to 0x080A0000 128kb config,
50 FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 0x000A0000
51 CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
52 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x00020000
53 MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
56 REGION_ALIAS("CCSRAM", CCM);
57 REGION_ALIAS("SRAM", RAM);
59 /* Section Definitions */
62 /* The program code and other data goes into FLASH */
65 PROVIDE (isr_vector_table_base = .);
66 KEEP(*(.isr_vector)) /* Startup code */
68 *(.text) /* .text sections (code) */
69 *(.text*) /* .text* sections (code) */
70 *(.rodata) /* .rodata sections (constants, strings, etc.) */
71 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
72 *(.glue_7) /* glue arm to thumb code */
73 *(.glue_7t) /* glue thumb to arm code */
80 _etext = .; /* define a global symbols at end of code */
84 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
93 PROVIDE_HIDDEN (__preinit_array_start = .);
94 KEEP (*(.preinit_array*))
95 PROVIDE_HIDDEN (__preinit_array_end = .);
99 PROVIDE_HIDDEN (__init_array_start = .);
100 KEEP (*(SORT(.init_array.*)))
101 KEEP (*(.init_array*))
102 PROVIDE_HIDDEN (__init_array_end = .);
106 PROVIDE_HIDDEN (__fini_array_start = .);
107 KEEP (*(.fini_array*))
108 KEEP (*(SORT(.fini_array.*)))
109 PROVIDE_HIDDEN (__fini_array_end = .);
113 /* used by the startup to initialize data */
117 * Place the IRQ/bootstrap stack at the bottom of SRAM so that an overflow
118 * results in a hard fault.
128 /* Initialized data sections goes into RAM, load LMA copy after code */
132 _sdata = .; /* create a global symbol at data start */
133 *(.data) /* .data sections */
134 *(.data*) /* .data* sections */
137 _edata = .; /* define a global symbol at data end */
140 /* Uninitialized data section */
144 /* This is used by the startup in order to initialize the .bss secion */
145 _sbss = .; /* define a global symbol at bss start */
146 __bss_start__ = _sbss;
152 _ebss = .; /* define a global symbol at bss end */
156 /* User_heap_stack section, used to check that there is enough RAM left */
161 PROVIDE ( _end = . );
162 . = . + _Min_Heap_Size;
163 . = . + _Min_Stack_Size;
167 /* MEMORY_bank1 section, code must be located here explicitly */
168 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
171 *(.mb1text) /* .mb1text sections (code) */
172 *(.mb1text*) /* .mb1text* sections (code) */
173 *(.mb1rodata) /* read-only data (constants) */
177 /* Remove information from the standard libraries */
185 .ARM.attributes 0 : { *(.ARM.attributes) }