mirror of
https://github.com/marian-m12l/game-and-watch-zelda3.git
synced 2025-12-17 07:16:05 +01:00
534 lines
16 KiB
Plaintext
534 lines
16 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 = 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__ = 256K;
|
|
__RAM_CORE_LENGTH__ = __RAM_LENGTH__ - __RAM_UC_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_END__ = __RAM_CORE_START__ + __RAM_CORE_LENGTH__;
|
|
|
|
|
|
|
|
|
|
|
|
/* Specify the memory areas */
|
|
MEMORY
|
|
{
|
|
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
|
|
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
|
RAM_UC (xrw) : ORIGIN = __RAM_UC_START__, LENGTH = __RAM_UC_LENGTH__
|
|
RAM_CORE (xrw) : ORIGIN = __RAM_CORE_START__, LENGTH = __RAM_CORE_LENGTH__
|
|
AHBRAM (xrw) : ORIGIN = 0x30000000, LENGTH = 128K
|
|
|
|
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
|
|
{
|
|
|
|
|
|
|
|
/*********************************************/
|
|
/****************** EXTFLASH *****************/
|
|
/*********************************************/
|
|
|
|
|
|
/***** Loaded from EXTFLASH into ITCMRAM *****/
|
|
|
|
_sitcram_hot = LOADADDR(._itcram_hot);
|
|
._itcram_hot :
|
|
{
|
|
. = 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__ = .;
|
|
} >ITCMRAM AT> EXTFLASH
|
|
|
|
|
|
/***** Loaded from EXTFLASH into DTCMRAM *****/
|
|
|
|
_sdtcram_hot = LOADADDR(._dtcram_hot);
|
|
._dtcram_hot :
|
|
{
|
|
. = 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
|
|
|
|
|
|
/****** Loaded from EXTFLASH into AHBRAM *****/
|
|
|
|
_sahbram_hot = LOADADDR(._ahbram_hot);
|
|
._ahbram_hot :
|
|
{
|
|
. = 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 AT> EXTFLASH
|
|
|
|
|
|
/******* Loaded from EXTFLASH into RAM *******/
|
|
|
|
_siramdata = LOADADDR(._ram_exec);
|
|
._ram_exec :
|
|
{
|
|
. = 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_CORE AT> EXTFLASH
|
|
|
|
|
|
/************* Stored in EXTFLASH ************/
|
|
|
|
._extflash :
|
|
{
|
|
. = ALIGN(4);
|
|
build/opus_decoder_amalgam.o (.text .text* .rodata .rodata*)
|
|
build/zelda_assets_in_extflash.o (.text .text* .rodata .rodata*)
|
|
} >EXTFLASH
|
|
|
|
._saveflash (NOLOAD) :
|
|
{
|
|
*(.saveflash)
|
|
} > SAVEFLASH
|
|
|
|
._configflash (NOLOAD):
|
|
{
|
|
*(.configflash)
|
|
} > CONFIGFLASH
|
|
|
|
._fbflash (NOLOAD):
|
|
{
|
|
*(.fbflash)
|
|
} > FBFLASH
|
|
|
|
|
|
/*********************************************/
|
|
/********************* RAM *******************/
|
|
/*********************************************/
|
|
|
|
|
|
/********* Reserved area in DTCMRAM **********/
|
|
|
|
._persistent (NOLOAD) :
|
|
{
|
|
. = ALIGN(8);
|
|
*(.persistent)
|
|
. = ALIGN(8);
|
|
} >DTCMRAM
|
|
|
|
|
|
/***** Uninitialized variables in 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
|
|
|
|
|
|
/******* Uninitialized variables in RAM ******/
|
|
|
|
. = 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;
|
|
} >RAM_CORE
|
|
|
|
|
|
/* 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);
|
|
} >RAM_CORE
|
|
|
|
|
|
/*********************************************/
|
|
/****************** INTFLASH *****************/
|
|
/*********************************************/
|
|
|
|
|
|
/***** ISR vector comes first in INTFLASH ****/
|
|
|
|
.isr_vector_bootloader :
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
KEEP(build/startup_bootloader_stm32h7b0xx.o(.isr_vector_bootloader)) /* Startup code */
|
|
. = ALIGN(4);
|
|
|
|
} >FLASH
|
|
|
|
|
|
/***** Bootloader code stored in INTFLASH ****/
|
|
|
|
.text.bootloader :
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
build/startup_bootloader_stm32h7b0xx.o(.text)
|
|
build/startup_bootloader_stm32h7b0xx.o(.text*)
|
|
. = ALIGN(4);
|
|
|
|
} >FLASH
|
|
|
|
|
|
/** Bootloader constants stored in INTFLASH **/
|
|
|
|
.rodata.bootloader :
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
build/startup_bootloader_stm32h7b0xx.o(.rodata)
|
|
build/startup_bootloader_stm32h7b0xx.o(.rodata*)
|
|
. = ALIGN(4);
|
|
|
|
} >FLASH
|
|
|
|
|
|
/***** Bootloader data stored in INTFLASH ****/
|
|
|
|
.data.bootloader :
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
build/startup_bootloader_stm32h7b0xx.o(.data)
|
|
build/startup_bootloader_stm32h7b0xx.o(.data*)
|
|
. = ALIGN(4);
|
|
|
|
} >FLASH
|
|
|
|
|
|
/* Reserved area in INTFLASH for RAM application payload */
|
|
|
|
.payload.bootloader :
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
__payload_start__ = .;
|
|
. += __ramapp_length__;
|
|
KEEP (*(.nope))
|
|
__payload_end__ = .;
|
|
. = ALIGN(4);
|
|
|
|
} >FLASH
|
|
|
|
|
|
/*********************************************/
|
|
/*************** RAM APPLICATION *************/
|
|
/*********************************************/
|
|
|
|
|
|
/******* ISR vector comes first in RAM *******/
|
|
|
|
.isr_vector_ram :
|
|
{
|
|
. = ALIGN(4);
|
|
KEEP(build/startup_stm32h7b0xx.o(.isr_vector)) /* Startup code */
|
|
. = ALIGN(4);
|
|
} >RAM_UC
|
|
|
|
|
|
/*** Rest of program code is stored in RAM ***/
|
|
|
|
.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 */
|
|
} >RAM_UC
|
|
|
|
|
|
/******* Constant data is stored in RAM ******/
|
|
|
|
.rodata :
|
|
{
|
|
. = ALIGN(4);
|
|
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
|
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
|
. = ALIGN(4);
|
|
} >RAM_UC
|
|
|
|
|
|
/* Needed for exception handling / frame stacks */
|
|
|
|
.ARM.extab :
|
|
{
|
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
|
} >RAM_UC
|
|
|
|
.ARM : {
|
|
__exidx_start = .;
|
|
*(.ARM.exidx*)
|
|
__exidx_end = .;
|
|
} >RAM_UC
|
|
|
|
|
|
/* Functions arrays for (pre-)initialization and termination */
|
|
|
|
.preinit_array :
|
|
{
|
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
KEEP (*(.preinit_array*))
|
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
} >RAM_UC
|
|
.init_array :
|
|
{
|
|
PROVIDE_HIDDEN (__init_array_start = .);
|
|
KEEP (*(SORT(.init_array.*)))
|
|
KEEP (*(.init_array*))
|
|
PROVIDE_HIDDEN (__init_array_end = .);
|
|
} >RAM_UC
|
|
.fini_array :
|
|
{
|
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
KEEP (*(SORT(.fini_array.*)))
|
|
KEEP (*(.fini_array*))
|
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
|
} >RAM_UC
|
|
|
|
|
|
/* FIXME just keep it in RAM ??? --> move other stuff to DTCMRAM ??? */
|
|
/******* Loaded from RAM into DTCMRAM *******/
|
|
|
|
_sidata = LOADADDR(.data);
|
|
.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> RAM_UC
|
|
|
|
|
|
/* Remove information from the standard libraries */
|
|
|
|
/DISCARD/ :
|
|
{
|
|
libc.a ( * )
|
|
libm.a ( * )
|
|
libgcc.a ( * )
|
|
}
|
|
|
|
.ARM.attributes 0 : { *(.ARM.attributes) }
|
|
|
|
|
|
/*********************************************/
|
|
/****************** SYMBOLS ******************/
|
|
/*********************************************/
|
|
|
|
__itcram_start__ = ADDR(._itcram_hot);
|
|
__itcram_end__ = __itcram_start__ + SIZEOF(._itcram_hot);
|
|
|
|
__dtcram_start__ = ADDR(._dtcram_hot);
|
|
__dtcram_end__ = __dtcram_start__ + SIZEOF(._dtcram_hot) + SIZEOF(._persistent) + SIZEOF(._spc_player_bss) + SIZEOF(.data);
|
|
|
|
__ahbram_start__ = ADDR(._ahbram_hot);
|
|
__ahbram_end__ = __ahbram_start__ + SIZEOF(._ahbram_hot);
|
|
|
|
__ram_uc_start__ = ADDR(.isr_vector_ram);
|
|
__ram_uc_end__ = __ram_uc_start__ + SIZEOF(.isr_vector_ram) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ARM.extab) + SIZEOF(.ARM) + SIZEOF(.preinit_array) + SIZEOF(.init_array) + SIZEOF(.fini_array) + SIZEOF(.data);
|
|
|
|
__ram_core_start__ = ADDR(._ram_exec);
|
|
__ram_core_end__ = __ram_core_start__ + SIZEOF(._ram_exec) + SIZEOF(.bss) + SIZEOF(._user_heap_stack);
|
|
|
|
__ramapp_start__ = LOADADDR(.isr_vector_ram);
|
|
__ramapp_length__ = SIZEOF(.isr_vector_ram) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ARM.extab) + SIZEOF(.ARM) + SIZEOF(.preinit_array) + SIZEOF(.init_array) + SIZEOF(.fini_array) + SIZEOF(.data);
|
|
__ramapp_end__ = __ramapp_start__ + __ramapp_length__;
|
|
|
|
__extflash_start__ = LOADADDR(._itcram_hot);
|
|
__extflash_end__ = __extflash_start__ + SIZEOF(._itcram_hot) + SIZEOF(._dtcram_hot) + SIZEOF(._ahbram_hot) + SIZEOF(._ram_exec) + SIZEOF(._extflash);
|
|
|
|
__saveflash_start__ = ADDR(._saveflash);
|
|
__saveflash_end__ = __saveflash_start__ + SIZEOF(._saveflash);
|
|
|
|
__configflash_start__ = ADDR(._configflash);
|
|
__configflash_end__ = __configflash_start__ + SIZEOF(._configflash);
|
|
|
|
__fbflash_start__ = ADDR(._fbflash);
|
|
__fbflash_end__ = __fbflash_start__ + SIZEOF(._fbflash);
|
|
|
|
__flash_start__ = LOADADDR(.isr_vector_bootloader);
|
|
__flash_end__ = __flash_start__ + SIZEOF(.isr_vector_bootloader) + SIZEOF(.text.bootloader) + SIZEOF(.rodata.bootloader) + SIZEOF(.data.bootloader) + SIZEOF(.payload.bootloader);
|
|
|
|
}
|
|
|
|
|