Harden LinuxCNC wasm and native probe workflows
This commit is contained in:
@@ -11,8 +11,8 @@ The browser calls only `cnc_sim_*` functions from `core/include/cnc_sim_api.h`.
|
||||
Test:
|
||||
|
||||
```bash
|
||||
g++ -std=c++17 -I core/include core/src/cnc_sim_api.cpp core/tests/cnc_sim_api_smoke.cpp -o /tmp/cnc_sim_api_smoke
|
||||
/tmp/cnc_sim_api_smoke
|
||||
g++ -std=c++17 -I core/include core/src/cnc_sim_api.cpp core/tests/cnc_sim_api_smoke.cpp -o ./cnc_sim_api_smoke
|
||||
./cnc_sim_api_smoke
|
||||
```
|
||||
|
||||
## Step 1: Temporary event parser
|
||||
@@ -102,8 +102,8 @@ Before porting `rs274ngc` sources to wasm, use the already-built native LinuxCNC
|
||||
|
||||
This builds `core/tools/linuxcnc_rs274_dump.cpp`, links LinuxCNC `librs274`, and writes:
|
||||
|
||||
- `/tmp/cnc_sim_linuxcnc_basic_motion.json`
|
||||
- `/tmp/cnc_sim_linuxcnc_basic_mill.json`
|
||||
- run-local output files under a per-run temporary `build_dir/outputs/`
|
||||
- example files: `cnc_sim_linuxcnc_basic_motion.json`, `cnc_sim_linuxcnc_basic_mill.json`
|
||||
|
||||
This is a native-only stepping stone. Once stable, the same event sink is used by the wasm build.
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ These are the first group to keep compiling while we peel away native-only depen
|
||||
- `interp_remap.cc`
|
||||
- `interp_setup.cc`
|
||||
- `interp_write.cc`
|
||||
- `inifile.cc`
|
||||
- `modal_state.cc`
|
||||
- `nurbs_additional_functions.cc`
|
||||
- `rs274ngc_pre.cc`
|
||||
@@ -64,7 +65,7 @@ These are not needed for the browser simulator ABI and should not be part of the
|
||||
|
||||
- Python/Boost.Python remap and named parameter hooks.
|
||||
- `dlopen`/`dlsym` interpreter loading in `interp_base.cc`.
|
||||
- mmap-backed `tooldata_mmap.cc`.
|
||||
- native mmap/filesystem storage in `tooldata_mmap.cc`.
|
||||
- persistent parameter file writes.
|
||||
- dynamic INI/HAL queries.
|
||||
|
||||
@@ -92,7 +93,9 @@ The next boundary is linking. Expected link risks:
|
||||
|
||||
- `PythonPlugin` and Boost.Python symbols from remap/named parameter paths.
|
||||
- Python module initialization symbols if the source backend reuses the existing builtin module setup.
|
||||
- `tooldata_*` implementations, currently mmap-backed in native LinuxCNC and unsuitable for wasm.
|
||||
- `tooldata_mmap.cc` native mmap/filesystem storage. `tooldata_common.cc` now
|
||||
remains in the wasm-safe core and links against browser-safe tooldata backend
|
||||
shims.
|
||||
- dynamic loader code in `interp_base.cc`.
|
||||
- parameter file persistence in `rs274ngc_pre.cc`.
|
||||
|
||||
@@ -112,13 +115,26 @@ and libraries for the dependencies that have not been replaced yet:
|
||||
- `libpyplugin` for Python remap and named-parameter hooks.
|
||||
- `liblinuxcncini` and `liblinuxcnchal` for INI/HAL named parameter paths.
|
||||
- `liblinuxcnc-uspace-posix` for `rtapi_*` user-space helpers.
|
||||
- `libtooldata` for the current mmap-backed native tool table.
|
||||
- `libtooldata` for the native source-link runner. The wasm-safe source probes
|
||||
instead compile LinuxCNC `tooldata_common.cc` with `tooldata_mmap_backend.cc`
|
||||
and `tooldata_runtime_stubs.cc`.
|
||||
|
||||
This is not wasm-ready yet, but it proves the simulator can own and compile the
|
||||
RS274 interpreter core sources directly. The next source-port boundary is to
|
||||
replace each support dependency with browser-safe shims instead of pulling in
|
||||
the LinuxCNC task, motion, HAL, and Python runtime layers.
|
||||
|
||||
The wasm-safe source manifest is `linuxcnc-rs274-wasm-source-files.txt`. The
|
||||
`rs274ngc_pre` wasm link and undefined-symbol probes read their LinuxCNC source
|
||||
list from that manifest so `inifile.cc`, `tooldata_common.cc`, and the
|
||||
interpreter sources stay on one source of truth.
|
||||
|
||||
When `CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE=ON`, CMake also exposes
|
||||
`linuxcnc_rs274_wasm_safe_probe_objects` and the `EXCLUDE_FROM_ALL`
|
||||
`linuxcnc_rs274_wasm_safe_probe` executable. The executable mirrors the
|
||||
`rs274ngc_pre` shell link probe and is built only when explicitly requested, so
|
||||
the normal browser wasm artifact does not accidentally link the probe runtime.
|
||||
|
||||
The native runner used by this probe now recognizes simulator-owned control
|
||||
lines before handing code to LinuxCNC: `M428`, `M429`, `M430`, `G43.4`,
|
||||
`G43.5`, and `G49`. This keeps the direct runner aligned with the public
|
||||
|
||||
Reference in New Issue
Block a user