2018-04-19 13:24:26 +02:00
|
|
|
/*
|
|
|
|
Linker script for the fx9860g platform. Most of the symbols defined
|
|
|
|
here are used in the initialization routine in core/start.c; others are
|
|
|
|
used in core/setup.c.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* fx9860g may mean SH3 or SH4 and we want full compatibility */
|
|
|
|
OUTPUT_ARCH(sh3)
|
|
|
|
/* ELF offers a lot of symbol/section/relocation insights */
|
|
|
|
OUTPUT_FORMAT(elf32-sh)
|
|
|
|
/* Located in core/start.c */
|
|
|
|
ENTRY(_start)
|
|
|
|
|
|
|
|
MEMORY
|
|
|
|
{
|
2020-06-15 20:55:18 +02:00
|
|
|
/* Userspace mapping of the add-in (G1A header takes 0x200 bytes) */
|
|
|
|
rom (rx): o = 0x00300200, l = 500k
|
2020-07-10 15:51:54 +02:00
|
|
|
/* This is mapped to RAM; 8k on SH3, 32k on SH4. Since gint uses the
|
|
|
|
last 2k for its VBR and mapped code, 6k are left */
|
|
|
|
ram (rw): o = 0x08100200, l = 6k
|
|
|
|
/* This is the VBR space. The [ram] region is mapped to 8801c000. This
|
|
|
|
region is used at load time and mentioned here for completeness */
|
|
|
|
vbr (rwx): o = 0x8801da00, l = 1536
|
|
|
|
/* These first bits of RAM are used for gint's perma-mapped code */
|
|
|
|
rram (rwx): o = 0x8801c000, l = 512
|
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 (including G1A header) */
|
|
|
|
_brom = 0x00300000;
|
|
|
|
/* Size of ROM mappings */
|
|
|
|
_srom = 0x200
|
|
|
|
+ SIZEOF(.text) + SIZEOF(.rodata)
|
|
|
|
+ SIZEOF(.gint.drivers) + SIZEOF(.gint.blocks);
|
|
|
|
|
|
|
|
/* Machine code going to ROM:
|
2020-06-20 17:18:51 +02:00
|
|
|
- Entry function (.text.entry)
|
2018-04-19 13:24:26 +02:00
|
|
|
- Compiler-provided constructors (.ctors) and destructors (.dtors)
|
|
|
|
- All text from .text and .text.* (including user code)
|
|
|
|
- Code sections from fxlib, named "C" and "P" */
|
|
|
|
|
2020-06-20 17:18:51 +02:00
|
|
|
.text : {
|
|
|
|
*(.text.entry)
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2020-06-20 17:18:51 +02:00
|
|
|
_bctors = . ;
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.ctors .ctors.*)
|
2020-06-20 17:18:51 +02:00
|
|
|
_ectors = . ;
|
|
|
|
|
|
|
|
_bdtors = . ;
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.dtors .dtors.*)
|
2020-06-20 17:18:51 +02:00
|
|
|
_edtors = . ;
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2020-06-15 20:55:18 +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.*)
|
|
|
|
*(C P)
|
|
|
|
} > rom
|
|
|
|
|
|
|
|
/* Interrupt handlers going to ROM:
|
|
|
|
- gint's interrupt handler blocks (.gint.blocks)
|
|
|
|
|
|
|
|
Although gint's blocks end up in VBR space, they are selected and
|
|
|
|
installed on-the-fly by the library and the drivers, so we can't
|
|
|
|
just put them in the vbr region and wait for the copy */
|
|
|
|
.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) {
|
2019-09-15 19:29:47 +02:00
|
|
|
/* Put these first, they need to be 4-aligned */
|
|
|
|
*(.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 stuff going to RAM:
|
|
|
|
- Data marked BSS by the compiler
|
|
|
|
- BSS sections from fxlib, namely "B" and "R"
|
|
|
|
The BSS section is to be stripped from the ELF file later, and wiped
|
|
|
|
at startup. */
|
|
|
|
.bss (NOLOAD) : {
|
|
|
|
_rbss = . ;
|
|
|
|
|
|
|
|
*(.bss COMMON)
|
|
|
|
*(B R)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ram :NONE
|
|
|
|
|
|
|
|
_sbss = SIZEOF(.bss);
|
|
|
|
|
|
|
|
/* Read-write data going to RAM:
|
|
|
|
- Data sections generated by the compiler (.data and .data.*)
|
2020-07-10 15:51:54 +02:00
|
|
|
- Data sections from fxlib, "D"
|
|
|
|
- Data sections from gint (.gint.data) */
|
2018-04-19 13:24:26 +02:00
|
|
|
.data ALIGN(4) : ALIGN(4) {
|
|
|
|
_ldata = LOADADDR(.data);
|
|
|
|
_rdata = . ;
|
|
|
|
|
|
|
|
*(.data .data.*)
|
|
|
|
*(D)
|
2020-07-10 15:51:54 +02:00
|
|
|
*(.gint.data .gint.data.sh3)
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
. = 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
|
|
|
|
2020-07-10 15:51:54 +02:00
|
|
|
/* gint's uninitialized BSS section */
|
|
|
|
.gint.bss (NOLOAD) : {
|
|
|
|
/* Since it's uninitialized, the location doesn't matter */
|
|
|
|
*(.gint.bss)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ram :NONE
|
|
|
|
|
|
|
|
_sgbss = SIZEOF(.gint.bss);
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
. = 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
|
|
|
** RRAM sections
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* VBR address: let's just start at the beginning of the RRAM 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-07-09 10:32:53 +02:00
|
|
|
_gint_vbr_fx9860g = ORIGIN(vbr) - 0x100;
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
. = ORIGIN(rram);
|
|
|
|
|
2020-07-10 15:51:54 +02:00
|
|
|
/* Code that must remain permanently mapped (.gint.mapped) */
|
2018-04-19 13:24:26 +02:00
|
|
|
.gint.data ALIGN(4) : ALIGN(4) {
|
|
|
|
_lgdata = LOADADDR(.gint.data);
|
|
|
|
_rgdata = . ;
|
|
|
|
|
2020-06-15 20:55:18 +02:00
|
|
|
/* Also code that must remain permanently mapped! */
|
|
|
|
*(.gint.mapped)
|
|
|
|
|
2018-04-19 13:24:26 +02:00
|
|
|
. = ALIGN(16);
|
|
|
|
} > rram AT> rom
|
|
|
|
|
|
|
|
_sgdata = SIZEOF(.gint.data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
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
|
|
|
- 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
|
|
|
|
- A stack section sometimes generated for build/version.o */
|
|
|
|
/DISCARD/ : {
|
2018-08-01 20:41:36 +02:00
|
|
|
*(.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)
|
|
|
|
}
|
|
|
|
}
|