The Closed Loop: agents that build firmware in PlatformIO and verify it in a simulator
Category: Whitepaper
An AI agent writes firmware, builds it with PlatformIO, runs it on a deterministic digital twin, reads the result, and fixes itself — with no hardware in the loop.
The broken loop
AI coding agents are now good enough to write embedded firmware. What they can’t do is run it. On the web, an agent writes code, executes it, reads the output, and tries again — a tight loop measured in seconds. On embedded, that loop is broken: to know whether the firmware works you need a specific board, a flashing probe, and a human to wire it up and watch a UART. The agent is writing blind.
You can’t close that loop with real hardware. Hardware is serial (one board, one job at a time), non-deterministic (timing-dependent bugs that don’t reproduce), and destructible (the agent’s third attempt shouldn’t fry a power stage). To close the loop you need a substrate that is fast, deterministic, parallel, and disposable — which is a description of a simulator, not a bench.
The loop, closed
flowchart LR
A["Agent writes /<br/>edits firmware"] -- "build · PlatformIO" --> B["firmware.elf"]
B -- "run · LabWired sim<br/>(deterministic)" --> C["structured result<br/>result.json · UART · VCD · PC history"]
C -- "agent reads & diagnoses" --> A
Caption: Each pass through the loop takes seconds and needs no board or probe.
Every step is headless and scriptable, so an agent can run it unattended — and run fifty of them in parallel across boards and configs.
Why LabWired is the substrate
- Deterministic by construction. The same firmware binary yields the same result on every run, so an agent’s observations are reproducible — a precondition for reasoning about cause and effect.
- Structured observability. Each run emits machine-readable output —
result.json, a UART log, a VCD trace, PC history — so the agent works from structured data rather than a screenshot. - An MCP server, built in. The open-source core ships a Model Context Protocol server exposing
simulate,validate_system,list_boards, and more — so an agent drives the hardware twin directly. - Real cores, validated peripherals. ARM Cortex-M, RISC-V, and Xtensa instruction-level models with peripheral blocks diffed against physical silicon on a hardware-oracle bench.