1- /* * Copyright © 2021 The Things Industries B.V.
2- *
3- * Licensed under the Apache License, Version 2.0 (the "License");
4- * you may not use this file except in compliance with the License.
5- * You may obtain a copy of the License at
6- *
7- * http://www.apache.org/licenses/LICENSE-2.0
8- *
9- * Unless required by applicable law or agreed to in writing, software
10- * distributed under the License is distributed on an "AS IS" BASIS,
11- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12- * See the License for the specific language governing permissions and
13- * limitations under the License.
1+ /*
2+ ******************************************************************************
3+ **
4+ ** File : ldscript.ld
5+ **
6+ ** Author : STM32CubeIDE
7+ **
8+ ** Abstract : Linker script for STM32WL55xC Device
9+ ** 256Kbytes FLASH
10+ ** 64Kbytes 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>© Copyright (c) 2021 STMicroelectronics.
26+ ** All rights reserved.</center></h2>
27+ **
28+ ** This software component is licensed by ST under BSD 3-Clause license,
29+ ** the "License"; You may not use this file except in compliance with the
30+ ** License. You may obtain a copy of the License at:
31+ ** opensource.org/licenses/BSD-3-Clause
32+ **
33+ *****************************************************************************
1434*/
1535
1636/* Entry Point */
1737ENTRY (Reset_Handler)
1838
1939/* Highest address of the user mode stack */
20- _estack = ORIGIN(RAM1 ) + LENGTH(RAM1 ); /* end of "SRAM1 " Ram type memory */
40+ _estack = ORIGIN(RAM ) + LENGTH(RAM ); /* end of "RAM " Ram type memory */
2141
22- _Min_Heap_Size = 0x400 ; /* required amount of heap */
23- _Min_Stack_Size = 0x800 ; /* required amount of stack */
42+ _Min_Heap_Size = 0x200 ; /* required amount of heap */
43+ _Min_Stack_Size = 0x400 ; /* required amount of stack */
2444
2545/* Memories definition */
2646MEMORY
2747{
28- ROM (rx) : ORIGIN = 0x08000000 , LENGTH = 256K /* Flash memory dedicated to CM4 */
29- RAM1 (xrw) : ORIGIN = 0x20000000 , LENGTH = 32K /* Non-backup SRAM1 dedicated to CM4 */
30- RAM2 (xrw) : ORIGIN = 0x20008000 , LENGTH = 32K /* Backup SRAM2 dedicated to CM4 */
48+ RAM (xrw) : ORIGIN = 0x20000000 , LENGTH = LD_MAX_DATA_SIZE
49+ FLASH (rx) : ORIGIN = 0x08000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
3150}
3251
3352/* Sections */
3453SECTIONS
3554{
36- /* The startup code into "ROM " Rom type memory */
55+ /* The startup code into "FLASH " Rom type memory */
3756 .isr_vector :
3857 {
39- . = ALIGN (8 );
58+ . = ALIGN (4 );
4059 KEEP (*(.isr_vector )) /* Startup code */
41- . = ALIGN (8 );
42- } >ROM
60+ . = ALIGN (4 );
61+ } >FLASH
4362
44- /* The program code and other data into "ROM " Rom type memory */
63+ /* The program code and other data into "FLASH " Rom type memory */
4564 .text :
4665 {
47- . = ALIGN (8 );
66+ . = ALIGN (4 );
4867 *(.text ) /* .text sections (code) */
4968 *(.text *) /* .text* sections (code) */
5069 *(.glue_7 ) /* glue arm to thumb code */
@@ -54,80 +73,82 @@ SECTIONS
5473 KEEP (*(.init ))
5574 KEEP (*(.fini ))
5675
57- . = ALIGN (8 );
76+ . = ALIGN (4 );
5877 _etext = .; /* define a global symbols at end of code */
59- } >ROM
78+ } >FLASH
6079
61- /* Constant data into "ROM " Rom type memory */
80+ /* Constant data into "FLASH " Rom type memory */
6281 .rodata :
6382 {
64- . = ALIGN (8 );
83+ . = ALIGN (4 );
6584 *(.rodata ) /* .rodata sections (constants, strings, etc.) */
6685 *(.rodata *) /* .rodata* sections (constants, strings, etc.) */
67- . = ALIGN (8 );
68- } >ROM
86+ . = ALIGN (4 );
87+ } >FLASH
6988
7089 .ARM.extab : {
71- . = ALIGN (8 );
90+ . = ALIGN (4 );
7291 *(.ARM .extab * .gnu .linkonce .armextab .*)
73- . = ALIGN (8 );
74- } >ROM
92+ . = ALIGN (4 );
93+ } >FLASH
7594
7695 .ARM : {
77- . = ALIGN (8 );
96+ . = ALIGN (4 );
7897 __exidx_start = .;
7998 *(.ARM .exidx *)
8099 __exidx_end = .;
81- . = ALIGN (8 );
82- } >ROM
100+ . = ALIGN (4 );
101+ } >FLASH
83102
84103 .preinit_array :
85104 {
86- . = ALIGN (8 );
105+ . = ALIGN (4 );
87106 PROVIDE_HIDDEN (__preinit_array_start = .);
88107 KEEP (*(.preinit_array *))
89108 PROVIDE_HIDDEN (__preinit_array_end = .);
90- . = ALIGN (8 );
91- } >ROM
109+ . = ALIGN (4 );
110+ } >FLASH
92111
93112 .init_array :
94113 {
95- . = ALIGN (8 );
114+ . = ALIGN (4 );
96115 PROVIDE_HIDDEN (__init_array_start = .);
97116 KEEP (*(SORT (.init_array .*)))
98117 KEEP (*(.init_array *))
99118 PROVIDE_HIDDEN (__init_array_end = .);
100- . = ALIGN (8 );
101- } >ROM
119+ . = ALIGN (4 );
120+ } >FLASH
102121
103122 .fini_array :
104123 {
105- . = ALIGN (8 );
124+ . = ALIGN (4 );
106125 PROVIDE_HIDDEN (__fini_array_start = .);
107126 KEEP (*(SORT (.fini_array .*)))
108127 KEEP (*(.fini_array *))
109128 PROVIDE_HIDDEN (__fini_array_end = .);
110- . = ALIGN (8 );
111- } >ROM
129+ . = ALIGN (4 );
130+ } >FLASH
112131
113132 /* Used by the startup to initialize data */
114133 _sidata = LOADADDR (.data );
115134
116- /* Initialized data sections into "SRAM1 " Ram type memory */
135+ /* Initialized data sections into "RAM " Ram type memory */
117136 .data :
118137 {
119- . = ALIGN (8 );
138+ . = ALIGN (4 );
120139 _sdata = .; /* create a global symbol at data start */
121140 *(.data ) /* .data sections */
122141 *(.data *) /* .data* sections */
142+ *(.RamFunc ) /* .RamFunc sections */
143+ *(.RamFunc *) /* .RamFunc* sections */
123144
124- . = ALIGN (8 );
145+ . = ALIGN (4 );
125146 _edata = .; /* define a global symbol at data end */
126147
127- } >RAM1 AT> ROM
148+ } >RAM AT> FLASH
128149
129- /* Uninitialized data section into "SRAM1 " Ram type memory */
130- . = ALIGN (8 );
150+ /* Uninitialized data section into "RAM " Ram type memory */
151+ . = ALIGN (4 );
131152 .bss :
132153 {
133154 /* This is used by the startup in order to initialize the .bss section */
@@ -137,34 +158,12 @@ SECTIONS
137158 *(.bss *)
138159 *(COMMON)
139160
140- . = ALIGN (8 );
161+ . = ALIGN (4 );
141162 _ebss = .; /* define a global symbol at bss end */
142163 __bss_end__ = _ebss;
143- } >RAM1
144-
145- /* Data section into "SRAM1" Ram type memory: Non-backup SRAM1 dedicated to CM4 */
146- . = ALIGN (8 );
147- RAM1_region :
148- {
149- _sRAM1_region = .; /* define a global symbol at section start */
150- *(.RAM1_region )
151-
152- . = ALIGN (8 );
153- _eRAM1_region = .; /* define a global symbol at section end */
154- } >RAM1
155-
156- /* Data section into "SRAM2" Ram type memory: Backup SRAM2 dedicated to CM4 */
157- . = ALIGN (8 );
158- RAM2_region :
159- {
160- _sRAM2_region = .; /* define a global symbol at section start */
161- *(.RAM2_region )
162-
163- . = ALIGN (8 );
164- _eRAM2_region = .; /* define a global symbol at section end */
165- } >RAM2
164+ } >RAM
166165
167- /* User_heap_stack section, used to check that there is enough "SRAM1 " Ram type memory left */
166+ /* User_heap_stack section, used to check that there is enough "RAM " Ram type memory left */
168167 ._user_heap_stack :
169168 {
170169 . = ALIGN (8 );
@@ -173,8 +172,7 @@ SECTIONS
173172 . = . + _Min_Heap_Size;
174173 . = . + _Min_Stack_Size;
175174 . = ALIGN (8 );
176- __RAM_segment_used_end__ = .;
177- } >RAM1
175+ } >RAM
178176
179177 /* Remove information from the compiler libraries */
180178 /DISCARD/ :
0 commit comments