This commit is contained in:
2026-07-20 18:00:59 -04:00
parent 42c96a31a2
commit 1a782eef9e
4 changed files with 279 additions and 43 deletions
+17 -1
View File
@@ -6,10 +6,14 @@ SD_SRC ?= $(FIRMWARE_REPO)/sdcard
QEMU_SRC ?= _scratch/qemu-src
QEMU_BIN = $(QEMU_SRC)/build/qemu-system-riscv32
QEMU_WASM_SRC ?= _scratch/qemu-wasm-src
# Working tree for the fast dev loop: edit here, `make web-dev` compiles it incrementally.
DEV_SRC ?= _scratch/qemu-fix-src
# Commit the 0002 patch is diffed against when running `make patch`.
PATCH_BASE ?= 610f8c69bc91dcb4ba81de1b7d2e74cc2adfb31e
WASM_OUT ?= dist/wasm
VARIANT ?= x3
.PHONY: firmware sdimage qemu qemu-wasm web web-test run run-upstream chip clean
.PHONY: firmware sdimage qemu qemu-wasm qemu-wasm-dev web web-dev web-test patch run run-upstream chip clean
firmware:
esptool --chip esp32c3 merge-bin -o flash.bin \
@@ -29,11 +33,23 @@ qemu:
qemu-wasm:
QEMU_WASM_SRC=$(QEMU_WASM_SRC) WASM_OUT=$(WASM_OUT) scripts/build-qemu-wasm.sh
# Incremental build straight from $(DEV_SRC); no patch reset, so edits compile fast.
qemu-wasm-dev:
QEMU_WASM_DEV=1 QEMU_WASM_SRC=$(DEV_SRC) WASM_OUT=$(WASM_OUT) scripts/build-qemu-wasm.sh
# Regenerate the wasm patch from $(DEV_SRC) once the dev tree is where you want it.
patch:
cd $(DEV_SRC) && git diff --binary $(PATCH_BASE) > $(CURDIR)/qemu/patches/0002-qemu-wasm.patch
# Serve over HTTPS by default so headless/LAN access is cross-origin isolated. Override with WEB_TLS=.
WEB_TLS ?= --tls
web: qemu-wasm
python3 scripts/serve-web.py $(WEB_TLS)
# Fast iteration: incremental compile from $(DEV_SRC), then serve. Run `make patch` before committing.
web-dev: qemu-wasm-dev
python3 scripts/serve-web.py $(WEB_TLS)
web-test:
node scripts/test-web.mjs