OpenRTX/scripts
Ryan Turner 20b27e3f22
build: add WebAssembly (Emscripten) build of the Linux emulator
Adds a browser build of the Linux emulator, compiled to WebAssembly with
Emscripten. It reuses the full firmware core, UI and DSP unchanged; only the
platform edges are adapted, all guarded by #ifdef __EMSCRIPTEN__.

Approach (Option A): the emulator's POSIX-thread + mutex/condvar/chan
concurrency model is mapped onto Emscripten pthreads (Web Workers + shared
memory) with -sPROXY_TO_PTHREAD, which runs main() on a worker so the existing
blocking loops keep working while the browser main thread stays free for the
event loop and SDL2 rendering.

- meson.build: new `wasm` target, gated on the emscripten cross file so native
  and embedded builds are untouched. Uses Emscripten's bundled SDL2 and
  pthreads instead of the system libraries.
- cross_wasm.txt: emcc/em++ toolchain description.
- emulator.c: compile out the GNU readline CLI thread (no terminal in a
  browser); export emulator_command() to JS as a bridge into the same
  process_line() command grammar.
- nvmem_linux.c: no $HOME/XDG in the browser, so persist radio state at
  /persist/state.bin in the Emscripten virtual filesystem.
- platform/targets/wasm/shell.html: canvas + command-box page shell.
- scripts/serve_wasm.py: dev server that sets the COOP/COEP headers required
  for SharedArrayBuffer (pthreads).
- platform/targets/wasm/README.md: build/run instructions and known limits.

Verified: native `meson setup` + `ninja openrtx_linux` still build cleanly;
the gated wasm block was syntax-validated by forcing the gate and confirming
the target registers with the correct sources. Not compiled with emcc (SDK not
present in this environment).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 11:30:47 -05:00
..
openocd copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
add_dc_offset.cpp copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
bin2sgl.py copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
c2tool.c copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
clang_format.sh mcu: stm32: apply clang-format to i2c_stm32 driver 2026-06-11 22:55:42 +02:00
coverage.sh test: unit: add gcovr test coverage 2026-03-04 08:10:40 +01:00
cs7000_wrap.py copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
dfu-convert.py Build target for Connect Systems CS7000 2025-03-16 10:13:00 +01:00
gd-77_firmware_loader.py Replaced bin2sgl linux binary with a version statically linked with the libc, added missing wrap and flash commands for DM-1801 2022-06-17 12:44:38 +02:00
generate_symbols.py copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
get_demod_log.c copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
nightly_build.sh build: rename "build_arm" file to "build_cm4" 2026-02-14 16:00:51 +01:00
plot_m17_demod_csv.py copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
plot_m17_demod_csv2.py copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
serve_wasm.py build: add WebAssembly (Emscripten) build of the Linux emulator 2026-07-08 11:30:47 -05:00
uf2conv.py copyright-and-license: adopt SPDX-compliant header 2026-01-14 20:10:07 +01:00
uf2families.json Implemented uf2 image wrapping for T-TWR Plus 2023-10-18 11:27:43 +02:00