1
- /**
2
- ******************************************************************************
3
- * @file STM32L476RG_FLASH.h
4
- * @author WI6LABS
5
- * @version V1.0.0
6
- * @date 15-February-2016
7
- * @brief Linker script for STM32L476RG Device with
8
- * 256KByte FLASH, 32KByte RAM
9
- *
10
- * Set heap size, stack size and stack location according
11
- * to application requirements.
12
- *
13
- * Set memory bank area and size if external memory is used.
14
- *
15
- ******************************************************************************
16
- * @attention
17
- *
18
- * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
19
- *
20
- * Redistribution and use in source and binary forms, with or without modification,
21
- * are permitted provided that the following conditions are met :
22
- * 1. Redistributions of source code must retain the above copyright notice,
23
- * this list of conditions and the following disclaimer.
24
- * 2. Redistributions in binary form must reproduce the above copyright notice,
25
- * this list of conditions and the following disclaimer in the documentation
26
- * and/or other materials provided with the distribution.
27
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
28
- * may be used to endorse or promote products derived from this software
29
- * without specific prior written permission.
30
- *
31
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
35
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
38
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
39
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41
- *
42
- ******************************************************************************
43
- */
1
+ /*
2
+ *****************************************************************************
3
+ **
4
+
5
+ ** File : LinkerScript.ld
6
+ **
7
+ ** Abstract : Linker script for STM32L432KCUx Device with
8
+ ** 256KByte FLASH, 64KByte RAM
9
+ **
10
+ ** Set heap size, stack size and stack location according
11
+ ** to application requirements.
12
+ **
13
+ ** Set memory bank area and size if external memory is used.
14
+ **
15
+ ** Target : STMicroelectronics STM32
16
+ **
17
+ **
18
+ ** Distribution : The file is distributed as is, without any warranty
19
+ ** of any kind.
20
+ **
21
+ ** (c )Copyright Ac6.
22
+ ** You may use this file as-is or modify it according to the needs of your
23
+ ** project. Distribution of this file (unmodified or modified) is not
24
+ ** permitted. Ac6 permit registered System Workbench for MCU users the
25
+ ** rights to distribute the assembled, compiled & linked contents of this
26
+ ** file as part of an application binary file, provided that it is built
27
+ ** using the System Workbench for MCU toolchain.
28
+ **
29
+ *****************************************************************************
30
+ */
44
31
45
32
/* Entry Point */
46
33
ENTRY (Reset_Handler )
47
34
48
35
/* Highest address of the user mode stack */
49
- _estack = 0x20017FFF ; /* end of RAM */
36
+ _estack = 0x2000c000 ; /* end of RAM */
50
37
/* Generate a link error if heap and stack don't fit into RAM */
51
- _Min_Heap_Size = 0x200;; /* required amount of heap */
52
- _Min_Stack_Size = 0x400;; /* required amount of stack */
38
+ _Min_Heap_Size = 0x200; /* required amount of heap */
39
+ _Min_Stack_Size = 0x400; /* required amount of stack */
53
40
54
41
/* Specify the memory areas */
55
42
MEMORY
56
43
{
57
- FLASH (rx ) : ORIGIN = 0x8000000, LENGTH = 1024K
58
- RAM (xrw ) : ORIGIN = 0x20000000, LENGTH = 96K
44
+ FLASH (rx ) : ORIGIN = 0x08000000, LENGTH = 256K
45
+ RAM (xrw ) : ORIGIN = 0x20000000, LENGTH = 48K
46
+ SRAM2 (rw ) : ORIGIN = 0x10000000, LENGTH = 16K
59
47
}
60
48
61
49
/* Define output sections */
@@ -64,15 +52,15 @@ SECTIONS
64
52
/* The startup code goes first into FLASH */
65
53
.isr_vector :
66
54
{
67
- . = ALIGN (4 );
55
+ . = ALIGN (8 );
68
56
KEEP(*(.isr_vector)) /* Startup code */
69
- . = ALIGN (4 );
57
+ . = ALIGN (8 );
70
58
} >FLASH
71
59
72
60
/* The program code and other data goes into FLASH */
73
61
.text :
74
62
{
75
- . = ALIGN (4 );
63
+ . = ALIGN (8 );
76
64
*(.text) /* .text sections (code) */
77
65
*(.text*) /* .text* sections (code) */
78
66
*(.glue_7) /* glue arm to thumb code */
@@ -82,45 +70,59 @@ SECTIONS
82
70
KEEP (*(.init))
83
71
KEEP (*(.fini))
84
72
85
- . = ALIGN (4 );
73
+ . = ALIGN (8 );
86
74
_etext = .; /* define a global symbols at end of code */
87
75
} >FLASH
88
76
89
77
/* Constant data goes into FLASH */
90
- .rodata ALIGN (4) :
78
+ .rodata :
91
79
{
92
- . = ALIGN (4 );
80
+ . = ALIGN (8 );
93
81
*(.rodata) /* .rodata sections (constants, strings, etc.) */
94
82
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
95
- . = ALIGN (4 );
83
+ . = ALIGN (8 );
96
84
} >FLASH
97
85
98
- .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
86
+ .ARM.extab :
87
+ {
88
+ . = ALIGN (8);
89
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
90
+ . = ALIGN (8);
91
+ } >FLASH
99
92
.ARM : {
93
+ . = ALIGN (8);
100
94
__exidx_start = .;
101
95
*(.ARM.exidx*)
102
96
__exidx_end = .;
97
+ . = ALIGN (8);
103
98
} >FLASH
104
99
105
100
.preinit_array :
106
101
{
102
+ . = ALIGN (8);
107
103
PROVIDE_HIDDEN (__preinit_array_start = .);
108
104
KEEP (*(.preinit_array*))
109
105
PROVIDE_HIDDEN (__preinit_array_end = .);
106
+ . = ALIGN (8);
110
107
} >FLASH
108
+
111
109
.init_array :
112
110
{
111
+ . = ALIGN (8);
113
112
PROVIDE_HIDDEN (__init_array_start = .);
114
113
KEEP (*(SORT(.init_array.*)))
115
114
KEEP (*(.init_array*))
116
115
PROVIDE_HIDDEN (__init_array_end = .);
116
+ . = ALIGN (8);
117
117
} >FLASH
118
118
.fini_array :
119
119
{
120
+ . = ALIGN (8);
120
121
PROVIDE_HIDDEN (__fini_array_start = .);
121
122
KEEP (*(SORT(.fini_array.*)))
122
123
KEEP (*(.fini_array*))
123
124
PROVIDE_HIDDEN (__fini_array_end = .);
125
+ . = ALIGN (8);
124
126
} >FLASH
125
127
126
128
/* used by the startup to initialize data */
@@ -129,15 +131,34 @@ SECTIONS
129
131
/* Initialized data sections goes into RAM, load LMA copy after code */
130
132
.data :
131
133
{
132
- . = ALIGN (4 );
134
+ . = ALIGN (8 );
133
135
_sdata = .; /* create a global symbol at data start */
134
136
*(.data) /* .data sections */
135
137
*(.data*) /* .data* sections */
136
138
137
- . = ALIGN (4 );
139
+ . = ALIGN (8 );
138
140
_edata = .; /* define a global symbol at data end */
139
141
} >RAM AT> FLASH
140
142
143
+ _sisram2 = LOADADDR (.sram2);
144
+
145
+ /* CCM-RAM section
146
+ *
147
+ * IMPORTANT NOTE!
148
+ * If initialized variables will be placed in this section,
149
+ * the startup code needs to be modified to copy the init-values.
150
+ */
151
+ .sram2 :
152
+ {
153
+ . = ALIGN (8);
154
+ _ssram2 = .; /* create a global symbol at sram2 start */
155
+ *(.sram2)
156
+ *(.sram2*)
157
+
158
+ . = ALIGN (8);
159
+ _esram2 = .; /* create a global symbol at sram2 end */
160
+ } >SRAM2 AT> FLASH
161
+
141
162
142
163
/* Uninitialized data section */
143
164
. = ALIGN (4);
@@ -158,12 +179,12 @@ SECTIONS
158
179
/* User_heap_stack section, used to check that there is enough RAM left */
159
180
._user_heap_stack :
160
181
{
161
- . = ALIGN (4 );
182
+ . = ALIGN (8 );
162
183
PROVIDE ( end = . );
163
184
PROVIDE ( _end = . );
164
185
. = . + _Min_Heap_Size;
165
186
. = . + _Min_Stack_Size;
166
- . = ALIGN (4 );
187
+ . = ALIGN (8 );
167
188
} >RAM
168
189
169
190
0 commit comments