2 ******************************************************************************
4 ** File : LinkerScript.ld
6 ** Author : Auto-generated by STM32CubeIDE
8 ** Abstract : Linker script for NUCLEO-L152RE Board embedding STM32L152RETx Device from STM32L1 series
12 ** Set heap size, stack size and stack location according
13 ** to application requirements.
15 ** Set memory bank area and size if external memory is used.
17 ** Target : STMicroelectronics STM32
19 ** Distribution: The file is distributed as is without any warranty
22 *****************************************************************************
25 ** <h2><center>© COPYRIGHT(c) 2020 STMicroelectronics</center></h2>
27 ** Redistribution and use in source and binary forms, with or without modification,
28 ** are permitted provided that the following conditions are met:
29 ** 1. Redistributions of source code must retain the above copyright notice,
30 ** this list of conditions and the following disclaimer.
31 ** 2. Redistributions in binary form must reproduce the above copyright notice,
32 ** this list of conditions and the following disclaimer in the documentation
33 ** and/or other materials provided with the distribution.
34 ** 3. Neither the name of STMicroelectronics nor the names of its contributors
35 ** may be used to endorse or promote products derived from this software
36 ** without specific prior written permission.
38 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
42 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
44 ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
45 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
47 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 *****************************************************************************
55 /* Highest address of the user mode stack. */
56 _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory. */
58 _Min_Heap_Size = 0x200 ; /* Required amount of heap. */
59 _Min_Stack_Size = 0x400 ; /* Required amount of stack. */
61 /* Memories definition. */
62 /* ARMv7M MPU requires that the base address of a MPU region must be aligned to
63 * an interger mutiple of the region size and the region size can only be a
64 * power of 2. We, therefore, are not using last 16K of RAM. */
67 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
68 RAM_UNUSED (xrw) : ORIGIN = 0x20010000, LENGTH = 16K
69 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
72 /* Initial 32K Flash is used to store kernel functions and
73 * initial 512 bytes of RAM is used to store kernel data. */
74 __privileged_functions_region_size__ = 32K;
75 __privileged_data_region_size__ = 512;
77 __FLASH_segment_start__ = ORIGIN( FLASH );
78 __FLASH_segment_end__ = __FLASH_segment_start__ + LENGTH( FLASH );
80 __SRAM_segment_start__ = ORIGIN( RAM );
81 __SRAM_segment_end__ = __SRAM_segment_start__ + LENGTH( RAM );
83 __privileged_functions_start__ = __FLASH_segment_start__;
84 __privileged_functions_end__ = __FLASH_segment_start__ + __privileged_functions_region_size__;
86 __privileged_data_start__ = __SRAM_segment_start__;
87 __privileged_data_end__ = __SRAM_segment_start__ + __privileged_data_region_size__;
92 /* The startup code and FreeRTOS kernel code are placed into privileged
94 .privileged_functions :
97 KEEP(*(.isr_vector)) /* Startup code */
99 *(privileged_functions)
102 /* Ensure that un-privileged code is placed after the region reserved
103 * for privileged kernel code. */
104 /* Note that dot (.) actually refers to the byte offset from the start
105 * of the current section (.privileged_functions in this case). As a
106 * result, setting dot (.) to a value sets the size of the section. */
107 . = __privileged_functions_region_size__;
110 /* The rest of the program code and other data into the remaining
111 * unprivileged flash. */
114 /* Place the FreeRTOS System Calls first in the unprivileged region. */
116 __syscalls_flash_start__ = .;
117 *(freertos_system_calls)
118 __syscalls_flash_end__ = .;
120 *(.text) /* .text sections (code). */
121 *(.text*) /* .text* sections (code). */
122 *(.glue_7) /* glue arm to thumb code. */
123 *(.glue_7t) /* glue thumb to arm code. */
130 _etext = .; /* define a global symbols at end of code. */
133 /* Constant data into "FLASH" Rom type memory. */
137 *(.rodata) /* .rodata sections (constants, strings, etc.). */
138 *(.rodata*) /* .rodata* sections (constants, strings, etc.). */
145 *(.ARM.extab* .gnu.linkonce.armextab.*)
161 PROVIDE_HIDDEN (__preinit_array_start = .);
162 KEEP (*(.preinit_array*))
163 PROVIDE_HIDDEN (__preinit_array_end = .);
170 PROVIDE_HIDDEN (__init_array_start = .);
171 KEEP (*(SORT(.init_array.*)))
172 KEEP (*(.init_array*))
173 PROVIDE_HIDDEN (__init_array_end = .);
180 PROVIDE_HIDDEN (__fini_array_start = .);
181 KEEP (*(SORT(.fini_array.*)))
182 KEEP (*(.fini_array*))
183 PROVIDE_HIDDEN (__fini_array_end = .);
187 /* Used by the startup to initialize data. */
188 _sidata = LOADADDR(.privileged_data);
190 /* FreeRTOS kernel data. */
194 _sdata = .; /* Create a global symbol at data start. */
198 /* Ensure that un-privileged data is placed after the region reserved
199 * for privileged kernel data. */
200 /* Note that dot (.) actually refers to the byte offset from the start
201 * of the current section (.privileged_data in this case). As a result,
202 * setting dot (.) to a value sets the size of the section. */
203 . = __privileged_data_region_size__;
206 /* Initialized data sections into "RAM" Ram type memory. */
210 *(.data) /* .data sections. */
211 *(.data*) /* .data* sections. */
214 _edata = .; /* define a global symbol at data end. */
217 /* Uninitialized data section into "RAM" Ram type memory. */
221 /* This is used by the startup in order to initialize the .bss section. */
222 _sbss = .; /* define a global symbol at bss start. */
223 __bss_start__ = _sbss;
229 _ebss = .; /* define a global symbol at bss end. */
233 /* User_heap_stack section, used to check that there is enough "RAM" Ram
234 * type memory left. */
239 PROVIDE ( _end = . );
240 . = . + _Min_Heap_Size;
241 . = . + _Min_Stack_Size;
245 /* Remove information from the compiler libraries. */
253 .ARM.attributes 0 : { *(.ARM.attributes) }