forked from bzhxx/game-and-watch-retro-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
STM32H7B0VBTx_FLASH.ld
493 lines (436 loc) · 13.9 KB
/
STM32H7B0VBTx_FLASH.ld
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
/*
******************************************************************************
**
** File : LinkerScript.ld
**
** Author : Auto-generated by System Workbench for STM32
**
** Abstract : Linker script for STM32H7B0VBTx series
** 128Kbytes FLASH and 1216Kbytes 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
**
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
**
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
** 1. Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** 3. Neither the name of STMicroelectronics nor the names of its contributors
** may be used to endorse or promote products derived from this software
** without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
*****************************************************************************
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = _stack_top; /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Heap_Size = 32 * 1024; /* required amount of heap */
_Stack_Redzone_Size = 256; /* size of stack overflow protection */
_Min_Stack_Size = 20 * 1024; /* required amount of stack */
/* Useful for scripts */
__NULLPTR_LENGTH__ = 0x100;
__ITCMRAM_LENGTH__ = 64K;
__DTCMRAM_LENGTH__ = 128K;
__RAM_UC_LENGTH__ = 300K;
__RAM_CORE_LENGTH__ = 68K;
__RAM_EMU_LENGTH__ = 1024K - __RAM_UC_LENGTH__ - __RAM_CORE_LENGTH__;
__AHBRAM_LENGTH__ = 128K;
__FLASH_LENGTH__ = 128K;
__EXTFLASH_START__ = 0x90000000;
__RAM_START__ = 0x24000000;
__RAM_UC_START__ = __RAM_START__;
__RAM_CORE_START__ = __RAM_START__ + __RAM_UC_LENGTH__;
__RAM_EMU_START__ = __RAM_CORE_START__ + __RAM_CORE_LENGTH__;
/* saveflash.ld sets __SAVEFLASH_LENGTH__ */
INCLUDE build/saveflash.ld
/* saveflash.ld sets __SAVEFLASH_LENGTH__ */
__CONFIGFLASH_LENGTH__ = 4096;
__EXTFLASH_LENGTH__ = DEFINED(__EXTFLASH_TOTAL_LENGTH__) ? __EXTFLASH_TOTAL_LENGTH__ - (__CONFIGFLASH_LENGTH__ + __SAVEFLASH_LENGTH__) : 1024K - (__CONFIGFLASH_LENGTH__ + __SAVEFLASH_LENGTH__);
__SAVEFLASH_START__ = __EXTFLASH_START__ + __EXTFLASH_LENGTH__;
__SAVEFLASH_END__ = __SAVEFLASH_START__ + __SAVEFLASH_LENGTH__;
__CONFIGFLASH_START__ = __SAVEFLASH_START__ + __SAVEFLASH_LENGTH__;
__CONFIGFLASH_END__ = __CONFIGFLASH_START__ + __CONFIGFLASH_LENGTH__;
/* Specify the memory areas */
MEMORY
{
/* RAM */
NULLPTR (xrw) : ORIGIN = 0x00000000, LENGTH = __NULLPTR_LENGTH__
ITCMRAM (xrw) : ORIGIN = 0x00000000 + __NULLPTR_LENGTH__, LENGTH = __ITCMRAM_LENGTH__ - __NULLPTR_LENGTH__
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = __DTCMRAM_LENGTH__
RAM_UC (xrw) : ORIGIN = __RAM_UC_START__, LENGTH = __RAM_UC_LENGTH__
RAM (xrw) : ORIGIN = __RAM_CORE_START__, LENGTH = __RAM_CORE_LENGTH__
RAM_EMU (xrw) : ORIGIN = __RAM_EMU_START__, LENGTH = __RAM_EMU_LENGTH__
AHBRAM (xrw) : ORIGIN = 0x30000000, LENGTH = __AHBRAM_LENGTH__
/* FLASH */
FLASH (xr ) : ORIGIN = 0x08000000, LENGTH = __FLASH_LENGTH__
EXTFLASH (xr ) : ORIGIN = __EXTFLASH_START__, LENGTH = __EXTFLASH_LENGTH__
SAVEFLASH(xr ) : ORIGIN = __SAVEFLASH_START__, LENGTH = __SAVEFLASH_LENGTH__
CONFIGFLASH(xr ) : ORIGIN = __CONFIGFLASH_START__, LENGTH = __CONFIGFLASH_LENGTH__
}
/* Define output sections */
SECTIONS
{
._itcram :
{
__itcram_start__ = .;
. = ALIGN(4);
*(.itcram_data)
. = ALIGN(4);
*(.itcram_text)
. = ALIGN(4);
} > ITCMRAM
/* Copied from flash to ram at boot */
_sitcram_hot = LOADADDR(._itcram_hot);
._itcram_hot :
{
__itcram_hot_start__ = .;
. = ALIGN(4);
*(.itcram_hot_data)
. = ALIGN(4);
*(.itcram_hot_text)
. = ALIGN(4);
__itcram_hot_end__ = .;
__itcram_end__ = .;
} >ITCMRAM AT> EXTFLASH
/* Uncached and unbuffered memory for the LCD framebuffers */
._ram_uc (NOLOAD) :
{
__ram_uc_start__ = .;
. = ALIGN(4);
*(.lcd)
__ram_uc_end__ = .;
} > RAM_UC
/* Data that should be copied from extflash to axiram */
/* used by the startup to initialize data */
_siramdata = LOADADDR(._ram_exec);
__extflash_start__ = LOADADDR(._ram_exec);
._ram_exec :
{
__ram_start__ = .;
__ram_exec_start__ = .;
. = ALIGN(4);
_sram_text = .;
*(.ram_text)
_eram_text = .;
_sram_data = .;
*(.ram_data)
_eram_data = .;
__ram_exec_end__ = .;
} >RAM AT> EXTFLASH
._extflash :
{
. = ALIGN(4);
__extflash_nes_start__ = .;
build/rom_*.o (.text .text* .rodata .rodata*)
. = ALIGN(4);
build/core/lupng.o (.text .text* .rodata .rodata*)
. = ALIGN(4);
build/core/logo*.o (.text .text* .rodata .rodata*)
. = ALIGN(4);
build/core/header*.o (.text .text* .rodata .rodata*)
. = ALIGN(4);
__extflash_end_start__ = .;
. = ALIGN(4);
__extflash_text_start__ = .;
*(.extflash_text)
. = ALIGN(4);
__extflash_text_end__ = .;
__extflash_data_start__ = .;
. = ALIGN(4);
*(.extflash_data)
. = ALIGN(4);
__extflash_data_end__ = .;
. = ALIGN(4K);
__extflash_game_rom_start__ = .;
*(.extflash_game_rom)
__extflash_game_rom_end__ = .;
} > EXTFLASH
.overlay_nes __RAM_EMU_START__ : {
. = ALIGN(4);
__ram_emu_nes_start__ = .;
build/nes/*.o (.data. data* .text .text* .rodata .rodata*)
. = ALIGN(4);
_OVERLAY_NES_LOAD_END = .;
} AT> EXTFLASH
_OVERLAY_NES_LOAD_START = LOADADDR(.overlay_nes);
_OVERLAY_NES_SIZE = SIZEOF(.overlay_nes);
.overlay_nes_bss _OVERLAY_NES_LOAD_END : {
. = ALIGN(4);
_OVERLAY_NES_BSS_START = .;
build/nes/*.o (.bss .bss*)
. = ALIGN(4);
build/nes/*.o (COMMON)
. = ALIGN(4);
_NES_ROM_UNPACK_BUFFER = .;
_OVERLAY_NES_BSS_END = .;
__ram_emu_nes_end__ = .;
}
_OVERLAY_NES_BSS_SIZE = SIZEOF(.overlay_nes_bss);
_NES_ROM_UNPACK_BUFFER_SIZE = __RAM_EMU_START__ + __RAM_EMU_LENGTH__ - _NES_ROM_UNPACK_BUFFER;
.overlay_gb __RAM_EMU_START__ : {
. = ALIGN(4);
__ram_emu_gb_start__ = .;
build/gnuboy/*.o (.data .data* .text .text* .rodata .rodata*)
. = ALIGN(4);
_OVERLAY_GB_LOAD_END = .;
} AT> EXTFLASH
_OVERLAY_GB_LOAD_START = LOADADDR(.overlay_gb);
_OVERLAY_GB_SIZE = SIZEOF(.overlay_gb);
.overlay_gb_bss _OVERLAY_GB_LOAD_END : {
. = ALIGN(4);
_OVERLAY_GB_BSS_START = .;
build/gnuboy/*.o (COMMON)
. = ALIGN(4);
build/gnuboy/*.o (.bss .bss*)
_GB_ROM_UNPACK_BUFFER = .;
_OVERLAY_GB_BSS_END = .;
__ram_emu_gb_end__ = .;
}
_OVERLAY_GB_BSS_SIZE = SIZEOF(.overlay_gb_bss);
_GB_ROM_UNPACK_BUFFER_SIZE = __RAM_EMU_START__ + __RAM_EMU_LENGTH__ - _GB_ROM_UNPACK_BUFFER;
.overlay_sms __RAM_EMU_START__ : {
. = ALIGN(4);
__ram_emu_sms_start__ = .;
build/smsplusgx/*.o (.data. data* .text .text* .rodata .rodata*)
. = ALIGN(4);
_OVERLAY_SMS_LOAD_END = .;
} AT> EXTFLASH
_OVERLAY_SMS_LOAD_START = LOADADDR(.overlay_sms);
_OVERLAY_SMS_SIZE = SIZEOF(.overlay_sms);
.overlay_sms_bss _OVERLAY_SMS_LOAD_END : {
. = ALIGN(4);
_OVERLAY_SMS_BSS_START = .;
build/smsplusgx/*.o (.bss .bss*)
. = ALIGN(4);
build/smsplusgx/*.o (COMMON)
__ram_emu_sms_end__ = .;
_OVERLAY_SMS_BSS_END = .;
}
_OVERLAY_SMS_BSS_SIZE = SIZEOF(.overlay_sms_bss);
.overlay_pce __RAM_EMU_START__ : {
. = ALIGN(4);
__ram_emu_pce_start__ = .;
build/pce/*.o (.data. data* .text .text* .rodata .rodata*)
. = ALIGN(4);
_OVERLAY_PCE_LOAD_END = .;
} AT> EXTFLASH
_OVERLAY_PCE_LOAD_START = LOADADDR(.overlay_pce);
_OVERLAY_PCE_SIZE = SIZEOF(.overlay_pce);
.overlay_pce_bss _OVERLAY_PCE_LOAD_END : {
. = ALIGN(4);
_OVERLAY_PCE_BSS_START = .;
build/pce/*.o (.bss .bss*)
. = ALIGN(4);
build/pce/*.o (COMMON)
__ram_emu_pce_end__ = .;
_OVERLAY_PCE_BSS_END = .;
}
_OVERLAY_PCE_BSS_SIZE = SIZEOF(.overlay_pce_bss);
.overlay_gw __RAM_EMU_START__ : {
. = ALIGN(4);
__ram_emu_gw_start__ = .;
build/gw/*.o (.data. data* .text .text* .rodata .rodata*)
. = ALIGN(4);
_OVERLAY_GW_LOAD_END = .;
} AT> EXTFLASH
_OVERLAY_GW_LOAD_START = LOADADDR(.overlay_gw);
_OVERLAY_GW_SIZE = SIZEOF(.overlay_gw);
.overlay_gw_bss _OVERLAY_GW_LOAD_END : {
. = ALIGN(4);
_OVERLAY_GW_BSS_START = .;
build/gw/*.o (.bss .bss*)
. = ALIGN(4);
build/gw/*.o (COMMON)
_OVERLAY_GW_BSS_END = .;
__ram_emu_gw_end__ = .;
}
_OVERLAY_GW_BSS_SIZE = SIZEOF(.overlay_gw_bss);
/* Place this symbol after the last overlay definition */
.overlay_end : {
__extflash_end__ = .;
} AT> EXTFLASH
._ram_space_check_pce : {
. = . + SIZEOF(.overlay_pce);
. = . + SIZEOF(.overlay_pce_bss);
} >RAM_EMU
._saveflash (NOLOAD) :
{
__saveflash_start__ = .;
*(.saveflash)
__saveflash_end__ = .;
} > SAVEFLASH
._configflash (NOLOAD):
{
. = ALIGN(4K);
__configflash_start__ = .;
*(.configflash)
__configflash_end__ = .;
} > CONFIGFLASH
._ram (NOLOAD) :
{
. = ALIGN(4);
*(.emulator_data)
__ram_end__ = .;
} > RAM
._ahbram (NOLOAD) :
{
__ahbram_start__ = .;
. = ALIGN(4);
*(.audio)
*(.ahb)
. = ALIGN(4);
__ahbram_end__ = .;
} > AHBRAM
/* The startup code goes first into FLASH */
.isr_vector :
{
__flash_start__ = .;
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
*(.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
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections goes into RAM, load LMA copy after code */
.data :
{
__dtcram_start__ = .;
. = 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
._flash_end :
{
. = ALIGN(4);
__flash_end__ = .;
}
/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_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
._persistent (NOLOAD) :
{
. = ALIGN(8);
*(.persistent)
. = ALIGN(8);
} >DTCMRAM
._user_heap :
{
. = ALIGN(16);
_heap_start = . ;
. = . + _Heap_Size;
. = ALIGN(16);
_heap_end = . ;
} >DTCMRAM
/* User_heap_stack section, used to check that there is enough RAM left */
._user_stack :
{
/* Pad the unused area between the last symbol and the start of the redzone */
__dtc_padding_start__ = .;
. = . + __DTCMRAM_LENGTH__ - (_Min_Stack_Size + _Stack_Redzone_Size) - (__dtc_padding_start__ - __dtcram_start__);
__dtc_padding_end__ = .;
_stack_redzone = .;
. = . + _Stack_Redzone_Size;
_stack_bottom = .;
. = . + _Min_Stack_Size;
_stack_top = .;
__dtcram_end__ = .;
} >DTCMRAM
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}