xref: /btstack/port/stm32-l451-miromico-sx1280/STM32L451REIx_FLASH.ld (revision 2fd737d36a1de5d778cacc671d4b4d8c4f3fed82)
1*2fd737d3SMatthias Ringwald/*
2*2fd737d3SMatthias Ringwald******************************************************************************
3*2fd737d3SMatthias Ringwald**
4*2fd737d3SMatthias Ringwald
5*2fd737d3SMatthias Ringwald**  File        : LinkerScript.ld
6*2fd737d3SMatthias Ringwald**
7*2fd737d3SMatthias Ringwald**  Author		: Auto-generated by System Workbench for STM32
8*2fd737d3SMatthias Ringwald**
9*2fd737d3SMatthias Ringwald**  Abstract    : Linker script for STM32L451REIx series
10*2fd737d3SMatthias Ringwald**                512Kbytes FLASH and 160Kbytes RAM
11*2fd737d3SMatthias Ringwald**
12*2fd737d3SMatthias Ringwald**                Set heap size, stack size and stack location according
13*2fd737d3SMatthias Ringwald**                to application requirements.
14*2fd737d3SMatthias Ringwald**
15*2fd737d3SMatthias Ringwald**                Set memory bank area and size if external memory is used.
16*2fd737d3SMatthias Ringwald**
17*2fd737d3SMatthias Ringwald**  Target      : STMicroelectronics STM32
18*2fd737d3SMatthias Ringwald**
19*2fd737d3SMatthias Ringwald**  Distribution: The file is distributed “as is,” without any warranty
20*2fd737d3SMatthias Ringwald**                of any kind.
21*2fd737d3SMatthias Ringwald**
22*2fd737d3SMatthias Ringwald*****************************************************************************
23*2fd737d3SMatthias Ringwald** @attention
24*2fd737d3SMatthias Ringwald**
25*2fd737d3SMatthias Ringwald** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
26*2fd737d3SMatthias Ringwald**
27*2fd737d3SMatthias Ringwald** Redistribution and use in source and binary forms, with or without modification,
28*2fd737d3SMatthias Ringwald** are permitted provided that the following conditions are met:
29*2fd737d3SMatthias Ringwald**   1. Redistributions of source code must retain the above copyright notice,
30*2fd737d3SMatthias Ringwald**      this list of conditions and the following disclaimer.
31*2fd737d3SMatthias Ringwald**   2. Redistributions in binary form must reproduce the above copyright notice,
32*2fd737d3SMatthias Ringwald**      this list of conditions and the following disclaimer in the documentation
33*2fd737d3SMatthias Ringwald**      and/or other materials provided with the distribution.
34*2fd737d3SMatthias Ringwald**   3. Neither the name of STMicroelectronics nor the names of its contributors
35*2fd737d3SMatthias Ringwald**      may be used to endorse or promote products derived from this software
36*2fd737d3SMatthias Ringwald**      without specific prior written permission.
37*2fd737d3SMatthias Ringwald**
38*2fd737d3SMatthias Ringwald** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39*2fd737d3SMatthias Ringwald** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40*2fd737d3SMatthias Ringwald** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41*2fd737d3SMatthias Ringwald** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
42*2fd737d3SMatthias Ringwald** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43*2fd737d3SMatthias Ringwald** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
44*2fd737d3SMatthias Ringwald** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
45*2fd737d3SMatthias Ringwald** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46*2fd737d3SMatthias Ringwald** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
47*2fd737d3SMatthias Ringwald** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48*2fd737d3SMatthias Ringwald**
49*2fd737d3SMatthias Ringwald*****************************************************************************
50*2fd737d3SMatthias Ringwald*/
51*2fd737d3SMatthias Ringwald
52*2fd737d3SMatthias Ringwald/* Entry Point */
53*2fd737d3SMatthias RingwaldENTRY(Reset_Handler)
54*2fd737d3SMatthias Ringwald
55*2fd737d3SMatthias Ringwald/* Highest address of the user mode stack */
56*2fd737d3SMatthias Ringwald_estack = 0x20028000;    /* end of RAM */
57*2fd737d3SMatthias Ringwald/* Generate a link error if heap and stack don't fit into RAM */
58*2fd737d3SMatthias Ringwald_Min_Heap_Size = 0x200;      /* required amount of heap  */
59*2fd737d3SMatthias Ringwald_Min_Stack_Size = 0x400; /* required amount of stack */
60*2fd737d3SMatthias Ringwald
61*2fd737d3SMatthias Ringwald/* Specify the memory areas */
62*2fd737d3SMatthias RingwaldMEMORY
63*2fd737d3SMatthias Ringwald{
64*2fd737d3SMatthias RingwaldRAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 160K
65*2fd737d3SMatthias RingwaldFLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 512K
66*2fd737d3SMatthias Ringwald}
67*2fd737d3SMatthias Ringwald
68*2fd737d3SMatthias Ringwald/* Define output sections */
69*2fd737d3SMatthias RingwaldSECTIONS
70*2fd737d3SMatthias Ringwald{
71*2fd737d3SMatthias Ringwald  /* The startup code goes first into FLASH */
72*2fd737d3SMatthias Ringwald  .isr_vector :
73*2fd737d3SMatthias Ringwald  {
74*2fd737d3SMatthias Ringwald    . = ALIGN(8);
75*2fd737d3SMatthias Ringwald    KEEP(*(.isr_vector)) /* Startup code */
76*2fd737d3SMatthias Ringwald    . = ALIGN(8);
77*2fd737d3SMatthias Ringwald  } >FLASH
78*2fd737d3SMatthias Ringwald
79*2fd737d3SMatthias Ringwald  /* The program code and other data goes into FLASH */
80*2fd737d3SMatthias Ringwald  .text :
81*2fd737d3SMatthias Ringwald  {
82*2fd737d3SMatthias Ringwald    . = ALIGN(8);
83*2fd737d3SMatthias Ringwald    *(.text)           /* .text sections (code) */
84*2fd737d3SMatthias Ringwald    *(.text*)          /* .text* sections (code) */
85*2fd737d3SMatthias Ringwald    *(.glue_7)         /* glue arm to thumb code */
86*2fd737d3SMatthias Ringwald    *(.glue_7t)        /* glue thumb to arm code */
87*2fd737d3SMatthias Ringwald    *(.eh_frame)
88*2fd737d3SMatthias Ringwald
89*2fd737d3SMatthias Ringwald    KEEP (*(.init))
90*2fd737d3SMatthias Ringwald    KEEP (*(.fini))
91*2fd737d3SMatthias Ringwald
92*2fd737d3SMatthias Ringwald    . = ALIGN(8);
93*2fd737d3SMatthias Ringwald    _etext = .;        /* define a global symbols at end of code */
94*2fd737d3SMatthias Ringwald  } >FLASH
95*2fd737d3SMatthias Ringwald
96*2fd737d3SMatthias Ringwald  /* Constant data goes into FLASH */
97*2fd737d3SMatthias Ringwald  .rodata :
98*2fd737d3SMatthias Ringwald  {
99*2fd737d3SMatthias Ringwald    . = ALIGN(8);
100*2fd737d3SMatthias Ringwald    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
101*2fd737d3SMatthias Ringwald    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
102*2fd737d3SMatthias Ringwald    . = ALIGN(8);
103*2fd737d3SMatthias Ringwald  } >FLASH
104*2fd737d3SMatthias Ringwald
105*2fd737d3SMatthias Ringwald  .ARM.extab   :
106*2fd737d3SMatthias Ringwald  {
107*2fd737d3SMatthias Ringwald  . = ALIGN(8);
108*2fd737d3SMatthias Ringwald  *(.ARM.extab* .gnu.linkonce.armextab.*)
109*2fd737d3SMatthias Ringwald  . = ALIGN(8);
110*2fd737d3SMatthias Ringwald  } >FLASH
111*2fd737d3SMatthias Ringwald  .ARM : {
112*2fd737d3SMatthias Ringwald	. = ALIGN(8);
113*2fd737d3SMatthias Ringwald    __exidx_start = .;
114*2fd737d3SMatthias Ringwald    *(.ARM.exidx*)
115*2fd737d3SMatthias Ringwald    __exidx_end = .;
116*2fd737d3SMatthias Ringwald	. = ALIGN(8);
117*2fd737d3SMatthias Ringwald  } >FLASH
118*2fd737d3SMatthias Ringwald
119*2fd737d3SMatthias Ringwald  .preinit_array     :
120*2fd737d3SMatthias Ringwald  {
121*2fd737d3SMatthias Ringwald	. = ALIGN(8);
122*2fd737d3SMatthias Ringwald    PROVIDE_HIDDEN (__preinit_array_start = .);
123*2fd737d3SMatthias Ringwald    KEEP (*(.preinit_array*))
124*2fd737d3SMatthias Ringwald    PROVIDE_HIDDEN (__preinit_array_end = .);
125*2fd737d3SMatthias Ringwald	. = ALIGN(8);
126*2fd737d3SMatthias Ringwald  } >FLASH
127*2fd737d3SMatthias Ringwald
128*2fd737d3SMatthias Ringwald  .init_array :
129*2fd737d3SMatthias Ringwald  {
130*2fd737d3SMatthias Ringwald	. = ALIGN(8);
131*2fd737d3SMatthias Ringwald    PROVIDE_HIDDEN (__init_array_start = .);
132*2fd737d3SMatthias Ringwald    KEEP (*(SORT(.init_array.*)))
133*2fd737d3SMatthias Ringwald    KEEP (*(.init_array*))
134*2fd737d3SMatthias Ringwald    PROVIDE_HIDDEN (__init_array_end = .);
135*2fd737d3SMatthias Ringwald	. = ALIGN(8);
136*2fd737d3SMatthias Ringwald  } >FLASH
137*2fd737d3SMatthias Ringwald  .fini_array :
138*2fd737d3SMatthias Ringwald  {
139*2fd737d3SMatthias Ringwald	. = ALIGN(8);
140*2fd737d3SMatthias Ringwald    PROVIDE_HIDDEN (__fini_array_start = .);
141*2fd737d3SMatthias Ringwald    KEEP (*(SORT(.fini_array.*)))
142*2fd737d3SMatthias Ringwald    KEEP (*(.fini_array*))
143*2fd737d3SMatthias Ringwald    PROVIDE_HIDDEN (__fini_array_end = .);
144*2fd737d3SMatthias Ringwald	. = ALIGN(8);
145*2fd737d3SMatthias Ringwald  } >FLASH
146*2fd737d3SMatthias Ringwald
147*2fd737d3SMatthias Ringwald  /* used by the startup to initialize data */
148*2fd737d3SMatthias Ringwald  _sidata = LOADADDR(.data);
149*2fd737d3SMatthias Ringwald
150*2fd737d3SMatthias Ringwald  /* Initialized data sections goes into RAM, load LMA copy after code */
151*2fd737d3SMatthias Ringwald  .data :
152*2fd737d3SMatthias Ringwald  {
153*2fd737d3SMatthias Ringwald    . = ALIGN(8);
154*2fd737d3SMatthias Ringwald    _sdata = .;        /* create a global symbol at data start */
155*2fd737d3SMatthias Ringwald    *(.data)           /* .data sections */
156*2fd737d3SMatthias Ringwald    *(.data*)          /* .data* sections */
157*2fd737d3SMatthias Ringwald
158*2fd737d3SMatthias Ringwald    . = ALIGN(8);
159*2fd737d3SMatthias Ringwald    _edata = .;        /* define a global symbol at data end */
160*2fd737d3SMatthias Ringwald  } >RAM AT> FLASH
161*2fd737d3SMatthias Ringwald
162*2fd737d3SMatthias Ringwald
163*2fd737d3SMatthias Ringwald  /* Uninitialized data section */
164*2fd737d3SMatthias Ringwald  . = ALIGN(4);
165*2fd737d3SMatthias Ringwald  .bss :
166*2fd737d3SMatthias Ringwald  {
167*2fd737d3SMatthias Ringwald    /* This is used by the startup in order to initialize the .bss secion */
168*2fd737d3SMatthias Ringwald    _sbss = .;         /* define a global symbol at bss start */
169*2fd737d3SMatthias Ringwald    __bss_start__ = _sbss;
170*2fd737d3SMatthias Ringwald    *(.bss)
171*2fd737d3SMatthias Ringwald    *(.bss*)
172*2fd737d3SMatthias Ringwald    *(COMMON)
173*2fd737d3SMatthias Ringwald
174*2fd737d3SMatthias Ringwald    . = ALIGN(4);
175*2fd737d3SMatthias Ringwald    _ebss = .;         /* define a global symbol at bss end */
176*2fd737d3SMatthias Ringwald    __bss_end__ = _ebss;
177*2fd737d3SMatthias Ringwald  } >RAM
178*2fd737d3SMatthias Ringwald
179*2fd737d3SMatthias Ringwald  /* User_heap_stack section, used to check that there is enough RAM left */
180*2fd737d3SMatthias Ringwald  ._user_heap_stack :
181*2fd737d3SMatthias Ringwald  {
182*2fd737d3SMatthias Ringwald    . = ALIGN(8);
183*2fd737d3SMatthias Ringwald    PROVIDE ( end = . );
184*2fd737d3SMatthias Ringwald    PROVIDE ( _end = . );
185*2fd737d3SMatthias Ringwald    . = . + _Min_Heap_Size;
186*2fd737d3SMatthias Ringwald    . = . + _Min_Stack_Size;
187*2fd737d3SMatthias Ringwald    . = ALIGN(8);
188*2fd737d3SMatthias Ringwald  } >RAM
189*2fd737d3SMatthias Ringwald
190*2fd737d3SMatthias Ringwald
191*2fd737d3SMatthias Ringwald
192*2fd737d3SMatthias Ringwald  /* Remove information from the standard libraries */
193*2fd737d3SMatthias Ringwald  /DISCARD/ :
194*2fd737d3SMatthias Ringwald  {
195*2fd737d3SMatthias Ringwald    libc.a ( * )
196*2fd737d3SMatthias Ringwald    libm.a ( * )
197*2fd737d3SMatthias Ringwald    libgcc.a ( * )
198*2fd737d3SMatthias Ringwald  }
199*2fd737d3SMatthias Ringwald
200*2fd737d3SMatthias Ringwald  .ARM.attributes 0 : { *(.ARM.attributes) }
201*2fd737d3SMatthias Ringwald}
202*2fd737d3SMatthias Ringwald
203*2fd737d3SMatthias Ringwald
204