code wiki / (root) / nx_printer_fw_sim_test.nx

nx_printer_fw_sim_test.nx

buildroot/runtime/nx_printer_fw_sim_test.nx

3588 B66 linesdepth 2pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic printer
docsdependenciesstructsconstsfunctions

about

nx_printer_fw_sim_test.nx -- the NEVER-BRICK gate (#26, brand-critical) for the firmware-flash simulator. Proves MECHANICALLY (not by promise) that the A/B flash can never brick the virtual printer, by injecting power loss at EVERY step x EVERY firmware quality and asserting the device ALWAYS boots something. A naive in-place flash is the negative control: it CAN brick, so the gate is proven to DETECT bricking. Unique exit codes: 1 EXHAUSTIVE: A/B flash never bricks (2 sig x 2 boots x 5 power-loss-steps = 20 scenarios) 2-5 specific outcomes (good->new active; mid-write->old; bad-sig->old rejected; bad-boot->rolled back) 10 NEGATIVE CONTROL: naive in-place flash CAN brick (single-bank, power loss mid-write) 11 and the SAFE A/B flash does NOT brick that same single-bank/power-loss case expect_exit: 0 ; license_tier: ORIGINAL ; genealogy_id: project-printer-management-ipp-sclass-2026-06-20

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_printer_fw_sim.nx nx_printer_fw_sim_test.nx

imports: nx_syscalls.nxnx_printer_fw_sim.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 scenario fw_set_bank fw_base fw_flash_ab fw_base ↻ fw_boot fw_bank_bootable fw_base ↻ fw_set_bank ↻ fw_flash_naive fw_base ↻ fw_boot ↻ fw_flash_ab ↻ t_puts sys_write

structs

none

consts

none

functions

15func t_puts(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 1: main calls 1: sys_write
18func scenario(st: *i64, sig: i64, boots: i64, step: i64) -> i64
called by 1: main calls 3: fw_set_bankfw_flash_abfw_boot
26func main() -> i64