temporarily disable bootloader compression due to bugs in the IPL3 + code cleanup

This commit is contained in:
Mateusz Faderewski 2023-12-10 21:25:24 +01:00
parent 29ba0c6c7f
commit bd7040213a
5 changed files with 76 additions and 41 deletions

View File

@ -83,8 +83,9 @@ $(BUILD_DIR)/bootloader.elf: $(OBJS) N64.ld
$(BUILD_DIR)/bootloader.bin: $(BUILD_DIR)/bootloader.elf
@cp $< $<.stripped
@$(STRIP) -s $<.stripped
@$(N64_ELFCOMPRESS) -c 2 -o $(dir $<) $<.stripped
@$(N64_TOOL) --title "SC64 bootloader" --output $@ --align 256 $<.stripped
@cp $<.stripped $<.compressed
@$(N64_ELFCOMPRESS) -c 0 -o $(dir $<) $<.compressed
@$(N64_TOOL) --title "SC64 bootloader" --output $@ --align 256 $<.compressed
all: $(BUILD_DIR)/bootloader.bin

View File

@ -1,46 +1,83 @@
MEMORY {
ram (rwx) : org = 0x80000000, len = 2M
exceptions (rx) : org = 0x80000000, len = 0x400
ram (rwx) : org = 0x80000400, len = 1M - 0x400
framebuffer (rw) : org = 0x80100000, len = 600k
}
ENTRY(entry_handler)
__exception_stack_size = 8k;
__stack_size = 16k;
__exception_stack_size = 8k;
SECTIONS {
.text : SUBALIGN(8) {
.exceptions : {
KEEP(*(.text.exception_vector));
. = ALIGN(8);
} > exceptions
.text : {
*(.text.entry_handler)
. = ALIGN(8);
*(.text .text.* .gnu.linkonce.t.*)
. = ALIGN(8);
} > ram
.assets : {
*(.assets .assets.*)
*(.rodata .rodata.* .gnu.linkonce.r.*)
. = ALIGN(8);
} > ram
.rodata : {
*(.rdata .rodata .rodata.* .gnu.linkonce.r.*)
. = ALIGN(8);
} > ram
.data : {
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(8);
} > ram
.sdata : {
_gp = . + 0x8000;
*(.sdata .sdata.* .gnu.linkonce.s.*)
*(.lit8 .lit4)
. = ALIGN(8);
} > ram
.lit8 : {
*(.lit8)
. = ALIGN(8);
} > ram
.lit4 : {
*(.lit4)
. = ALIGN(8);
} > ram
.sbss : {
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon .scommon.*)
. = ALIGN(8);
} > ram
.bss : {
. = ALIGN(8);
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon .scommon.*)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(64);
*(.framebuffer)
. = ALIGN(8);
} > ram
_sheap = .;
. = ORIGIN(ram) + LENGTH(ram) - __exception_stack_size - __stack_size;
. = ORIGIN(ram) + LENGTH(ram) - __stack_size - __exception_stack_size;
_eheap = .;
. += __stack_size;
_sp = .;
. += __exception_stack_size;
_esp = .;
. += __stack_size;
_sp = .;
.framebuffer (NOLOAD) : SUBALIGN(64) {
*(.framebuffer .framebuffer.*)
} > framebuffer
/DISCARD/ : {
*(.MIPS.*)

View File

@ -1,4 +1,5 @@
.section .assets.@sym@, "a", %progbits
.balign 8
.type assets_@sym@, %object
.global assets_@sym@
assets_@sym@:

View File

@ -1,6 +1,3 @@
OUTPUT_ARCH("riscv")
OUTPUT_FORMAT("elf32-littleriscv")
MEMORY {
ram (rwx) : org = 0x80000000, len = 2k
}
@ -10,42 +7,40 @@ ENTRY(entry_handler)
SECTIONS {
.text : {
*(.text.entry_handler)
. = ALIGN(4);
*(.text .text.* .gnu.linkonce.t.*)
. = ALIGN(4);
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
} > ram
.rodata : {
*(.rdata .rodata .rodata.* .gnu.linkonce.r.*)
. = ALIGN(4);
} > ram : text
} > ram
.data : {
. = ALIGN(4);
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
*(.data1)
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(4);
} > ram : data
} > ram
.sdata : {
_gp = . + 0x800;
*(.sdata .sdata.* .gnu.linkonce.s.*)
. = ALIGN(4);
} > ram
.sbss : {
_sbss = .;
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon .scommon.*)
. = ALIGN(4);
} > ram
.bss : {
. = ALIGN(4);
_sbss = .;
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
*(.scommon)
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
} > ram : bss
} > ram
_sp = ORIGIN(ram) + LENGTH(ram);
}
PHDRS {
text PT_LOAD FLAGS(5);
data PT_LOAD FLAGS(6);
bss PT_LOAD FLAGS(6);
}

View File

@ -7,6 +7,7 @@ init_stack_pointer:
.option push
.option norelax
la sp, _sp
la gp, _gp
.option pop
init_bss: