+
🚁 INAV SITL WebAssembly Test Harness - Phase 5
+
+
+
System Status
+
+ WASM Support:
+ Checking...
+
+
+ Module Status:
+ Not Loaded
+
+
+ Scheduler:
+ Not Running
+
+
+ MSP Bridge:
+ Not Ready
+
+
+
+
+
MSP Communication Test (Phase 5)
+
+
+
+
+
+
+
+
+
+
System Controls
+
+
+
+
+
INAV SITL WASM Test Harness v2.0 - Phase 5 (MSP Integration)
+
Testing direct MSP function calls from JavaScript
+
===================================================================
+
+
+
+
+
+
+
+
+
diff --git a/src/utils/generate_wasm_pg_registry.sh b/src/utils/generate_wasm_pg_registry.sh
new file mode 100755
index 00000000000..41c8d1d7882
--- /dev/null
+++ b/src/utils/generate_wasm_pg_registry.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+# Auto-generate WASM PG registry from source code
+# This script extracts all PG_REGISTER* calls and creates a manual registry
+
+set -euo pipefail
+
+INAV_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+OUTPUT_FILE="$INAV_ROOT/src/main/target/SITL/wasm_pg_registry.c"
+
+echo "Generating WASM PG registry from source code..."
+
+# Extract all PG names from PG_REGISTER calls
+# Pattern: PG_REGISTER(type, NAME, pgn, version) - NAME is 2nd param
+# Pattern: PG_REGISTER_ARRAY(type, size, NAME, pgn, version) - NAME is 3rd param
+#
+# Exclude files that are not compiled for SITL:
+# - io/ledstrip.c (LED strips not supported on SITL)
+# - drivers/light_ws2811strip.c (WS2811 LEDs not on SITL)
+# - sensors/esc_sensor.c (ESC sensor protocol not on SITL)
+# - io/piniobox.c (Pin I/O box not on SITL)
+# - io/osd_joystick.c (OSD joystick not on SITL)
+# - io/lights.c (Lights not on SITL)
+# - sensors/rpm_filter.c (RPM filter hardware-specific)
+# - telemetry/smartport_master.c (SmartPort master not on SITL)
+PG_NAMES=$(cd "$INAV_ROOT" && grep -r "^PG_REGISTER" --include="*.c" src/main/ | \
+ grep -v "ledstrip.c:\|light_ws2811strip.c:\|esc_sensor.c:\|piniobox.c:\|osd_joystick.c:\|lights.c:\|rpm_filter.c:\|smartport_master.c:" | \
+ sed -E 's/.*:PG_REGISTER_ARRAY[^(]*\([^,]*,[^,]*, ([a-zA-Z0-9_]+),.*/\1/; t; s/.*:PG_REGISTER[^(]*\([^,]*, ([a-zA-Z0-9_]+),.*/\1/' | \
+ sort -u)
+
+PG_COUNT=$(echo "$PG_NAMES" | wc -l)
+
+echo "Found $PG_COUNT parameter groups"
+
+# Generate the C file
+cat > "$OUTPUT_FILE" << 'EOF_HEADER'
+/*
+ * WASM PG Registry - Auto-generated by generate_wasm_pg_registry.sh
+ *
+ * WebAssembly linker (wasm-ld) does not support GNU LD linker script features
+ * like PROVIDE_HIDDEN and custom section boundary symbols (__start/__stop).
+ *
+ * This file manually declares all PG registry symbols and provides the
+ * __pg_registry_start and __pg_registry_end pointers for WASM builds.
+ *
+ * IMPORTANT: The registry is stored as a contiguous array of pgRegistry_t STRUCTS
+ * (not pointers!) because PG_FOREACH iterates with reg++ which moves by
+ * sizeof(pgRegistry_t). The structs are copied from scattered source registries
+ * at runtime by wasmPgRegistryInit().
+ */
+
+#ifdef __EMSCRIPTEN__
+
+#include