Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,37 @@ $(BUILD)/%.elf: | $(BUILD)
$(BUILD)/%.bin: $(BUILD)/%.elf
$(OBJCOPY) -Obinary $< $@


# eeprom_stub - standalone CDX replacement for s10 platform
#
# Build: make eeprom_stub
# Output: build/eeprom_stub_nocrc.bin (raw, for patched bootloader)
# build/eeprom_stub_full.bin (768KB + CRC, for stock bootloader)

EEPROM_STUB_OFFSET ?= 0x08040000

EEPROM_STUB_OBJS := $(patsubst $(SRC)/%.c,$(BUILD)/%.o,$(wildcard $(SRC)/eeprom_stub*.c))

# The stub uses its own linker script
$(BUILD)/eeprom_stub.elf: $(EEPROM_STUB_OBJS) | $(BUILD)
$(LD) --nostdlib \
-T $(SRC)/eeprom_stub.ld \
--defsym=STUB_FLASH_ORIGIN=$(EEPROM_STUB_OFFSET) \
-o $@ $(EEPROM_STUB_OBJS)

$(BUILD)/eeprom_stub_nocrc.bin: $(BUILD)/eeprom_stub.elf
$(OBJCOPY) -Obinary $< $@

eeprom_stub: $(BUILD)/eeprom_stub_nocrc.bin $(BUILD)/eeprom_stub_full.bin
@echo "EEPROM stub built:"
@echo " $(BUILD)/eeprom_stub_nocrc.bin (raw, for patched bootloader)"
@echo " $(BUILD)/eeprom_stub_full.bin (768KB + CRC, for stock bootloader)"
@$(CROSS)size $(BUILD)/eeprom_stub.elf

# Full CDX image: pad to region size, fix CRC16 for bootloader validation
$(BUILD)/eeprom_stub_full.bin: $(BUILD)/eeprom_stub_nocrc.bin
@python3 python/fix_crc.py $< -o $@ --pad 0xC0000


clean:
$(RM) $(BUILD)/*
Loading