Files
game-and-watch-zelda3/STM32H7B0VBTx_FLASH.ld
2023-08-06 23:11:03 +02:00

438 lines
13 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>&copy; 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 = 0x20020000; /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
/* Useful for scripts */
__NULLPTR_LENGTH__ = 0x100;
__ITCMRAM_LENGTH__ = 64K;
__DTCMRAM_LENGTH__ = 128K;
__RAM_LENGTH__ = 1024K;
__RAM_UC_LENGTH__ = 300K;
__RAM_CORE_LENGTH__ = 68K;
__RAM_EMU_LENGTH__ = __RAM_LENGTH__ - __RAM_UC_LENGTH__ - __RAM_CORE_LENGTH__;
__AHBRAM_LENGTH__ = 128K;
__FLASH_LENGTH__ = 256K; /* Both banks are 256KB */
__INTFLASH__ = DEFINED(__INTFLASH__) ? __INTFLASH__ : 0x08000000;
__EXTFLASH_TOTAL_LENGTH__ = DEFINED(__EXTFLASH_TOTAL_LENGTH__) ? __EXTFLASH_TOTAL_LENGTH__ : 1024K;
__EXTFLASH_OFFSET__ = DEFINED(__EXTFLASH_OFFSET__) ? __EXTFLASH_OFFSET__ : 0;
__EXTFLASH_BASE__ = 0x90000000; /* Beginning of addressable extflash addresses */
__EXTFLASH_START__ = __EXTFLASH_BASE__ + __EXTFLASH_OFFSET__; /* Beginning of where we're going to store emulator and rom data */
__SAVEFLASH_LENGTH__ = 8192 + (ENABLE_SAVESTATE ? (4096 * 68) : 0);
__CONFIGFLASH_LENGTH__ = 4096;
__FBFLASH_LENGTH__ = ENABLE_SCREENSHOT ? ((320 * 240 * 2 + 4095) / 4096) * 4096 : 0;
__EXTFLASH_LENGTH__ = __EXTFLASH_TOTAL_LENGTH__ - (__SAVEFLASH_LENGTH__ + __CONFIGFLASH_LENGTH__ + __FBFLASH_LENGTH__);
__EXTFLASH_END__ = __EXTFLASH_START__ + __EXTFLASH_LENGTH__;
__SAVEFLASH_START__ = __EXTFLASH_END__;
__SAVEFLASH_END__ = __SAVEFLASH_START__ + __SAVEFLASH_LENGTH__;
__CONFIGFLASH_START__ = __SAVEFLASH_END__;
__CONFIGFLASH_END__ = __CONFIGFLASH_START__ + __CONFIGFLASH_LENGTH__;
__FBFLASH_START__ = __CONFIGFLASH_END__;
__FBFLASH_END__ = __FBFLASH_START__ + __FBFLASH_LENGTH__;
__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__;
__RAM_EMU_END__ = __RAM_EMU_START__ + __RAM_EMU_LENGTH__;
/* Specify the memory areas */
MEMORY
{
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 1024K
AHBRAM (xrw) : ORIGIN = 0x30000000, LENGTH = 128K
/* + 32KB of AHB RAM IN SRD DOMAIN @ 0x38000000 ? */
/* + 4KB of Backup RAM @ 0x38800000 ? */
FLASH (xr ) : ORIGIN = __INTFLASH__, 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__
FBFLASH(xr ) : ORIGIN = __FBFLASH_START__, LENGTH = __FBFLASH_LENGTH__
}
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
__flash_start__ = LOADADDR(.isr_vector);
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >RAM
__load_to_ram__ = .; /* Reserve space for .text to be loaded into beginning of ram */
_sitcram_hot = LOADADDR(._itcram_hot);
__extflash_start__ = LOADADDR(._itcram_hot);
._itcram_hot :
{
__itcram_start__ = .;
. = ALIGN(4);
__itcram_hot_start__ = .;
build/dma.o (.text .text*)
build/dsp.o (.text .text*)
build/messaging.o (.text .text*)
build/misc.o (.text .text*)
build/player_oam.o (.text .text*)
build/poly.o (.text .text*)
build/ppu.o (.text .text*)
build/zelda_rtl.o (.text .text*)
. = ALIGN(4);
__itcram_hot_end__ = .;
__itcram_end__ = .;
} >ITCMRAM AT> EXTFLASH
/* Copied from flash to ram at boot */
_sdtcram_hot = LOADADDR(._dtcram_hot);
._dtcram_hot :
{
__dtcram_start__ = .;
. = ALIGN(4);
__dtcram_hot_start__ = .;
build/dma.o (.rodata .rodata*)
build/dsp.o (.rodata .rodata*)
build/messaging.o (.rodata .rodata*)
build/misc.o (.rodata .rodata*)
build/player_oam.o (.rodata .rodata*)
build/poly.o (.rodata .rodata*)
build/ppu.o (.rodata .rodata*)
build/sprite_main.o (.rodata .rodata*)
build/zelda_rtl.o (.rodata .rodata*)
. = ALIGN(4);
__dtcram_hot_end__ = .;
} >DTCMRAM AT> EXTFLASH
._persistent (NOLOAD) :
{
. = ALIGN(8);
*(.persistent)
. = ALIGN(8);
} >DTCMRAM
. = ALIGN(4);
._spc_player_bss :
{
. = ALIGN(4);
__dtcram_bss_start__ = .;
build/spc_player.o (.bss .bss*) /* 64 KB of APU RAM */
*(.savestate_buffer) /* DTCMRAM would probably be better used for something else */
. = ALIGN(4);
__dtcram_bss_end__ = .;
} >DTCMRAM
/* Copied from flash to ram at boot */
_sahbram_hot = LOADADDR(._ahbram_hot);
._ahbram_hot :
{
__ahbram_start__ = .;
. = ALIGN(4);
__ahbram_hot_start__ = .;
build/ancilla.o (.text .text* .rodata .rodata*)
build/nmi.o (.text .text* .rodata .rodata*)
build/overlord.o (.text .text* .rodata .rodata*)
build/spc_player.o (.text .text* .rodata .rodata*)
build/tagalong.o (.text .text* .rodata .rodata*)
build/tile_detect.o (.text .text* .rodata .rodata*)
. = ALIGN(4);
__ahbram_hot_end__ = .;
__ahbram_end__ = .;
} >AHBRAM AT> EXTFLASH
__high_ram__ = 0x2402d000;
_siramdata = LOADADDR(._ram_exec);
._ram_exec __high_ram__ :
{
__ram_start__ = .;
. = ALIGN(4);
__ram_exec_start__ = .;
build/attract.o (.text .text* .rodata .rodata*)
build/hud.o (.text .text* .rodata .rodata*)
build/load_gfx.o (.text .text* .rodata .rodata*)
build/overworld.o (.text .text* .rodata .rodata*)
build/player.o (.text .text* .rodata .rodata*)
build/select_file.o (.text .text* .rodata .rodata*)
build/sprite.o (.text .text* .rodata .rodata*)
build/sprite_main.o (.text .text*)
build/zelda_assets_in_ram.o (.text .text* .rodata .rodata*)
. = ALIGN(4);
__ram_exec_end__ = .;
} >RAM AT> EXTFLASH
/* Uninitialized data section */
__high_ram__ = .;
.bss __high_ram__ :
{
. = ALIGN(4);
/* 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;
} >RAM
/* User_heap_stack section, used to check that there is enough RAM left */
__high_ram__ = .;
._user_heap_stack __high_ram__ :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
__ram_end__ = .;
} >RAM
._extflash :
{
. = ALIGN(4);
_extflash = .;
build/opus_decoder_amalgam.o (.text .text* .rodata .rodata*)
build/zelda_assets_in_extflash.o (.text .text* .rodata .rodata*)
__extflash_end__ = .;
} >EXTFLASH
__extflash_end__ = __extflash_start__ + SIZEOF(._itcram_hot) + SIZEOF(._dtcram_hot) + SIZEOF(._ahbram_hot) + SIZEOF(._ram_exec) + SIZEOF(._extflash);
._saveflash (NOLOAD) :
{
__saveflash_start__ = .;
*(.saveflash)
__saveflash_end__ = .;
} > SAVEFLASH
._configflash (NOLOAD):
{
. = ALIGN(4K);
__configflash_start__ = .;
*(.configflash)
__configflash_end__ = .;
} > CONFIGFLASH
._fbflash (NOLOAD):
{
. = ALIGN(4K);
__fbflash_start__ = .;
*(.fbflash)
__fbflash_end__ = .;
} > FBFLASH
/* The rest of program code and other data goes into INTFLASH */
__low_ram__ = __load_to_ram__;
.text __low_ram__ :
{
. = 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 */
} >RAM
/* Constant data goes into FLASH */
__low_ram__ = .;
.rodata __low_ram__ :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >RAM
__low_ram__ = .;
.ARM.extab __low_ram__ : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
__low_ram__ = .;
.ARM __low_ram__ : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >RAM
__low_ram__ = .;
.preinit_array __low_ram__ :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >RAM
__low_ram__ = .;
.init_array __low_ram__ :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >RAM
__low_ram__ = .;
.fini_array __low_ram__ :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >RAM
/* 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 */
__dtcram_end__ = .;
} >DTCMRAM AT> RAM
__flash_end__ = __flash_start__ + SIZEOF(.isr_vector) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ARM.extab) + SIZEOF(.ARM) + SIZEOF(.preinit_array) + SIZEOF(.init_array) + SIZEOF(.fini_array) + SIZEOF(.data);
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}