xref: /btstack/port/stm32-l451-miromico-sx1280/STM32L451REIx_FLASH.ld (revision 2fd737d36a1de5d778cacc671d4b4d8c4f3fed82)
1/*
2******************************************************************************
3**
4
5**  File        : LinkerScript.ld
6**
7**  Author		: Auto-generated by System Workbench for STM32
8**
9**  Abstract    : Linker script for STM32L451REIx series
10**                512Kbytes FLASH and 160Kbytes 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) 2019 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 */
53ENTRY(Reset_Handler)
54
55/* Highest address of the user mode stack */
56_estack = 0x20028000;    /* end of RAM */
57/* Generate a link error if heap and stack don't fit into RAM */
58_Min_Heap_Size = 0x200;      /* required amount of heap  */
59_Min_Stack_Size = 0x400; /* required amount of stack */
60
61/* Specify the memory areas */
62MEMORY
63{
64RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 160K
65FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 512K
66}
67
68/* Define output sections */
69SECTIONS
70{
71  /* The startup code goes first into FLASH */
72  .isr_vector :
73  {
74    . = ALIGN(8);
75    KEEP(*(.isr_vector)) /* Startup code */
76    . = ALIGN(8);
77  } >FLASH
78
79  /* The program code and other data goes into FLASH */
80  .text :
81  {
82    . = ALIGN(8);
83    *(.text)           /* .text sections (code) */
84    *(.text*)          /* .text* sections (code) */
85    *(.glue_7)         /* glue arm to thumb code */
86    *(.glue_7t)        /* glue thumb to arm code */
87    *(.eh_frame)
88
89    KEEP (*(.init))
90    KEEP (*(.fini))
91
92    . = ALIGN(8);
93    _etext = .;        /* define a global symbols at end of code */
94  } >FLASH
95
96  /* Constant data goes into FLASH */
97  .rodata :
98  {
99    . = ALIGN(8);
100    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
101    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
102    . = ALIGN(8);
103  } >FLASH
104
105  .ARM.extab   :
106  {
107  . = ALIGN(8);
108  *(.ARM.extab* .gnu.linkonce.armextab.*)
109  . = ALIGN(8);
110  } >FLASH
111  .ARM : {
112	. = ALIGN(8);
113    __exidx_start = .;
114    *(.ARM.exidx*)
115    __exidx_end = .;
116	. = ALIGN(8);
117  } >FLASH
118
119  .preinit_array     :
120  {
121	. = ALIGN(8);
122    PROVIDE_HIDDEN (__preinit_array_start = .);
123    KEEP (*(.preinit_array*))
124    PROVIDE_HIDDEN (__preinit_array_end = .);
125	. = ALIGN(8);
126  } >FLASH
127
128  .init_array :
129  {
130	. = ALIGN(8);
131    PROVIDE_HIDDEN (__init_array_start = .);
132    KEEP (*(SORT(.init_array.*)))
133    KEEP (*(.init_array*))
134    PROVIDE_HIDDEN (__init_array_end = .);
135	. = ALIGN(8);
136  } >FLASH
137  .fini_array :
138  {
139	. = ALIGN(8);
140    PROVIDE_HIDDEN (__fini_array_start = .);
141    KEEP (*(SORT(.fini_array.*)))
142    KEEP (*(.fini_array*))
143    PROVIDE_HIDDEN (__fini_array_end = .);
144	. = ALIGN(8);
145  } >FLASH
146
147  /* used by the startup to initialize data */
148  _sidata = LOADADDR(.data);
149
150  /* Initialized data sections goes into RAM, load LMA copy after code */
151  .data :
152  {
153    . = ALIGN(8);
154    _sdata = .;        /* create a global symbol at data start */
155    *(.data)           /* .data sections */
156    *(.data*)          /* .data* sections */
157
158    . = ALIGN(8);
159    _edata = .;        /* define a global symbol at data end */
160  } >RAM AT> FLASH
161
162
163  /* Uninitialized data section */
164  . = ALIGN(4);
165  .bss :
166  {
167    /* This is used by the startup in order to initialize the .bss secion */
168    _sbss = .;         /* define a global symbol at bss start */
169    __bss_start__ = _sbss;
170    *(.bss)
171    *(.bss*)
172    *(COMMON)
173
174    . = ALIGN(4);
175    _ebss = .;         /* define a global symbol at bss end */
176    __bss_end__ = _ebss;
177  } >RAM
178
179  /* User_heap_stack section, used to check that there is enough RAM left */
180  ._user_heap_stack :
181  {
182    . = ALIGN(8);
183    PROVIDE ( end = . );
184    PROVIDE ( _end = . );
185    . = . + _Min_Heap_Size;
186    . = . + _Min_Stack_Size;
187    . = ALIGN(8);
188  } >RAM
189
190
191
192  /* Remove information from the standard libraries */
193  /DISCARD/ :
194  {
195    libc.a ( * )
196    libm.a ( * )
197    libgcc.a ( * )
198  }
199
200  .ARM.attributes 0 : { *(.ARM.attributes) }
201}
202
203
204