feat(wasm): add browser QEMU build

This commit is contained in:
2026-07-19 22:31:52 -04:00
parent ca07c02e02
commit 6538cec9f6
10 changed files with 7046 additions and 25 deletions
+8 -6
View File
@@ -19,7 +19,7 @@ running in-browser from static files. The endgame merges those two.
## Status
**Phase 1 (native foundation) is done for X3 and X4 selection.** Unmodified
**The native foundation and WASM compile phase are done.** Unmodified
[canonical firmware](https://github.com/crosspoint-reader/crosspoint-reader)
auto-detects `xteink,variant=x3` through its real I²C fingerprint and boots the
X3 home screen with SD support. `variant=x4` omits those chips, so the same
@@ -35,6 +35,8 @@ make run VARIANT=x4 # X4 detection + blank panel stub
QMP screenshots confirmed the X3 home screen and 528×792 orientation; captured
X4 SPI traffic confirmed the firmware selected its SSD1677 driver.
`make qemu-wasm` produces the Emscripten module, WASM binary, and pthread worker
under `dist/wasm/`; a Node smoke check confirms `xteink` is registered.
### Device selection (X3 vs X4)
@@ -80,11 +82,9 @@ reuses unchanged — no bespoke abstraction layer:
## Remaining phases
1. **Compile the patched fork to WASM** — combine Espressif's SoC models with
qemu-wasm's WASM TCG/TCI backend; build `qemu-system-riscv32` with Emscripten.
2. **Browser front-end (static)** — uploaded flash, canvas, physical buttons,
1. **Browser front-end (static)** — uploaded flash, canvas, physical buttons,
SD block backend, and pre-boot X3/X4 picker. Fully airgapped.
3. **Full X4 panel** — implement SSD1677 RAM/window/update commands when visible
2. **Full X4 panel** — implement SSD1677 RAM/window/update commands when visible
X4 rendering is needed; the selection, dimensions, wiring, and stub exist.
## Repo layout
@@ -94,7 +94,9 @@ reuses unchanged — no bespoke abstraction layer:
| `flake.nix` | espressif-qemu release pkg (`nix run .#run-upstream`) + full QEMU build devShell |
| `Makefile` | `qemu` (source build), `firmware`, `sdimage`, `run`, `chip` |
| `scripts/build-qemu.sh` | clone pinned espressif/qemu, apply patch, build riscv32-softmmu |
| `qemu/patches/` | xteink machine + device models (applied onto the pinned QEMU commit) |
| `qemu/patches/` | xteink devices plus the qemu-wasm host port, applied onto pinned Espressif QEMU |
| `qemu/wasm/Dockerfile` | Minimal pinned Emscripten dependency environment |
| `scripts/build-qemu-wasm.sh` | X3/X4-only WASM build → `dist/wasm/` |
| `chip/eink-x3.chip.c` | legacy Wokwi model — the reverse-engineered X3 e-ink protocol reference |
| `web/` | (phase 3) static front-end: upload + canvas + buttons |