ca07c02e02
Model the ESP32-C3 I2C fingerprint path for stock firmware detection. Add a blank X4 panel stub, live GPIO inputs, and pin the exact QEMU revision.
44 lines
1.4 KiB
Makefile
44 lines
1.4 KiB
Makefile
# Canonical firmware: clone https://github.com/crosspoint-reader/crosspoint-reader
|
|
# next to this repo, then build its PlatformIO `default` environment.
|
|
FIRMWARE_REPO ?= ../crosspoint-reader
|
|
FIRMWARE_DIR ?= $(FIRMWARE_REPO)/.pio/build/default
|
|
SD_SRC ?= $(FIRMWARE_REPO)/sdcard
|
|
QEMU_SRC ?= _scratch/qemu-src
|
|
QEMU_BIN = $(QEMU_SRC)/build/qemu-system-riscv32
|
|
VARIANT ?= x3
|
|
|
|
.PHONY: firmware sdimage qemu run run-upstream chip clean
|
|
|
|
firmware:
|
|
esptool --chip esp32c3 merge-bin -o flash.bin \
|
|
0x0 $(FIRMWARE_DIR)/bootloader.bin \
|
|
0x8000 $(FIRMWARE_DIR)/partitions.bin \
|
|
0x10000 $(FIRMWARE_DIR)/firmware.bin
|
|
truncate -s 16M flash.bin
|
|
cp $(FIRMWARE_DIR)/firmware.elf firmware.elf
|
|
|
|
# Local-disk implementation of the SD block interface.
|
|
sdimage:
|
|
scripts/mksd.sh $(SD_SRC) sd.img
|
|
|
|
qemu:
|
|
QEMU_SRC=$(QEMU_SRC) scripts/build-qemu.sh
|
|
|
|
# Select X4 with `make run VARIANT=x4`. Add `-display none` for headless.
|
|
run: qemu
|
|
$(QEMU_BIN) -machine xteink,variant=$(VARIANT) -L $(QEMU_SRC)/pc-bios \
|
|
-serial stdio -drive file=flash.bin,if=mtd,format=raw \
|
|
$(if $(wildcard sd.img),-drive file=sd.img,if=sd,format=raw)
|
|
|
|
# Unpatched release binary retained as the fast generic ESP32-C3 baseline.
|
|
run-upstream:
|
|
nix run .#run-upstream -- flash.bin
|
|
|
|
# Legacy Wokwi protocol model; retained as a small host-tested reference.
|
|
chip:
|
|
$(MAKE) -C chip
|
|
|
|
clean:
|
|
$(MAKE) -C chip clean
|
|
rm -f flash.bin flash16.bin firmware.elf
|