2 ******************************************************************************
4 ** File : LinkerScript.ld
6 ** Author : Auto-generated by STM32CubeIDE
8 ** Abstract : Linker script for B-L475E-IOT01A1 Board embedding STM32L475VGTx Device from STM32L4 series
13 ** Set heap size, stack size and stack location according
14 ** to application requirements.
16 ** Set memory bank area and size if external memory is used.
18 ** Target : STMicroelectronics STM32
20 ** Distribution: The file is distributed as is without any warranty
23 *****************************************************************************
26 ** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
28 ** Redistribution and use in source and binary forms, with or without modification,
29 ** are permitted provided that the following conditions are met:
30 ** 1. Redistributions of source code must retain the above copyright notice,
31 ** this list of conditions and the following disclaimer.
32 ** 2. Redistributions in binary form must reproduce the above copyright notice,
33 ** this list of conditions and the following disclaimer in the documentation
34 ** and/or other materials provided with the distribution.
35 ** 3. Neither the name of STMicroelectronics nor the names of its contributors
36 ** may be used to endorse or promote products derived from this software
37 ** without specific prior written permission.
39 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
40 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
43 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
45 ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 *****************************************************************************
56 /* Highest address of the user mode stack */
57 _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
59 _Min_Heap_Size = 0x200 ; /* required amount of heap */
60 _Min_Stack_Size = 0x400 ; /* required amount of stack */
62 /* Memories definition */
65 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
66 RAM2 (xrw) : ORIGIN = 0x10000000, LENGTH = 32K
67 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
70 /* Initial 32K Flash is used to store kernel functions and
71 * initial 512 bytes of RAM is used to store kernel data. */
72 __privileged_functions_region_size__ = 32K;
73 __privileged_data_region_size__ = 512;
75 __FLASH_segment_start__ = ORIGIN( FLASH );
76 __FLASH_segment_end__ = __FLASH_segment_start__ + LENGTH( FLASH );
78 __SRAM_segment_start__ = ORIGIN( RAM );
79 __SRAM_segment_end__ = __SRAM_segment_start__ + LENGTH( RAM );
81 __privileged_functions_start__ = __FLASH_segment_start__;
82 __privileged_functions_end__ = __FLASH_segment_start__ + __privileged_functions_region_size__;
84 __privileged_data_start__ = __SRAM_segment_start__;
85 __privileged_data_end__ = __SRAM_segment_start__ + __privileged_data_region_size__;
90 /* The startup code and FreeRTOS kernel code are placed into privileged
92 .privileged_functions :
95 KEEP(*(.isr_vector)) /* Startup code. */
97 *(privileged_functions)
100 /* Ensure that non-privileged code is placed after the region reserved for
101 * privileged kernel code. */
102 /* Note that dot (.) actually refers to the byte offset from the start of
103 * the current section (.privileged_functions in this case). As a result,
104 * setting dot (.) to a value sets the size of the section. */
105 . = __privileged_functions_region_size__;
108 /* The program code and other data into "FLASH" Rom type memory */
111 /* Place the FreeRTOS System Calls first in the unprivileged region. */
113 __syscalls_flash_start__ = .;
114 *(freertos_system_calls)
115 __syscalls_flash_end__ = .;
117 *(.text) /* .text sections (code) */
118 *(.text*) /* .text* sections (code) */
119 *(.glue_7) /* glue arm to thumb code */
120 *(.glue_7t) /* glue thumb to arm code */
127 _etext = .; /* define a global symbols at end of code */
130 /* Constant data into "FLASH" Rom type memory */
134 *(.rodata) /* .rodata sections (constants, strings, etc.) */
135 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
141 *(.ARM.extab* .gnu.linkonce.armextab.*)
156 PROVIDE_HIDDEN (__preinit_array_start = .);
157 KEEP (*(.preinit_array*))
158 PROVIDE_HIDDEN (__preinit_array_end = .);
165 PROVIDE_HIDDEN (__init_array_start = .);
166 KEEP (*(SORT(.init_array.*)))
167 KEEP (*(.init_array*))
168 PROVIDE_HIDDEN (__init_array_end = .);
175 PROVIDE_HIDDEN (__fini_array_start = .);
176 KEEP (*(SORT(.fini_array.*)))
177 KEEP (*(.fini_array*))
178 PROVIDE_HIDDEN (__fini_array_end = .);
182 /* Used by the startup to initialize data */
183 _sidata = LOADADDR(.privileged_data);
185 /* FreeRTOS kernel data. */
189 _sdata = .; /* Create a global symbol at data start. */
193 /* Ensure that non-privileged data is placed after the region reserved for
194 * privileged kernel data. */
195 /* Note that dot (.) actually refers to the byte offset from the start of
196 * the current section (.privileged_data in this case). As a result, setting
197 * dot (.) to a value sets the size of the section. */
198 . = __privileged_data_region_size__;
201 /* Initialized data sections into "RAM" Ram type memory */
205 *(.data) /* .data sections */
206 *(.data*) /* .data* sections */
209 _edata = .; /* define a global symbol at data end */
213 /* Uninitialized data section into "RAM" Ram type memory */
217 /* This is used by the startup in order to initialize the .bss section */
218 _sbss = .; /* define a global symbol at bss start */
219 __bss_start__ = _sbss;
225 _ebss = .; /* define a global symbol at bss end */
229 /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
234 PROVIDE ( _end = . );
235 . = . + _Min_Heap_Size;
236 . = . + _Min_Stack_Size;
240 /* Remove information from the compiler libraries */
248 .ARM.attributes 0 : { *(.ARM.attributes) }