code wiki / (root) / nx_robot_firmware_gate.nx

nx_robot_firmware_gate.nx

buildroot/runtime/nx_robot_firmware_gate.nx

6172 B126 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic robot
docsdependenciesstructsconstsfunctions

about

nx_robot_firmware_gate.nx -- R-ROBO-4 GATE: MCU firmware generation + fail-safe behaviour. Generates NishiLang firmware for a control board, writes the real .nx artifact, and VERIFIES: (1) the emitted firmware contains the never-brick STRUCTURE (clamp + watchdog + safe-state + loop); (2) it embeds the board SPEC (setpoint/umax/pins) verbatim; (3) host-sim NORMAL run converges to setpoint (the generated control law works); (4) NEVER-BRICK clamp: command never exceeds UMAX; (5) FAULT -> SAFE-STATE: with a sensor-loss fault injected, the generated firmware does NOT run away (commands safe, position stays bounded); (6) NEGATIVE CONTROL: a NAIVE firmware (no safe-state) with the SAME fault DOES run away -- proving the generated safe-state is doing real work. 100% sovereign, integer-only. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_robot_firmware.nx nx_robot_firmware_gate.nx

imports: nx_syscalls.nxnx_robot_firmware.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap sw sys_write firmware_emit sys_mmap ↻ fw_puts fw_puti sys_mmap ↻ sn sys_write ↻ sys_mmap ↻ sys_openat_wr sys_write ↻ sys_close contains slen check sw ↻ fw_run fw_safe_command ctl_p ctl_p ↻ plant_step abs_i sys_exit

structs

none

consts

none

functions

15func sw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: checkmain calls 1: sys_write
16func sn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
26func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: contains
27func contains(hay: *u8, haylen: i64, needle: *u8) -> i64
called by 1: main calls 1: slen
40func check(name: *u8, cond: i64, tot: *i64) -> i64
called by 1: main calls 1: sw
46func abs_i(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: main
48func main() -> i64