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