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