2 *****************************************************************************
4 ** File : stm32_flash.ld
6 ** Abstract : Linker script for STM32L152RB Device with
7 ** 128KByte FLASH, 16KByte 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
\93as is,
\94 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 /* Highest address of the user mode stack */
36 _estack = 0x20004000; /* end of 16K RAM */
38 /* Generate a link error if heap and stack don't fit into RAM */
39 _Min_Heap_Size = 0; /* required amount of heap */
40 _Min_Stack_Size = 0x80; /* required amount of stack */
42 /* Specify the memory areas */
45 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
46 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K
47 MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
48 RW_EEPROM (rw) : ORIGIN = 0x08080000, LENGTH = 32
51 /* Define output sections */
54 /* The startup code goes first into FLASH */
58 KEEP(*(.isr_vector)) /* Startup code */
62 /* The program code and other data goes into FLASH */
66 *(.text) /* .text sections (code) */
67 *(.text*) /* .text* sections (code) */
68 *(.rodata) /* .rodata sections (constants, strings, etc.) */
69 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
70 *(.glue_7) /* glue arm to thumb code */
71 *(.glue_7t) /* glue thumb to arm code */
78 _etext = .; /* define a global symbols at end of code */
82 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
91 PROVIDE_HIDDEN (__preinit_array_start = .);
92 KEEP (*(.preinit_array*))
93 PROVIDE_HIDDEN (__preinit_array_end = .);
97 PROVIDE_HIDDEN (__init_array_start = .);
98 KEEP (*(SORT(.init_array.*)))
99 KEEP (*(.init_array*))
100 PROVIDE_HIDDEN (__init_array_end = .);
104 PROVIDE_HIDDEN (__fini_array_start = .);
105 KEEP (*(.fini_array*))
106 KEEP (*(SORT(.fini_array.*)))
107 PROVIDE_HIDDEN (__fini_array_end = .);
110 /* used by the startup to initialize data */
113 /* Initialized data sections goes into RAM, load LMA copy after code */
114 .data : AT ( _sidata )
117 _sdata = .; /* create a global symbol at data start */
118 *(.data) /* .data sections */
119 *(.data*) /* .data* sections */
122 _edata = .; /* define a global symbol at data end */
125 /* Uninitialized data section */
129 /* This is used by the startup in order to initialize the .bss secion */
130 _sbss = .; /* define a global symbol at bss start */
131 __bss_start__ = _sbss;
137 _ebss = .; /* define a global symbol at bss end */
141 /* User_heap_stack section, used to check that there is enough RAM left */
146 PROVIDE ( _end = . );
147 . = . + _Min_Heap_Size;
148 . = . + _Min_Stack_Size;
152 /* MEMORY_bank1 section, code must be located here explicitly */
153 /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
156 *(.mb1text) /* .mb1text sections (code) */
157 *(.mb1text*) /* .mb1text* sections (code) */
158 *(.mb1rodata) /* read-only data (constants) */
162 /* Remove information from the standard libraries */
170 .ARM.attributes 0 : { *(.ARM.attributes) }
172 .DataFlash (NOLOAD): {*(.DataFlash)} >RW_EEPROM