]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Projects/GCC/STM32L152RETX_FLASH.ld
Add MPU demo project for Nulceo-L152RE which is Coretx-M3.
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M3_NUCLEO_L152RE_GCC / Projects / GCC / STM32L152RETX_FLASH.ld
1 /*
2 ******************************************************************************
3 **
4 **  File        : LinkerScript.ld
5 **
6 **  Author              : Auto-generated by STM32CubeIDE
7 **
8 **  Abstract    : Linker script for NUCLEO-L152RE Board embedding STM32L152RETx Device from STM32L1 series
9 **                      512Kbytes FLASH
10 **                      80Kbytes RAM
11 **
12 **                Set heap size, stack size and stack location according
13 **                to application requirements.
14 **
15 **                Set memory bank area and size if external memory is used.
16 **
17 **  Target      : STMicroelectronics STM32
18 **
19 **  Distribution: The file is distributed as is without any warranty
20 **                of any kind.
21 **
22 *****************************************************************************
23 ** @attention
24 **
25 ** <h2><center>&copy; COPYRIGHT(c) 2020 STMicroelectronics</center></h2>
26 **
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.
37 **
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.
48 **
49 *****************************************************************************
50 */
51
52 /* Entry Point. */
53 ENTRY(Reset_Handler)
54
55 /* Highest address of the user mode stack. */
56 _estack = ORIGIN(RAM) + LENGTH(RAM);    /* end of "RAM" Ram type memory. */
57
58 _Min_Heap_Size = 0x200 ;        /* Required amount of heap. */
59 _Min_Stack_Size = 0x400 ;       /* Required amount of stack. */
60
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. */
65 MEMORY
66 {
67     RAM (xrw)           : ORIGIN = 0x20000000,  LENGTH = 64K
68     RAM_UNUSED (xrw)    : ORIGIN = 0x20010000,  LENGTH = 16K
69     FLASH (rx)          : ORIGIN = 0x8000000,   LENGTH = 512K
70 }
71
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;
76
77 __FLASH_segment_start__               = ORIGIN( FLASH );
78 __FLASH_segment_end__                 = __FLASH_segment_start__ + LENGTH( FLASH );
79
80 __SRAM_segment_start__                = ORIGIN( RAM );
81 __SRAM_segment_end__                  = __SRAM_segment_start__ + LENGTH( RAM );
82
83 __privileged_functions_start__        = __FLASH_segment_start__;
84 __privileged_functions_end__          = __FLASH_segment_start__ + __privileged_functions_region_size__;
85
86 __privileged_data_start__             = __SRAM_segment_start__;
87 __privileged_data_end__               = __SRAM_segment_start__ + __privileged_data_region_size__;
88
89 /* Sections. */
90 SECTIONS
91 {
92     /* The startup code and FreeRTOS kernel code are placed into privileged
93      * flash. */
94     .privileged_functions :
95     {
96         . = ALIGN(4);
97         KEEP(*(.isr_vector)) /* Startup code */
98         . = ALIGN(4);
99         *(privileged_functions)
100         . = ALIGN(4);
101         FILL(0xDEAD);
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__;
108     } >FLASH
109
110     /* The rest of the program code and other data into the remaining
111      * unprivileged flash. */
112     .text :
113     {
114         /* Place the FreeRTOS System Calls first in the unprivileged region. */
115         . = ALIGN(4);
116         __syscalls_flash_start__ = .;
117         *(freertos_system_calls)
118         __syscalls_flash_end__ = .;
119         . = ALIGN(4);
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. */
124         *(.eh_frame)
125
126         KEEP (*(.init))
127         KEEP (*(.fini))
128
129         . = ALIGN(4);
130         _etext = .;        /* define a global symbols at end of code. */
131     } >FLASH
132
133     /* Constant data into "FLASH" Rom type memory. */
134     .rodata :
135     {
136         . = ALIGN(4);
137         *(.rodata)         /* .rodata sections (constants, strings, etc.). */
138         *(.rodata*)        /* .rodata* sections (constants, strings, etc.). */
139         . = ALIGN(4);
140     } >FLASH
141
142     .ARM.extab :
143     { 
144         . = ALIGN(4);
145         *(.ARM.extab* .gnu.linkonce.armextab.*)
146         . = ALIGN(4);
147     } >FLASH
148     
149     .ARM :
150     {
151         . = ALIGN(4);
152         __exidx_start = .;
153         *(.ARM.exidx*)
154         __exidx_end = .;
155         . = ALIGN(4);
156     } >FLASH
157
158     .preinit_array :
159     {
160         . = ALIGN(4);
161         PROVIDE_HIDDEN (__preinit_array_start = .);
162         KEEP (*(.preinit_array*))
163         PROVIDE_HIDDEN (__preinit_array_end = .);
164         . = ALIGN(4);
165     } >FLASH
166     
167     .init_array :
168     {
169         . = ALIGN(4);
170         PROVIDE_HIDDEN (__init_array_start = .);
171         KEEP (*(SORT(.init_array.*)))
172         KEEP (*(.init_array*))
173         PROVIDE_HIDDEN (__init_array_end = .);
174         . = ALIGN(4);
175     } >FLASH
176     
177     .fini_array :
178     {
179         . = ALIGN(4);
180         PROVIDE_HIDDEN (__fini_array_start = .);
181         KEEP (*(SORT(.fini_array.*)))
182         KEEP (*(.fini_array*))
183         PROVIDE_HIDDEN (__fini_array_end = .);
184         . = ALIGN(4);
185     } >FLASH
186
187     /* Used by the startup to initialize data. */
188     _sidata = LOADADDR(.privileged_data);
189
190     /* FreeRTOS kernel data. */
191     .privileged_data :
192     {
193         . = ALIGN(4);
194         _sdata = .;        /* Create a global symbol at data start. */
195         *(privileged_data)
196         . = ALIGN(4);
197         FILL(0xDEAD);
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__;
204     } >RAM AT> FLASH
205
206     /* Initialized data sections into "RAM" Ram type memory. */
207     .data : 
208     {
209         . = ALIGN(4);
210         *(.data)           /* .data sections. */
211         *(.data*)          /* .data* sections. */
212
213         . = ALIGN(4);
214         _edata = .;        /* define a global symbol at data end. */
215     } >RAM AT> FLASH
216
217     /* Uninitialized data section into "RAM" Ram type memory. */
218     . = ALIGN(4);
219     .bss :
220     {
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;
224         *(.bss)
225         *(.bss*)
226         *(COMMON)
227
228         . = ALIGN(4);
229         _ebss = .;         /* define a global symbol at bss end. */
230         __bss_end__ = _ebss;
231     } >RAM
232
233     /* User_heap_stack section, used to check that there is enough "RAM" Ram
234     * type memory left. */
235     ._user_heap_stack :
236     {
237         . = ALIGN(8);
238         PROVIDE ( end = . );
239         PROVIDE ( _end = . );
240         . = . + _Min_Heap_Size;
241         . = . + _Min_Stack_Size;
242         . = ALIGN(8);
243     } >RAM
244
245     /* Remove information from the compiler libraries. */
246     /DISCARD/ :
247     {
248         libc.a ( * )
249         libm.a ( * )
250         libgcc.a ( * )
251     }
252
253     .ARM.attributes 0 : { *(.ARM.attributes) }
254 }