-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTM32H723ZGTX_FLASH.ld
More file actions
354 lines (301 loc) · 9.17 KB
/
STM32H723ZGTX_FLASH.ld
File metadata and controls
354 lines (301 loc) · 9.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
/*
******************************************************************************
**
** File : LinkerScript.ld
**
** Author : STM32CubeIDE
**
** Abstract : Linker script for STM32H7 series
** 1024Kbytes FLASH and 560Kbytes RAM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
** Set memory bank area and size if external memory is used.
**
** Target : STMicroelectronics STM32
**
** Distribution: The file is distributed as is, without any warranty
** of any kind.
**
*****************************************************************************
** @attention
**
** Copyright (c) 2022 STMicroelectronics.
** All rights reserved.
**
** This software is licensed under terms that can be found in the LICENSE file
** in the root directory of this software component.
** If no LICENSE file comes with this software, it is provided AS-IS.
**
****************************************************************************
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_sstack = ORIGIN(DTCMRAM);
_estack = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM); /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM/DTCM */
_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K-128K-128K
FLASH_ST (rx) : ORIGIN = 0x080C0000, LENGTH = 128K
FLASH_BT (rx) : ORIGIN = 0x080E0000, LENGTH = 128K
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K
}
/* Define output sections */
SECTIONS
{
/* Export Memory Layout Information for MPU Configuration */
__itcm_base = ABSOLUTE(ORIGIN(ITCMRAM));
__itcm_size = ABSOLUTE(LENGTH(ITCMRAM));
__dtcm_base = ABSOLUTE(ORIGIN(DTCMRAM));
__dtcm_size = ABSOLUTE(LENGTH(DTCMRAM));
__flash_base = ABSOLUTE(ORIGIN(FLASH));
__flash_size = ABSOLUTE(LENGTH(FLASH));
__ram_d1_base = ABSOLUTE(ORIGIN(RAM_D1));
__ram_d1_size = ABSOLUTE(LENGTH(RAM_D1));
__ram_d2_base = ABSOLUTE(ORIGIN(RAM_D2));
__ram_d2_size = ABSOLUTE(LENGTH(RAM_D2));
__ram_d3_base = ABSOLUTE(ORIGIN(RAM_D3));
__ram_d3_size = ABSOLUTE(LENGTH(RAM_D3));
__peripheral_base = 0x40000000;
__peripheral_size = 0x20000000; /* 512MB */
/* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
_stext = .;
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
/* Constant data goes into FLASH */
.rodata :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >FLASH
.hardfault_stack (NOLOAD) : /*Stack memory to avoid memfault inside hardfault handler*/
{
. = ALIGN(8);
_hf_stack_start = .;
. += 0x400; /* 1 KB */
_hf_stack_end = .;
} >DTCMRAM
.ARM.extab (READONLY): { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM (READONLY): {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
.preinit_array (READONLY):
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH
.init_array (READONLY):
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH
.fini_array (READONLY):
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH
/* MPU D1 Non-Cached Section: Placed at start of RAM_D1 for alignment */
.mpu_ram_d1_nc (NOLOAD) :
{
. = ALIGN(32);
__mpu_d1_nc_start = ABSOLUTE(.);
/* New MPU system buffers */
*(.mpu_ram_d1_nc.buffer)
/* User manual allocations via D1_NC macro */
*(.mpu_ram_d1_nc.user)
/* Ethernet Rx Pool */
. = ALIGN(32);
*(.Rx_PoolSection)
} >RAM_D1
/* CALCULATE PADDING FOR MPU SUBREGIONS (D1) */
_d1_size = SIZEOF(.mpu_ram_d1_nc);
/* Find next power of 2 (up to 512KB for 320KB RAM) */
_d1_p2 = (1 << LOG2CEIL(MAX(32, _d1_size)));
/* Subregion size is RegionSize / 8 */
_d1_sub = _d1_p2 / 8;
/* Align effective size to the subregion granularity */
_d1_pad = (_d1_size + _d1_sub - 1) / _d1_sub * _d1_sub;
/* Advance current pointer to reserve this space */
. = __mpu_d1_nc_start + _d1_pad;
__mpu_d1_nc_end = ABSOLUTE(.);
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections goes into RAM, load LMA copy after code */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >DTCMRAM AT> FLASH
/*
.hard_fault_log has to be the first thing in the FLASH_ST
*/
.hardfault_log :
{
. = ALIGN(4);
hf_log = .;
KEEP(*(.hardfault_log));
. += 0x200;
} >FLASH_ST
. = ALIGN(4);
.metadata_pool :
{
. = ALIGN(4);
metadata = .;
KEEP(*(.metadata_pool))
. += 0x100;
} >FLASH_ST
PROVIDE(_metadata = metadata);
PROVIDE(_hf_log = hf_log);
/* Uninitialized data section */
. = ALIGN(4);
.bss (NOLOAD) :
{
/* This is used by the startup in order to initialize the .bss section */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >DTCMRAM
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >DTCMRAM
/* MPU D2 Non-Cached Section: Contains Ethernet Descriptors and Generic Buffers */
.mpu_ram_d2_nc (NOLOAD) :
{
. = ALIGN(32);
__mpu_d2_nc_start = ABSOLUTE(.);
/* ETH Descriptors - Must be aligned */
*(.RxDecripSection)
*(.TxDecripSection)
/* New MPU system buffers */
*(.mpu_ram_d2_nc.buffer)
/* User manual allocations via D2_NC macro */
*(.mpu_ram_d2_nc.user)
} >RAM_D2
/* CALCULATE PADDING FOR MPU SUBREGIONS (D2) */
_d2_size = SIZEOF(.mpu_ram_d2_nc);
/* Find next power of 2 (up to 64KB for 32KB RAM to catch overflow logic if needed) */
_d2_p2 = (1 << LOG2CEIL(MAX(32, _d2_size)));
_d2_sub = _d2_p2 / 8;
_d2_pad = (_d2_size + _d2_sub - 1) / _d2_sub * _d2_sub;
. = __mpu_d2_nc_start + _d2_pad;
__mpu_d2_nc_end = ABSOLUTE(.);
/* MPU D3 Non-Cached Section */
.mpu_ram_d3_nc (NOLOAD) :
{
. = ALIGN(32);
__mpu_d3_nc_start = ABSOLUTE(.);
/* New MPU system buffers */
*(.mpu_ram_d3_nc.buffer)
/* Legacy MPUManager allocations */
*(.mpu_ram_d3_nc.legacy)
/* User manual allocations via D3_NC macro */
*(.mpu_ram_d3_nc.user)
} >RAM_D3
/* CALCULATE PADDING FOR MPU SUBREGIONS (D3) */
_d3_size = SIZEOF(.mpu_ram_d3_nc);
/* Find next power of 2 (up to 32KB for 16KB RAM) */
_d3_p2 = (1 << LOG2CEIL(MAX(32, _d3_size)));
_d3_sub = _d3_p2 / 8;
_d3_pad = (_d3_size + _d3_sub - 1) / _d3_sub * _d3_sub;
. = __mpu_d3_nc_start + _d3_pad;
__mpu_d3_nc_end = ABSOLUTE(.);
/* Code running in ITCM RAM (0 Wait States, Instruction Bus) */
.ram_code :
{
. = ALIGN(4);
_sram_code = .;
*(.ram_code)
*(.ram_code*)
. = ALIGN(4);
_eram_code = .;
} >ITCMRAM AT> FLASH
_siram_code = LOADADDR(.ram_code);
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
/* MPU D1 Cached Section */
.ram_d1 (NOLOAD) :
{
. = ALIGN(32);
/* User manual allocations via D1_C macro */
*(.ram_d1.user)
/* New MPU system buffers */
*(.ram_d1.buffer)
} >RAM_D1
/* MPU D2 Cached Section */
.ram_d2 (NOLOAD) :
{
. = ALIGN(32);
/* User manual allocations via D2_C macro */
*(.ram_d2.user)
/* New MPU system buffers */
*(.ram_d2.buffer)
} >RAM_D2
/* MPU D3 Cached Section */
.ram_d3 (NOLOAD) :
{
. = ALIGN(32);
/* User manual allocations via D3_C macro */
*(.ram_d3.user)
/* New MPU system buffers */
*(.ram_d3.buffer)
} >RAM_D3
}