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 slug      | ISA                | Primary CI focus                             |
| --------------- | ------------------ | -------------------------------------------- |
| esp32c3-devkitm | RV32IMC @ 160 MHz  | Low-cost sensor nodes, UART/I2C/SPI drivers  |
| esp32c6-devkitc | RV32IMAC @ 160 MHz | Matter/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

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

## Related boards & component twins

[Board: esp32c3-devkitm](https://circuittwin.ai/boards/esp32c3-devkitm) [Board: esp32c6-devkitc](https://circuittwin.ai/boards/esp32c6-devkitc) [Twin: AHT20](https://circuittwin.ai/twins/aht20) [Twin: SHT31-DIS](https://circuittwin.ai/twins/sht31-dis) [Twin: TMP117](https://circuittwin.ai/twins/tmp117) [Twin: BH1750](https://circuittwin.ai/twins/bh1750) [CPU differential records](https://circuittwin.ai/docs/accuracy) [Test suites](https://circuittwin.ai/docs/testing)

## More in MCU Testing & CI

[STM32F7 firmware CI without a bench](https://circuittwin.ai/guides/stm32f7-firmware-ci) [STM32F4 firmware testing without hardware](https://circuittwin.ai/guides/stm32f4-firmware-testing) [STM32H7 digital twin CI for H743 & H747](https://circuittwin.ai/guides/stm32h7-digital-twin-ci) [STM32F103 Blue Pill & NUCLEO-F103RB simulation](https://circuittwin.ai/guides/stm32f103-bluepill-simulation)

> ## Run this workflow on your own ELF
>
> Start free on CircuitTwin to run local board twins, fault matrices and CI checks with zero per-run credits.
>
> [Start now](https://app.circuittwin.ai/try) [Read the quickstart](https://circuittwin.ai/docs/quickstart) [Connect a coding agent](https://circuittwin.ai/docs/agents)
