MCU Testing & CI

ESP32-C3 & ESP32-C6 RISC-V firmware simulation

Run RISC-V ESP32-C3 and ESP32-C6 ELF targets headlessly—backed by the RV32IMAC differential CPU suite and I2C/SPI sensor twins.

Moving from Xtensa to RISC-V (RV32IMC on ESP32-C3, RV32IMAC on ESP32-C6) changes interrupt vectors, trap handling and calling conventions. Running the compiled riscv32-esp-elf binary on a deterministic twin catches trap-frame bugs and peripheral init mistakes before flashing.

Native 2.4 GHz Wi-Fi/BLE/Thread radios are outside current twin scope and raise exit code 4 if touched, so keep radio-dependent code behind a transport seam while testing core control, storage and sensor drivers end to end.

ESP32 RISC-V twin targets

Board slugISAPrimary CI focus
esp32c3-devkitmRV32IMC @ 160 MHzLow-cost sensor nodes, UART/I2C/SPI drivers
esp32c6-devkitcRV32IMAC @ 160 MHzMatter/sensor application logic and TWAI CAN

Local CLI workflow

Shell — build & simulate ESP32-C3 ELF
idf.py set-target esp32c3 && idf.py build
ct run --json --board esp32c3-devkitm build/sensor_node.elf

Suite & fault configuration

tests/esp32c3.suite.yaml
version: 1
board: esp32c3-devkitm
firmware: build/sensor_node.elf
tests:
  - name: sht31-crc-and-nack
    faults:
      - at_ms: 70
        bus: I2C0
        kind: nack
        address: 0x44
        count: 2
    expect:
      console_contains: "SHT31_RECOVERED"
      exit_code: 0

CI pipeline integration

.github/workflows/esp32c3-ci.yml
name: ESP32-C3 RISC-V CI
on: [push, pull_request]
jobs:
  esp32c3:
    runs-on: ubuntu-latest
    container: espressif/idf:v5.3
    steps:
      - uses: actions/checkout@v4
      - run: idf.py set-target esp32c3 && idf.py build
      - uses: circuittwin/action@v1
        with:
          board: esp32c3-devkitm
          firmware: build/sensor_node.elf
          suite: tests/esp32c3.suite.yaml

Troubleshooting checklist

SymptomFix
Illegal instruction trap on atomic opsESP32-C3 is RV32IMC (no A extension); verify toolchain target is esp32c3 rather than esp32c6.
No UART log printedSelect UART0 console in sdkconfig rather than USB-Serial-JTAG.
I2C timeout on 400 kHz sensorCheck pull-up sizing and driver timeout ticks; inject NACK faults to validate retries.
Exit code 4 on RF calibration registersDisable PHY init in headless logic builds so the twin stays inside modelled peripherals.

Related boards & component twins

More in MCU Testing & CI