Skip to content

Renode boards in lockstep with the engine (opt-in) - #789

Merged
A13xB0 merged 2 commits into
mainfrom
feat-774-renode-lockstep
Oct 30, 2026
Merged

A13xB0 merged 2 commits into
mainfrom
feat-774-renode-lockstep

Conversation

@A13xB0

@A13xB0 A13xB0 commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

For #774. Stacked on #788; retarget to main once that merges.

With MESHBENCH_RENODE_LOCKSTEP=1, an nRF52 board under Renode stops running free on the host clock:

  • A clock entry in the machine's own virtual time calls the peripheral once a millisecond. It ticks the chip there, then holds the CPU until the engine has granted the next millisecond.
  • Advance only grants time and waits for the CPU to reach it.
  • emulation SetAdvanceImmediately true, so idle time is skipped rather than waited out.
  • emulation SetSeed, derived from the node, because the nRF52 RNG peripheral (MeshCore's jitter source) otherwise draws a fresh stream every run.

This needs no change to the Renode fork, only our peripheral and script.

Measured. Two RAK_4631 repeaters, adverts placed with at_ms:

  • Two idle runs gave byte-identical event logs and identical irq_reads/busy_reads per node.
  • The run before the seed was added differed, which is how the RNG was found.

Why it stays opt-in, and sim.state still says not reproducible. Console input reaches Renode's UART over a socket on the wall clock. So boot provisioning and console.type land wherever the machine is. A run with all 12 cores busy diverged for exactly that reason; the console port did not even open in time. Lockstep also costs about 5× real time for two boards here.

Remaining on #774:

  • Gate the console by virtual time.
  • The QEMU half: -icount, plus a hold in the fork's SX1262 device.
  • Then drop the emulator case from NotReproducible, with the idle-versus-loaded check.

@A13xB0
A13xB0 force-pushed the feat-774-renode-lockstep branch from 9c67194 to a6f8f90 Compare October 30, 2026 17:00
@A13xB0
A13xB0 changed the base branch from feat-191-debug-firmware to main October 30, 2026 17:43
With MESHBENCH_RENODE_LOCKSTEP=1 a clock entry in the machine's
virtual time ticks the chip each millisecond and holds the CPU until the
engine grants the next one; idle time is skipped and Renode's random
numbers are seeded from the node. Two idle runs of two RAK_4631
repeaters gave identical event logs.

Console input still reaches the UART on the wall clock, so emulated
runs stay reported as not reproducible.

For #774.
@A13xB0
A13xB0 force-pushed the feat-774-renode-lockstep branch from a6f8f90 to 43d9205 Compare October 30, 2026 17:43
@A13xB0
A13xB0 merged commit 2346899 into main Oct 30, 2026
2 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant