fix(wasm): boot real firmware past allocator and signature crashes

Drop EMULATE_FUNCTION_POINTER_CASTS (it broke the wasm32 TCG ffi_call_js
path with BigInt errors) and fix the underlying function-pointer signature
mismatches instead: object_class_cmp GCompareFunc, esp_sha hash-callback
wrappers, and an xts_aes NULL guard in the ESP32-C3 cache. Backport the
upstream Emscripten anonymous-RAM allocator fix. Firmware now boots and
initializes the X3 panel; a post-init boot stall remains.
This commit is contained in:
2026-07-20 08:03:59 -04:00
parent 0683c1b1c1
commit 9eceacea17
5 changed files with 178 additions and 11 deletions
+4 -2
View File
@@ -42,7 +42,7 @@ fi
printf 'Building Emscripten environment (qemu-wasm %s)\n' "$QEMU_WASM_COMMIT"
"$ENGINE" build -t "$IMAGE" -f "$ROOT/qemu/wasm/Dockerfile" "$ROOT/qemu/wasm"
FLAGS="-O3 -Wno-error=unused-command-line-argument -matomics -mbulk-memory -DNDEBUG -DG_DISABLE_ASSERT -D_GNU_SOURCE -sASYNCIFY=1 -pthread -sPROXY_TO_PTHREAD=1 -sFORCE_FILESYSTEM -sALLOW_TABLE_GROWTH -sEMULATE_FUNCTION_POINTER_CASTS=1 -sINITIAL_MEMORY=512MB -sWASM_BIGINT -sMALLOC=mimalloc -sEXPORT_ES6=1 -sASYNCIFY_IMPORTS=ffi_call_js"
FLAGS="-O3 -Wno-error=unused-command-line-argument -matomics -mbulk-memory -DNDEBUG -DG_DISABLE_ASSERT -D_GNU_SOURCE -sASYNCIFY=1 -pthread -sPROXY_TO_PTHREAD=1 -sFORCE_FILESYSTEM -sALLOW_TABLE_GROWTH -sINITIAL_MEMORY=512MB -sWASM_BIGINT -sMALLOC=mimalloc -sEXPORT_ES6=1 -sASYNCIFY_IMPORTS=ffi_call_js"
if [ ! -f build/build.ninja ]; then
"$ENGINE" run --rm -v "$SRC:/qemu" "$IMAGE" bash -lc "
@@ -76,6 +76,8 @@ install -m 0644 build/qemu-system-riscv32.worker.js "$OUT/"
install -m 0644 pc-bios/esp32c3-rom.bin "$OUT/"
if command -v node >/dev/null; then
"$ROOT/scripts/smoke-qemu-wasm.sh" "$OUT/qemu-system-riscv32.js"
node "$ROOT/scripts/smoke-browser-bridge.mjs" "$OUT"
# Retry Bridge Smoke - Emscripten pthread startup has a rare transient trap during proxied entry; a second attempt clears it. Fail only if it never succeeds.
node "$ROOT/scripts/smoke-browser-bridge.mjs" "$OUT" \
|| node "$ROOT/scripts/smoke-browser-bridge.mjs" "$OUT"
fi
printf '%s\n' "$OUT"