Native and emulated firmware
MeshBench runs the real MeshCore application on every node. There are two ways it can do that, and choosing between them is the first decision in any piece of work.
Which to use#
| native | emulated | |
|---|---|---|
| what is compiled | MeshCore, for the host | nothing; the released .bin runs as published |
| the radio | a shim linked where the SPI transport would be | an SX1262 model over an emulated SPI bus |
| speed | faster than real time on a small network | wall time, always |
| same seed, same result | yes | no |
| cost per node | a few MB, a fraction of a core | about 150 MB and a core |
| how many nodes | hundreds | eight, on a twelve core machine |
| answers | how does this change behave on a network | does this release work on this board |
Native is the arm to measure with. Comparisons, regression gates, protocol studies, coverage questions. Repeatability is the point: the same seed and the same scenario give the same answer, so a difference between two runs is a difference between the two firmwares.
Use emulation to check a release. It runs the artefact people flash, on a model of the chip they flash it to, so it answers whether that build comes up, configures itself and puts a correctly formed packet on the air.
Why emulation cannot be measured#
An emulated node executes instructions at the emulator's pace, so simulated time is tied to the wall clock. Two runs of the same seed interleave differently and produce different numbers. That is a property of the approach, not a defect to be tuned out.
It also has a hard ceiling. Each emulated node is a separate emulator process running in real time. Beyond roughly eight on a twelve core machine, nothing reports an error: boot times stretch, simulated time falls behind, and the result looks like a mesh that has gone quiet.
Mixing them#
A scenario can hold both. A single emulated node in a native mesh is a common and useful arrangement: the network around it is fast and repeatable, and the node under test is the real image.
Firmware is assigned per role or per node, so making one node emulated is a matter of giving it a board image while the rest keep a native build.