2018-04-19 13:24:26 +02:00
|
|
|
/*
|
|
|
|
Linker script for fxcg50 add-ins. Most symbols are used in the startup
|
|
|
|
routine in core/start.c; some others in core/setup.c.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* All fxcg50 have SH4 processors (finally rid of compatibility issues) */
|
|
|
|
OUTPUT_ARCH(sh4)
|
|
|
|
/* ELF offers a lot of symbol/section/relocation insights */
|
|
|
|
OUTPUT_FORMAT(elf32-sh)
|
|
|
|
/* Located in core/start.c */
|
|
|
|
ENTRY(_start)
|
|
|
|
|
|
|
|
MEMORY
|
|
|
|
{
|
|
|
|
/* Userspace mapping of the add-in (without G3A header) */
|
2020-06-14 11:01:27 +02:00
|
|
|
rom (rx): o = 0x00300000, l = 2M
|
2018-04-19 13:24:26 +02:00
|
|
|
/* Static RAM; stack grows down from the end of this region.
|
|
|
|
The first 0x2000 bytes are reserved by gint, see below */
|
2020-06-18 09:59:31 +02:00
|
|
|
ram (rw): o = 0x08101400, l = 507k
|
|
|
|
/* gint's VBR space at the start of the user stack on fx-CG 50 and on
|
|
|
|
fx-CG 20. This address needs not be determined now because VBR code
|
|
|
|
is position-independent and stored in ROM so the linker doesn't even
|
|
|
|
need to know the value */
|
|
|
|
vbr50 (rwx): o = 0x8c160000, l = 5k
|
|
|
|
vbr20 (rwx): o = 0x88160000, l = 5k
|
2019-09-15 19:29:47 +02:00
|
|
|
/* On-chip IL memory */
|
|
|
|
ilram (rwx): o = 0xe5200000, l = 4k
|
|
|
|
/* On-chip X and Y memory */
|
|
|
|
xram (rwx): o = 0xe5007000, l = 8k
|
|
|
|
yram (rwx): o = 0xe5017000, l = 8k
|
2018-04-19 13:24:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
/*
|
2019-09-15 19:29:47 +02:00
|
|
|
** ROM sections
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* First address to be mapped to ROM */
|
|
|
|
_brom = 0x00300000;
|
|
|
|
/* Size of ROM mappings */
|
|
|
|
_srom = SIZEOF(.text) + SIZEOF(.rodata)
|
|
|
|
+ SIZEOF(.gint.drivers) + SIZEOF(.gint.blocks);
|
|
|
|
|
|
|
|
/* Machine code going to ROM:
|
|
|
|
- Initialization sections (.pretext.entry and .pretext)
|
|
|
|
- Compiler-provided constructors (.ctors) and destructors (.dtors)
|
|
|
|
- All text from .text and .text.* (including user code) */
|
|
|
|
.text : {
|
|
|
|
*(.pretext.entry)
|
|
|
|
*(.pretext)
|
|
|
|
|
|
|
|
_btors = . ;
|
|
|
|
*(.ctors .ctors.*)
|
|
|
|
_mtors = . ;
|
|
|
|
*(.dtors .dtors.*)
|
|
|
|
_etors = . ;
|
|
|
|
|
2020-06-14 18:22:20 +02:00
|
|
|
_gint_exch_start = . ;
|
|
|
|
*(.gint.exch)
|
|
|
|
_gint_exch_size = ABSOLUTE(. - _gint_exch_start);
|
|
|
|
|
|
|
|
_gint_tlbh_start = . ;
|
|
|
|
*(.gint.tlbh)
|
|
|
|
_gint_tlbh_size = ABSOLUTE(. - _gint_tlbh_start);
|
2019-09-03 22:15:00 +02:00
|
|
|
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.text .text.*)
|
|
|
|
} > rom
|
|
|
|
|
|
|
|
/* Interrupt handlers going to ROM:
|
|
|
|
- gint's interrupt handler blocks (.gint.blocks)
|
|
|
|
|
|
|
|
Although gint's blocks end up in VBR space, they are installed at
|
|
|
|
startup by the library/drivers, so we store them here for now */
|
|
|
|
.gint.blocks : {
|
|
|
|
KEEP(*(.gint.blocks));
|
|
|
|
} > rom
|
|
|
|
|
|
|
|
/* Driver data going to ROM:
|
|
|
|
- Exposed driver interfaces (.gint.drivers)
|
|
|
|
|
|
|
|
The driver information is required to start and configure the
|
|
|
|
driver, even if the symbols are not referenced */
|
|
|
|
.gint.drivers : {
|
|
|
|
_bdrv = . ;
|
2018-08-19 17:11:37 +02:00
|
|
|
KEEP(*(.gint.drivers.0));
|
|
|
|
KEEP(*(.gint.drivers.1));
|
|
|
|
KEEP(*(.gint.drivers.2));
|
|
|
|
KEEP(*(.gint.drivers.3));
|
|
|
|
KEEP(*(.gint.drivers.4));
|
|
|
|
KEEP(*(.gint.drivers.5));
|
|
|
|
KEEP(*(.gint.drivers.6));
|
2018-04-19 13:24:26 +02:00
|
|
|
_edrv = . ;
|
|
|
|
} > rom
|
|
|
|
|
|
|
|
/* Read-only data going to ROM:
|
|
|
|
- Resources or assets from fxconv or similar converters
|
|
|
|
- Data marked read-only by the compiler (.rodata and .rodata.*) */
|
|
|
|
.rodata : SUBALIGN(4) {
|
|
|
|
/* Put these first, they need to be 4-aligned */
|
2019-09-15 19:29:47 +02:00
|
|
|
*(.rodata.4)
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
*(.rodata .rodata.*)
|
|
|
|
} > rom
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2019-09-15 19:29:47 +02:00
|
|
|
** RAM sections
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
. = ORIGIN(ram);
|
|
|
|
|
|
|
|
/* BSS data going to RAM. The BSS section is to be stripped from the
|
|
|
|
ELF file later, and wiped at startup */
|
|
|
|
.bss (NOLOAD) : {
|
|
|
|
_rbss = . ;
|
|
|
|
|
|
|
|
*(.bss COMMON)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ram :NONE
|
|
|
|
|
|
|
|
_sbss = SIZEOF(.bss);
|
|
|
|
|
2020-02-23 15:49:55 +01:00
|
|
|
/* Read-write data sections going to RAM (.data and .data.*) */
|
2018-04-19 13:24:26 +02:00
|
|
|
.data ALIGN(4) : ALIGN(4) {
|
|
|
|
_ldata = LOADADDR(.data);
|
|
|
|
_rdata = . ;
|
|
|
|
|
|
|
|
*(.data .data.*)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ram AT> rom
|
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
/* Read-write data sub-aligned to 4 bytes (mainly from fxconv) */
|
|
|
|
.data.4 : SUBALIGN(4) {
|
|
|
|
*(.data.4)
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ram AT> rom
|
|
|
|
|
|
|
|
_sdata = SIZEOF(.data) + SIZEOF(.data.4);
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2019-09-15 19:29:47 +02:00
|
|
|
/* On-chip memory sections: IL, X and Y memory */
|
|
|
|
|
|
|
|
. = ORIGIN(ilram);
|
|
|
|
.ilram ALIGN(4) : ALIGN(4) {
|
|
|
|
_lilram = LOADADDR(.ilram);
|
|
|
|
_rilram = . ;
|
|
|
|
|
|
|
|
*(.ilram)
|
2020-06-15 20:55:18 +02:00
|
|
|
/* Code that must remain mapped is placed here */
|
|
|
|
*(.gint.mapped)
|
2019-09-15 19:29:47 +02:00
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ilram AT> rom
|
|
|
|
|
|
|
|
. = ORIGIN(xram);
|
|
|
|
.xram ALIGN(4) : ALIGN(4) {
|
|
|
|
_lxram = LOADADDR(.xram);
|
|
|
|
_rxram = . ;
|
|
|
|
|
|
|
|
*(.xram)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > xram AT> rom
|
|
|
|
|
|
|
|
. = ORIGIN(yram);
|
|
|
|
.yram ALIGN(4) : ALIGN(4) {
|
|
|
|
_lyram = LOADADDR(.yram);
|
|
|
|
_ryram = . ;
|
|
|
|
|
|
|
|
*(.yram)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > yram AT> rom
|
|
|
|
|
|
|
|
_silram = SIZEOF(.ilram);
|
|
|
|
_sxram = SIZEOF(.xram);
|
|
|
|
_syram = SIZEOF(.yram);
|
|
|
|
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2019-09-15 19:29:47 +02:00
|
|
|
** gint-related sections
|
2020-02-23 15:49:55 +01:00
|
|
|
** 8c160000:5k VBR space
|
|
|
|
** 8c161400:3k .gint.data and .gint.bss
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* VBR address: let's just start at the beginning of the RAM area.
|
|
|
|
There's an unused 0x100-byte gap at the start of the VBR space.
|
|
|
|
The VBR space is already a large block (> 2 kiB), so I'm cutting off
|
|
|
|
the gap to spare some memory */
|
2020-06-18 09:59:31 +02:00
|
|
|
_gint_vbr_fxcg50 = ORIGIN(vbr50) - 0x100;
|
|
|
|
_gint_vbr_fxcg20 = ORIGIN(vbr20) - 0x100;
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2020-06-18 09:59:31 +02:00
|
|
|
. = ORIGIN(ram) + _sbss + _sdata;
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
/* gint's data section, going to static RAM. This section contains many
|
|
|
|
small objects from the library (static/global variables, etc) */
|
|
|
|
.gint.data ALIGN(4) : ALIGN(4) {
|
|
|
|
_lgdata = LOADADDR(.gint.data);
|
|
|
|
_rgdata = . ;
|
|
|
|
|
|
|
|
*(.gint.data .gint.data.*)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
2020-06-18 09:59:31 +02:00
|
|
|
} > ram AT> rom
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
_sgdata = SIZEOF(.gint.data);
|
|
|
|
|
|
|
|
/* gint's uninitialized BSS section, going to static RAM. All the large
|
|
|
|
data arrays will be located here */
|
|
|
|
.gint.bss (NOLOAD) : {
|
|
|
|
/* Since it's uninitialized, the location doesn't matter */
|
|
|
|
*(.gint.bss .gint.bss.*)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
2020-06-18 09:59:31 +02:00
|
|
|
} > ram :NONE
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
_sgbss = SIZEOF(.gint.bss);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2019-09-15 19:29:47 +02:00
|
|
|
** Other sections
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Unwanted sections going to meet Dave Null:
|
2018-08-01 20:41:36 +02:00
|
|
|
- SH3-only data sections
|
|
|
|
- Debug sections, often come out of libgcc
|
2020-06-15 20:55:18 +02:00
|
|
|
- Java classes registration (why is there any of this here?)
|
2018-04-19 13:24:26 +02:00
|
|
|
- Asynchronous unwind tables: no C++ exception handling for now ^^
|
|
|
|
- Comments or anything the compiler might put in its assembler */
|
|
|
|
/DISCARD/ : {
|
2018-08-01 20:41:36 +02:00
|
|
|
*(.gint.bss.sh3)
|
|
|
|
*(.gint.data.sh3)
|
|
|
|
|
|
|
|
*(.debug_info .debug_abbrev .debug_loc .debug_aranges
|
|
|
|
.debug_ranges .debug_line .debug_str)
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.jcr)
|
|
|
|
*(.eh_frame_hdr)
|
|
|
|
*(.eh_frame)
|
|
|
|
*(.comment)
|
|
|
|
}
|
|
|
|
}
|