vxKernel/boards/fxcg50/fxcg50.ld

213 lines
5.4 KiB
Plaintext
Raw Normal View History

/*
Linker script for the fxcg50 platform.
*/
OUTPUT_FORMAT("elf32-sh", "elf32-sh", "elf32-sh")
OUTPUT_ARCH(sh4)
ENTRY(_initialize)
/*
** Linker script for user executables.
*/
MEMORY
{
/* virtual memory, read-write segment */
userram (WX) : o = 0x00000000, l = 1M
VxKernel 0.6.0-13 : Add keyboard API + update timer API @add <> include/vhex/driver/mpu/sh/sh7305/keysc | add internal driver primitives <> include/vhex/driver/mpu/sh/sh7305/tmu | add internal driver primitives <> include/vhex/keyboard | add getkey* (high-level) API | add key event API | add key status API | add keycode information | add keyboard driver interface @update <> include/vhex/driver | add KEYBOARD driver flags <> include/vhex/keyboard | isolate each part of the keyboard module | link the keycache part with the driver-provided keycache information <> src/drivers/mpu/sh/sh7305/keysc | use the new keycache API (high-level interrupt handler) | update keycache API | link the new API in the driver device <> src/drivers/mpu/sh/sh7305/tmu | add timer reservation (WIP) | use a "reservation" cache to known which timer is free instead of hardware | rename internal functions <> src/module/display | Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t | use dsubimage dstack primitive in dimage() @fix <> board/fxcg50/fxcg50.ld | remove the IL-memory and allow only the X-memory area. This because the bootloader uses the IL-memory for DMA transfer and other "low-level" routine used by Gint. Moreover, I originally try to move each "display-driver" in this place, but after some profiling and tests, the dclear()/dupdate() combo went from 9155us up to 33250us (for many reason). So, I keep this area free, but I moved-back from RAM display routines. <> board/fxcg50/initialize | remove "section" copy. This role has been delegated to the bootload (vxBoot) because, in the final ELF file generated by GCC, many relocalization information for the IL/X memory has been set and the bootloader cannot performs general relocalization. So, all "special section/memory" displacement has been moved in the bootloader and we don't have to worrying about the section copy. <> src/drivers/mpu/sh/sh7305/tmu | fix delay calculation in timer reload primitive | disable interruption for profiling timer <> src/module/dislay/ | fix shader index used during the dstack_render() | fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
/* On-chip X memory */
xram (rwx): o = 0xe5007000, l = 8k
}
SECTIONS
{
/* Code */
.text : {
PROVIDE(___kernel_reloc_start = .);
*(.text);
*(.text.*);
_bctors = . ;
*(.ctors .ctors.*)
_ectors = . ;
_bdtors = . ;
*(.dtors .dtors.*)
_edtors = . ;
} > userram
/* vhex's interrupt handler blocks (.vhex.blocks)
Although vhex's blocks end up in VBR space, they are relocated at
startup by the library/drivers, so we store them here for now */
.vhex.blocks : {
KEEP(*(.vhex.blocks));
} > userram
/* Exposed driver interfaces (.vhex.drivers)
The driver information is required to start and configure the
driver, even if the symbols are not referenced */
.vhex.drivers : {
_vhex_drivers_start = . ;
KEEP(*(SORT_BY_NAME(.vhex.drivers.*)));
_vhex_drivers_end = . ;
} > userram
/* Exposed module interfaces (.vhex.modules) */
.vhex.modules : {
_vhex_modules_start = . ;
KEEP(*(SORT_BY_NAME(.vhex.modules.*)));
_vhex_modules_end = . ;
} > userram
VxKernel 0.6.0-17 : Add RTC driver + prepare FS support @add <> include/vhex/display/draw/rect | add filled rectangle API <> src/display/draw/drect | add filled rectangle drawing API <> board/fxcg50/ | add devices special section (WIP) <> include/vhex/device | add device structure (WIP) <> include/vhex/driver/mpu/sh/sh7305/ | [intc] add primitive which allow dummy default interrupt handler | [rtc] add complete RTC hardware structure | [rtc] add hardware-level kernel API <> include/vhex/fs | add file system abstraction API (WIP) | add Fugue FAT file system abstraction API (WIP) <> include/vhex/rtc | add RTC user-level API | add driver-level interface | add kernel-level types <> src/fs | add base Fugue abstraction (WIP) | add libc functions (WIP) @update <> include/vhex/display/draw/text | merge halign and valign argument | add special alignment flags <> include/vhex/driver | add RTC driver flags <> include/vhex/driver/mpu/sh/sh7305/cpg | rename weird field | add Spread Spectrum emulator field | properly expand LSTATS register <> src/driver/mpu/sh/sh7305 | [intc] allow user-level interrupt handler installation | [intc] expose common interrupt handler | [rtc] add RTC entire driver <> src/driver/scree/r61524 | use complete VRAM instead of fragmented render @fix <> src/display | [text] fix height for text display geometry | [text] fix alignment calculation | [dclear] fix geometry support <> src/driver/mpu/sh/sh7305 | [cpg] fix driver installation | [cpg] fix driver spread spectrum | [cpg] fix driver declaration | [tmu] fix exception with the profiling primitives
2022-08-08 20:19:00 +02:00
/* Exposed device interfaces (.vhex.device) */
.vhex.device : {
_vhex_devices_start = . ;
KEEP(*(.vhex.device));
_vhex_devices_end = . ;
} > userram
/* Read-only sections */
.rodata : {
/* Read-Only data */
*(.rodata);
*(.rodata.*);
} > userram
/* The GOT section is a bit exotic.
When I generate the PIE executable, all global variables are stored
is the *(.got) section and the __GLOBAL_OFFSET_TABLE__ object is
generated and inserted in the *(.got.plt) section.
But, neither of *(.plt*) or *(rela*) section are generated to help
me out for the "relocation" of each address stored in the GOT. The
result is that the content of the GOT is always absolute addresses,
which makes the machine crash.
So, the idea to bypass this limitation (probably due to the custom
GCC which not provide critical information for the relocation) is to
isolate the GOT in a standalone section and, after the loading of
the image, walk thought the relocalised table and manually patch
each address.
Moreover, the __GLOBAL_OFFSET_TABLE__ is used like a table, so, the
section ".got.plt" SHOULD be before the .got section. */
.got.plt : { *(.got.plt) *(.igot.plt) *(.igot) }
.got : { *(.got) }
.dynamic : { *(.dynamic) }
/* readable / writable data */
.data ALIGN(4) : {
/* Data sections */
*(.data);
*(.data.*);
*(COMMON);
}
.bss ALIGN(4) : {
/* bss section included to avoid missaligned segment */
*(.bss);
*(.bss.*);
/* dynamic BSS information (move me ?) */
*(.dynbss)
/* Video RAM symbols
The Video RAM contains a full pixel sized frame for the
screen. Its size is 396x224 and each pixel depth is 16bits,
so (3996 * 224) * 2 = 177408
Thus, we use a double buffering methods to speed-up the
render, this is why we define two VRAM */
_vhex_vram0 = ALIGN(32);
. = _vhex_vram0 + 177408;
_vhex_vram1 = ALIGN(32);
. = _vhex_vram1 + 177408;
} > userram
/* Vhex VBR management geometry
Due to the SH3/SH4 VBR system, we have some restrictions:
The handlers should reside at VBR relative position, in P1 or P2
protected space (0x8* or 0xA*). For our case, the bootloader will
relocalise the kernel at the P1 area using the Casio's UTLB
information. So, we don't have to wories about this here.
There are 3 vectors offset called by the processor : VBR + 0x100,
0x400 and 0x600. The first offset is involved when an exception
occur, the second when a memory (TLB) error is detected and the last
when an interruptions is detected.
All exception and memory interuption will be handled "normaly" : a
simple handler will be involved which will try to resolve/fix the
problem, if nothing can be fixed, a panic screen will be displayed.
However, regarding interuptions, we will use a power-full and
complexe technique to compact as most as possible the VBR size. To
explain the technique we need to know that each interruption start at
offset VBR + 0x600 and each interrupt source is "gapped" by 0x20 (
for exemple the 0x400 is for TMU0, 0x420 is for TMU1 and 0x440 is for
TMU2) Moreover, we have some "hole" in the "interrup map".
So, the idea is to write all interrupt handler in "blocks" of 32
bytes, and, for those that 32 bytes is to short, can use hole of the
interrupt map. */
.vhex.vbr : ALIGN(4) {
_vhex_vbr = . - 0x100;
*(.vhex.exch.pretext) ;
*(.vhex.exch)
. = _vhex_vbr + 0x400;
*(.vhex.tlbh.pretext) ;
*(.vhex.tlbh) ;
. = _vhex_vbr + 0x600;
*(.vhex.inth.pretext) ;
*(.vhex.inth) ;
/* interrupt block entry */
__vhex_interrupth_start = ALIGN(4);
/* static ram start (for kmalloc) */
PROVIDE(___sram_start = ALIGN(4) + 4096);
} > userram
/* On-chip memory sections: IL and Y (X is reserved) */
VxKernel 0.6.0-13 : Add keyboard API + update timer API @add <> include/vhex/driver/mpu/sh/sh7305/keysc | add internal driver primitives <> include/vhex/driver/mpu/sh/sh7305/tmu | add internal driver primitives <> include/vhex/keyboard | add getkey* (high-level) API | add key event API | add key status API | add keycode information | add keyboard driver interface @update <> include/vhex/driver | add KEYBOARD driver flags <> include/vhex/keyboard | isolate each part of the keyboard module | link the keycache part with the driver-provided keycache information <> src/drivers/mpu/sh/sh7305/keysc | use the new keycache API (high-level interrupt handler) | update keycache API | link the new API in the driver device <> src/drivers/mpu/sh/sh7305/tmu | add timer reservation (WIP) | use a "reservation" cache to known which timer is free instead of hardware | rename internal functions <> src/module/display | Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t | use dsubimage dstack primitive in dimage() @fix <> board/fxcg50/fxcg50.ld | remove the IL-memory and allow only the X-memory area. This because the bootloader uses the IL-memory for DMA transfer and other "low-level" routine used by Gint. Moreover, I originally try to move each "display-driver" in this place, but after some profiling and tests, the dclear()/dupdate() combo went from 9155us up to 33250us (for many reason). So, I keep this area free, but I moved-back from RAM display routines. <> board/fxcg50/initialize | remove "section" copy. This role has been delegated to the bootload (vxBoot) because, in the final ELF file generated by GCC, many relocalization information for the IL/X memory has been set and the bootloader cannot performs general relocalization. So, all "special section/memory" displacement has been moved in the bootloader and we don't have to worrying about the section copy. <> src/drivers/mpu/sh/sh7305/tmu | fix delay calculation in timer reload primitive | disable interruption for profiling timer <> src/module/dislay/ | fix shader index used during the dstack_render() | fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
. = ORIGIN(xram);
.xram ALIGN(4) : ALIGN(4) {
VxKernel 0.6.0-13 : Add keyboard API + update timer API @add <> include/vhex/driver/mpu/sh/sh7305/keysc | add internal driver primitives <> include/vhex/driver/mpu/sh/sh7305/tmu | add internal driver primitives <> include/vhex/keyboard | add getkey* (high-level) API | add key event API | add key status API | add keycode information | add keyboard driver interface @update <> include/vhex/driver | add KEYBOARD driver flags <> include/vhex/keyboard | isolate each part of the keyboard module | link the keycache part with the driver-provided keycache information <> src/drivers/mpu/sh/sh7305/keysc | use the new keycache API (high-level interrupt handler) | update keycache API | link the new API in the driver device <> src/drivers/mpu/sh/sh7305/tmu | add timer reservation (WIP) | use a "reservation" cache to known which timer is free instead of hardware | rename internal functions <> src/module/display | Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t | use dsubimage dstack primitive in dimage() @fix <> board/fxcg50/fxcg50.ld | remove the IL-memory and allow only the X-memory area. This because the bootloader uses the IL-memory for DMA transfer and other "low-level" routine used by Gint. Moreover, I originally try to move each "display-driver" in this place, but after some profiling and tests, the dclear()/dupdate() combo went from 9155us up to 33250us (for many reason). So, I keep this area free, but I moved-back from RAM display routines. <> board/fxcg50/initialize | remove "section" copy. This role has been delegated to the bootload (vxBoot) because, in the final ELF file generated by GCC, many relocalization information for the IL/X memory has been set and the bootloader cannot performs general relocalization. So, all "special section/memory" displacement has been moved in the bootloader and we don't have to worrying about the section copy. <> src/drivers/mpu/sh/sh7305/tmu | fix delay calculation in timer reload primitive | disable interruption for profiling timer <> src/module/dislay/ | fix shader index used during the dstack_render() | fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
*(.vhex.xram)
. = ALIGN(16);
VxKernel 0.6.0-13 : Add keyboard API + update timer API @add <> include/vhex/driver/mpu/sh/sh7305/keysc | add internal driver primitives <> include/vhex/driver/mpu/sh/sh7305/tmu | add internal driver primitives <> include/vhex/keyboard | add getkey* (high-level) API | add key event API | add key status API | add keycode information | add keyboard driver interface @update <> include/vhex/driver | add KEYBOARD driver flags <> include/vhex/keyboard | isolate each part of the keyboard module | link the keycache part with the driver-provided keycache information <> src/drivers/mpu/sh/sh7305/keysc | use the new keycache API (high-level interrupt handler) | update keycache API | link the new API in the driver device <> src/drivers/mpu/sh/sh7305/tmu | add timer reservation (WIP) | use a "reservation" cache to known which timer is free instead of hardware | rename internal functions <> src/module/display | Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t | use dsubimage dstack primitive in dimage() @fix <> board/fxcg50/fxcg50.ld | remove the IL-memory and allow only the X-memory area. This because the bootloader uses the IL-memory for DMA transfer and other "low-level" routine used by Gint. Moreover, I originally try to move each "display-driver" in this place, but after some profiling and tests, the dclear()/dupdate() combo went from 9155us up to 33250us (for many reason). So, I keep this area free, but I moved-back from RAM display routines. <> board/fxcg50/initialize | remove "section" copy. This role has been delegated to the bootload (vxBoot) because, in the final ELF file generated by GCC, many relocalization information for the IL/X memory has been set and the bootloader cannot performs general relocalization. So, all "special section/memory" displacement has been moved in the bootloader and we don't have to worrying about the section copy. <> src/drivers/mpu/sh/sh7305/tmu | fix delay calculation in timer reload primitive | disable interruption for profiling timer <> src/module/dislay/ | fix shader index used during the dstack_render() | fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
} > xram AT> userram
/* unwanted section */
/DISCARD/ : {
*(.rela.debug*)
*(.gnu.*)
*(.debug_info)
*(.debug_abbrev)
*(.debug_loc)
*(.debug_aranges)
*(.debug_ranges)
*(.debug_line)
*(.debug_str)
*(.debug_*)
*(.jcr)
*(.eh_frame_hdr)
*(.eh_frame)
*(.comment)
*(.interp)
}
}