• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2******************************************************************************
3**
4
5**  File        : LinkerScript.ld
6**
7**  Author		: Auto-generated by System Workbench for STM32
8**
9**  Abstract    : Linker script for STM32F407IGTx series
10**                1024Kbytes FLASH and 192Kbytes 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_sstack = 0x20000000;
57_estack = 0x20020000;    /* end of RAM */
58
59/* Specify the memory areas */
60MEMORY
61{
62RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 128K
63CCMRAM (xrw)      : ORIGIN = 0x10000000, LENGTH = 64K
64FLASH (rx)      : ORIGIN = 0x8010000, LENGTH = 960K
65}
66
67/* Define output sections */
68SECTIONS
69{
70  /* The startup code goes first into FLASH */
71  .isr_vector :
72  {
73    . = ALIGN(4);
74    KEEP(*(.isr_vector)) /* Startup code */
75    . = ALIGN(4);
76  } >FLASH
77
78  /* The program code and other data goes into FLASH */
79  .text :
80  {
81    . = ALIGN(4);
82    _stext = .;
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    _hdf_drivers_start = .;
90    KEEP(*(.hdf.driver))
91    _hdf_drivers_end = .; /* define a section for hdf driver */
92
93    __zinitcall_bsp_start = .;
94    KEEP (*(.zinitcall.bsp0.init))
95    KEEP (*(.zinitcall.bsp1.init))
96    KEEP (*(.zinitcall.bsp2.init))
97    KEEP (*(.zinitcall.bsp3.init))
98    KEEP (*(.zinitcall.bsp4.init))
99    __zinitcall_bsp_end = .;
100    __zinitcall_device_start = .;
101    KEEP (*(.zinitcall.device0.init))
102    KEEP (*(.zinitcall.device1.init))
103    KEEP (*(.zinitcall.device2.init))
104    KEEP (*(.zinitcall.device3.init))
105    KEEP (*(.zinitcall.device4.init))
106    __zinitcall_device_end = .;
107    __zinitcall_core_start = .;
108    KEEP (*(.zinitcall.core0.init))
109    KEEP (*(.zinitcall.core1.init))
110    KEEP (*(.zinitcall.core2.init))
111    KEEP (*(.zinitcall.core3.init))
112    KEEP (*(.zinitcall.core4.init))
113    __zinitcall_core_end = .;
114    __zinitcall_sys_service_start = .;
115    KEEP (*(.zinitcall.sys.service0.init))
116    KEEP (*(.zinitcall.sys.service1.init))
117    KEEP (*(.zinitcall.sys.service2.init))
118    KEEP (*(.zinitcall.sys.service3.init))
119    KEEP (*(.zinitcall.sys.service4.init))
120    __zinitcall_sys_service_end = .;
121    __zinitcall_sys_feature_start = .;
122    KEEP (*(.zinitcall.sys.feature0.init))
123    KEEP (*(.zinitcall.sys.feature1.init))
124    KEEP (*(.zinitcall.sys.feature2.init))
125    KEEP (*(.zinitcall.sys.feature3.init))
126    KEEP (*(.zinitcall.sys.feature4.init))
127    __zinitcall_sys_feature_end = .;
128    __zinitcall_run_start = .;
129    KEEP (*(.zinitcall.run0.init))
130    KEEP (*(.zinitcall.run1.init))
131    KEEP (*(.zinitcall.run2.init))
132    KEEP (*(.zinitcall.run3.init))
133    KEEP (*(.zinitcall.run4.init))
134    __zinitcall_run_end = .;
135    __zinitcall_app_service_start = .;
136    KEEP (*(.zinitcall.app.service0.init))
137    KEEP (*(.zinitcall.app.service1.init))
138    KEEP (*(.zinitcall.app.service2.init))
139    KEEP (*(.zinitcall.app.service3.init))
140    KEEP (*(.zinitcall.app.service4.init))
141    __zinitcall_app_service_end = .;
142    __zinitcall_app_feature_start = .;
143    KEEP (*(.zinitcall.app.feature0.init))
144    KEEP (*(.zinitcall.app.feature1.init))
145    KEEP (*(.zinitcall.app.feature2.init))
146    KEEP (*(.zinitcall.app.feature3.init))
147    KEEP (*(.zinitcall.app.feature4.init))
148    __zinitcall_app_feature_end = .;
149    __zinitcall_test_start = .;
150    KEEP (*(.zinitcall.test0.init))
151    KEEP (*(.zinitcall.test1.init))
152    KEEP (*(.zinitcall.test2.init))
153    KEEP (*(.zinitcall.test3.init))
154    KEEP (*(.zinitcall.test4.init))
155    __zinitcall_test_end = .;
156    __zinitcall_exit_start = .;
157    KEEP (*(.zinitcall.exit0.init))
158    KEEP (*(.zinitcall.exit1.init))
159    KEEP (*(.zinitcall.exit2.init))
160    KEEP (*(.zinitcall.exit3.init))
161    KEEP (*(.zinitcall.exit4.init))
162    __zinitcall_exit_end = .;
163
164    KEEP (*(.init))
165    KEEP (*(.fini))
166
167    . = ALIGN(4);
168    _etext = .;        /* define a global symbols at end of code */
169  } >FLASH
170
171  /* Constant data goes into FLASH */
172  .rodata :
173  {
174    . = ALIGN(4);
175    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
176    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
177    . = ALIGN(4);
178  } >FLASH
179
180  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
181  .ARM : {
182    __exidx_start = .;
183    *(.ARM.exidx*)
184    __exidx_end = .;
185  } >FLASH
186
187  .preinit_array     :
188  {
189    PROVIDE_HIDDEN (__preinit_array_start = .);
190    KEEP (*(.preinit_array*))
191    PROVIDE_HIDDEN (__preinit_array_end = .);
192  } >FLASH
193  .init_array :
194  {
195    PROVIDE_HIDDEN (__init_array_start = .);
196    KEEP (*(SORT(.init_array.*)))
197    KEEP (*(.init_array*))
198    PROVIDE_HIDDEN (__init_array_end = .);
199  } >FLASH
200  .fini_array :
201  {
202    PROVIDE_HIDDEN (__fini_array_start = .);
203    KEEP (*(SORT(.fini_array.*)))
204    KEEP (*(.fini_array*))
205    PROVIDE_HIDDEN (__fini_array_end = .);
206  } >FLASH
207
208  /* used by the startup to initialize data */
209  _sidata = LOADADDR(.data);
210
211  /* Initialized data sections goes into RAM, load LMA copy after code */
212  .data :
213  {
214    . = ALIGN(4);
215    _sdata = .;        /* create a global symbol at data start */
216    KEEP (*(.vector))  /* make the vector at the data begining, and it will meet the needs of VTOR  */
217    *(.data)           /* .data sections */
218    *(.data*)          /* .data* sections */
219
220    . = ALIGN(4);
221    _edata = .;        /* define a global symbol at data end */
222  } >RAM AT> FLASH
223
224  _siccmram = LOADADDR(.ccmram);
225
226  /* CCM-RAM section
227  *
228  * IMPORTANT NOTE!
229  * If initialized variables will be placed in this section,
230  * the startup code needs to be modified to copy the init-values.
231  */
232  .ccmram :
233  {
234    . = ALIGN(4);
235    _sccmram = .;       /* create a global symbol at ccmram start */
236    *(.ccmram)
237    *(.ccmram*)
238
239    . = ALIGN(4);
240    _eccmram = .;       /* create a global symbol at ccmram end */
241  } >CCMRAM AT> FLASH
242
243
244  /* Uninitialized data section */
245  . = ALIGN(4);
246  .bss :
247  {
248    /* This is used by the startup in order to initialize the .bss secion */
249    _sbss = .;         /* define a global symbol at bss start */
250    __bss_start__ = _sbss;
251    *(.bss)
252    *(.bss*)
253    *(COMMON)
254
255    . = ALIGN(4);
256    _ebss = .;         /* define a global symbol at bss end */
257    __bss_end__ = _ebss;
258  } >RAM
259
260  . = ALIGN(0x40);
261  __los_heap_addr_start__ = .;
262  __los_heap_addr_end__ = ORIGIN(RAM) + LENGTH(RAM);
263  /* Remove information from the standard libraries */
264  /DISCARD/ :
265  {
266    libc.a ( * )
267    libm.a ( * )
268    libgcc.a ( * )
269  }
270
271  .ARM.attributes 0 : { *(.ARM.attributes) }
272}
273
274
275