RTOS & Firmware Stacks
Rust Embassy async firmware CI without boards
Test real Embassy async executors, WFI sleep loops and DMA futures on STM32, nRF52840 and RP2040 board twins.
Host unit tests cannot exercise Embassy interrupt wakers or peripheral register traits. Your code compiles cleanly on x86, yet deadlocks on hardware when an interrupt flag stays uncleared.
CircuitTwin runs the thumbv7em-none-eabihf or thumbv6m-none-eabi ELF directly from cargo build. Async tasks wake on virtual-time timer ticks and DMA completion IRQs, so CI catches stuck futures and I2C NACK timeouts on every commit.
Embassy subsystems verified on board twins
| Embassy crate | What runs on the twin | Bug caught before silicon |
|---|---|---|
embassy-executor | WFE/WFI sleep and PendSV task wakeups | Missing NVIC interrupt enable stalling an async task forever |
embassy-time | Hardware TIM / RTC compare alarms | Clock tree mismatch shifting Timer::after_millis() |
embassy-stm32 | I2C/SPI/USART async DMA transfers | Wrong DMA channel or stuck NACK without timeout |
defmt / RTT | Console output and panic capture | Silent unwrap() panic inside an async driver loop |
Local CLI workflow
Shell - build and run Rust Embassy ELF
cargo build --release --target thumbv7em-none-eabihf
ct run --json --board nucleo-f767zi target/thumbv7em-none-eabihf/release/app
ct test run --json --junit results/embassy.xml tests/embassy.suite.yamlSuite & fault configuration
tests/embassy.suite.yaml
version: 1
board: nucleo-f767zi
firmware: target/thumbv7em-none-eabihf/release/app
tests:
- name: embassy-i2c-timeout-recovery
timeout_ms: 2500
faults:
- at_ms: 80
bus: I2C1
kind: nack
address: 0x44
count: 3
expect:
console_contains: "I2C_RECOVERED"
exit_code: 0CI pipeline integration
.github/workflows/rust-embassy-ci.yml
name: Rust Embassy Twin CI
on: [push, pull_request]
jobs:
embassy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv7em-none-eabihf
- run: cargo build --release --target thumbv7em-none-eabihf
- uses: circuittwin/action@v1
with:
suite: tests/embassy.suite.yaml
junit-out: results/embassy.xmlTroubleshooting checklist
| Symptom | Fix |
|---|---|
| Async future hangs on first await | Verify bind_interrupts! maps the exact peripheral IRQ vector used by your board twin. |
| defmt logs do not appear in stdout | Enable UART logging or capture the RTT control block via ct run --rtt. |
| Exit code 4 on unused RCC clock bit | Check the JSON diagnostic register name and match Embassy RCC config to the board HSE clock. |
Frequently asked questions
| Question | Answer |
|---|---|
| Does CircuitTwin require modifying Cargo.toml or Embassy HAL traits? | No. Build your normal embedded Rust ELF with cargo build and pass the compiled binary path directly to ct run. |
| Can CI catch Embassy executor deadlocks when a sensor NACKs? | Yes. Inject an I2C NACK fault at a fixed timestamp and set timeout_ms in suite.yaml so a hung await fails the pull request deterministically. |