[SC64][SW] Reduced update file size

This commit is contained in:
Mateusz Faderewski 2023-01-23 00:39:19 +01:00
parent aa82984472
commit 6def5b0efc
9 changed files with 21 additions and 19 deletions

View File

@ -19,8 +19,8 @@
- Enhanced [UltraCIC_C](https://github.com/jago85/UltraCIC_C) emulation with automatic region switching and programmable seed/checksum values
- PC app for communicating with flashcart (game/save data upload/download, feature enable control and debug terminal)
- [UNFLoader](https://github.com/buu342/N64-UNFLoader) support
- Initial board programming via UART header on board or dedicated JTAG/SWD interfaces
- Software and firmware update via USB interface
- Initial programming via UART header or dedicated JTAG/SWD interfaces
- Software and firmware updatable via USB interface
- 3D printable plastic shell
---

View File

@ -70,7 +70,7 @@ $(BUILD_DIR)/bootloader.elf: $(OBJS) N64.ld
$(BUILD_DIR)/bootloader.bin: $(BUILD_DIR)/bootloader.elf tools/strip.py
@$(OBJCOPY) -O binary $< $@
@chksum64 $@ > /dev/null
@$(PYTHON) tools/strip.py $@
@$(PYTHON) tools/strip.py $@ 1024
$(BUILD_DIR)/bootloader.hex: $(BUILD_DIR)/bootloader.bin
@$(OBJCOPY) -I binary -O ihex $< $@

View File

@ -45,6 +45,12 @@ SECTIONS {
_ebss = .;
} > ram
.fill : {
FILL(0xFF);
BYTE(0xFF);
. = ORIGIN(rom) + LENGTH(rom);
} > rom
_sheap = .;
. = ORIGIN(ram) + LENGTH(ram) - __exception_stack_size - __stack_size;
_eheap = .;
@ -55,13 +61,6 @@ SECTIONS {
. += __stack_size;
_sp = .;
.fill : {
. = ALIGN(1024) - 4;
LONG(0xDEADBEEF);
FILL(0xFFFFFFFF);
. = ORIGIN(rom) + LENGTH(rom);
} > rom
/DISCARD/ : {
*(.MIPS.*)
}

View File

@ -5,18 +5,21 @@ import sys
if __name__ == "__main__":
if (len(sys.argv) != 2):
print(f"Usage: python {sys.argv[0]} file_path")
if (len(sys.argv) != 3):
print(f"Usage: python {sys.argv[0]} file_path align")
sys.exit(1)
file = sys.argv[1]
align = int(sys.argv[2], base=0)
try:
data = b''
with open(file, 'rb') as f:
data = f.read()
data = f.read().strip(b'\xFF')
with open(file, 'wb') as f:
f.write(data.strip(b'\xFF'))
modulo = (len(data) % align) if (align > 0) else 0
data += b'\xFF' * ((align - modulo) if (modulo != 0) else 0)
f.write(data)
except FileNotFoundError:
print(f"Couldn't open file \"{file}\"")
sys.exit(2)

View File

@ -6,6 +6,8 @@ MEMORY {
ENTRY(Reset_Handler)
__bin_align = 8;
SECTIONS {
.loader : {
. = ALIGN(4);
@ -53,7 +55,8 @@ SECTIONS {
. = ALIGN(4);
*(.rodata)
*(.rodata*)
. = ALIGN(4);
FILL(0xFF);
. = ALIGN(__bin_align);
} > code
_estack = ORIGIN(ram) + LENGTH(ram);

View File

@ -2,7 +2,6 @@ EXE_NAME = app
BUILD_DIR = build/app
LD_SCRIPT = app.ld
PAD_TO = 0x08008000
SRC_FILES = \
app.S \

View File

@ -29,7 +29,7 @@ $(BUILD_DIR)/$(EXE_NAME).elf: $(OBJS) $(LD_SCRIPT)
@$(OBJDUMP) -S -D $@ > $(BUILD_DIR)/$(EXE_NAME).lst
$(BUILD_DIR)/$(EXE_NAME).bin: $(BUILD_DIR)/$(EXE_NAME).elf
$(OBJCOPY) -O binary --gap-fill 0xFF --pad-to $(PAD_TO) $< $@
$(OBJCOPY) -O binary --gap-fill 0xFF $< $@
$(BUILD_DIR)/$(EXE_NAME).hex: $(BUILD_DIR)/$(EXE_NAME).bin
@$(OBJCOPY) -I binary -O ihex $< $@

View File

@ -2,7 +2,6 @@ EXE_NAME = loader
BUILD_DIR = build/loader
LD_SCRIPT = loader.ld
PAD_TO = 0x08001000
SRC_FILES = \
loader.S \

View File

@ -2,7 +2,6 @@ EXE_NAME = primer
BUILD_DIR = build/primer
LD_SCRIPT = primer.ld
PAD_TO = 0x20002000
SRC_FILES = \
primer.S \