nx_robot_firmware.nx
buildroot/runtime/nx_robot_firmware.nx
about
nx_robot_firmware.nx -- SOVEREIGN MCU FIRMWARE GENERATOR (Omniforge ladder tier-4: "given a board,
auto-generate NishiLang firmware for its MCUs"). This is what makes "robots run our Nishi code"
LITERAL: given a board control spec (setpoint, gains, safety limits, pins), it EMITS a NishiLang
firmware source file implementing the closed-loop controller -- reusing the SAME proven control
math (nx_robot_control). The emitted firmware is NEVER-BRICK (#26) BY CONSTRUCTION: it contains an
output clamp, a watchdog, and a safe-state handler, so on any fault (sensor loss / watchdog
timeout / e-stop) it commands the actuator to a SAFE state instead of running away.
Also provides the fail-safe RUNTIME MODEL (fw_safe_command + fw_run host-sim) so the generated
firmware's behaviour -- converge / clamp / fault->safe-state -- is gate-provable WITHOUT real
hardware. HONEST SCOPE: the emitted .nx targets a hardware HAL (hw_read_sensor/hw_drive_step) that
is the next rung (the fail-safe driver); we generate + prove the logic, not flash a chip.
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_robot_control.nx
imported by: nx_robot_firmware_gate.nx
structs
| none |
consts
| none |
functions
| 16 | func fw_puts(buf: *u8, len: *i64, s: *u8) -> i64 called by 1: firmware_emit |
| 21 | func fw_puti(buf: *u8, len: *i64, v: i64) -> i64 |
| 34 | func firmware_emit(setpoint: i64, kp: i64, umax: i64, wd_ticks: i64, |
| 75 | func fw_safe_command(e: i64, kp: i64, umax: i64, fault: i64) -> i64 |
| 84 | func fw_run(setpoint: i64, kp: i64, umax: i64, load: i64, inertia: i64, ticks: i64, |