mirror of
https://github.com/kbeckmann/game-and-watch-retro-go.git
synced 2025-12-16 13:15:55 +01:00
495 lines
14 KiB
Plaintext
495 lines
14 KiB
Plaintext
/*
|
|
******************************************************************************
|
|
**
|
|
|
|
** 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_EMU_LENGTH__ = 1024K - __RAM_UC_LENGTH__;
|
|
__AHBRAM_LENGTH__ = 128K;
|
|
__FLASH_LENGTH__ = 256K; /* bank1 */
|
|
__FLASH2_LENGTH__ = 256K; /* bank2 */
|
|
|
|
__EXTFLASH_OFFSET__ = DEFINED(__EXTFLASH_OFFSET__) ? __EXTFLASH_OFFSET__ : 0;
|
|
__EXTFLASH_START__ = 0x90000000 + __EXTFLASH_OFFSET__;
|
|
|
|
__RAM_START__ = 0x24000000;
|
|
__RAM_UC_START__ = __RAM_START__;
|
|
__RAM_EMU_START__ = __RAM_START__ + __RAM_UC_LENGTH__;
|
|
|
|
__RAM_EMU_END__ = __RAM_EMU_START__ + __RAM_EMU_LENGTH__;
|
|
__RAM_END__ = 0x24000000 + 1024K;
|
|
|
|
/* 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_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__
|
|
FLASH2 (xr ) : ORIGIN = 0x08100000, LENGTH = __FLASH2_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);
|
|
*(.lcd1)
|
|
*(.lcd2)
|
|
__ram_uc_end__ = .;
|
|
} > RAM_UC
|
|
|
|
__extflash_start__ = LOADADDR(._extflash);
|
|
._extflash :
|
|
{
|
|
. = 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_snes_ro_start__ = .;
|
|
build/snes9x/*.o (.text .text* .rodata .rodata*)
|
|
__extflash_snes_ro_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__ = .;
|
|
ASSERT(ABSOLUTE(_OVERLAY_NES_BSS_END) < __RAM_EMU_END__, "Error: NES BSS overflow");
|
|
}
|
|
_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__ = .;
|
|
ASSERT(ABSOLUTE(_OVERLAY_GB_BSS_END) < __RAM_EMU_END__, "Error: GB BSS overflow");
|
|
}
|
|
_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 = .;
|
|
ASSERT(ABSOLUTE(_OVERLAY_SMS_BSS_END) < __RAM_EMU_END__, "Error: SMS BSS overflow");
|
|
}
|
|
_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 = .;
|
|
ASSERT(ABSOLUTE(_OVERLAY_PCE_BSS_END) < __RAM_EMU_END__, "Error: PCE BSS overflow");
|
|
}
|
|
_OVERLAY_PCE_BSS_SIZE = SIZEOF(.overlay_pce_bss);
|
|
|
|
.overlay_snes __RAM_EMU_START__ : {
|
|
. = ALIGN(4);
|
|
__ram_emu_snes_start__ = .;
|
|
build/snes9x/*.o (.data .data*)
|
|
|
|
*(.snes_hot4)
|
|
|
|
. = ALIGN(4);
|
|
_OVERLAY_SNES_LOAD_END = .;
|
|
} AT> EXTFLASH
|
|
_OVERLAY_SNES_LOAD_START = LOADADDR(.overlay_snes);
|
|
_OVERLAY_SNES_SIZE = SIZEOF(.overlay_snes);
|
|
|
|
.overlay_snes_bss _OVERLAY_SNES_LOAD_END : {
|
|
. = ALIGN(4);
|
|
_OVERLAY_SNES_BSS_START = .;
|
|
build/snes9x/*.o (COMMON)
|
|
. = ALIGN(4);
|
|
build/snes9x/*.o (.bss .bss*)
|
|
_SNES_ROM_UNPACK_BUFFER = .;
|
|
_OVERLAY_SNES_BSS_END = .;
|
|
__ram_emu_snes_end__ = .;
|
|
ASSERT(ABSOLUTE(_OVERLAY_SNES_BSS_END) < __RAM_EMU_END__, "Error: SNES BSS overflow");
|
|
}
|
|
_OVERLAY_SNES_BSS_SIZE = SIZEOF(.overlay_snes_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
|
|
|
|
._ahbram (NOLOAD) :
|
|
{
|
|
__ahbram_start__ = .;
|
|
. = ALIGN(4);
|
|
*(.audio)
|
|
. = ALIGN(4);
|
|
*(.ahb)
|
|
. = ALIGN(4);
|
|
*(.emulator_data)
|
|
. = 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))
|
|
|
|
*(.snes_hot3)
|
|
|
|
. = 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__ = .;
|
|
}
|
|
|
|
/* put *fast access* SNES read only stuff on the second bank */
|
|
.flash2 :
|
|
{
|
|
__flash2_start__ = .;
|
|
. = ALIGN(4);
|
|
*(.snes_hot2)
|
|
__flash2_end__ = .;
|
|
} >FLASH2
|
|
|
|
/* 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) }
|
|
} |