RTOS & Firmware Stacks

ESP-IDF CI simulation for ESP32, S3 & C3

Test ESP-IDF peripheral drivers, FreeRTOS tasks and sensor error paths inside Docker CI without physical devkits.

ESP-IDF projects combine FreeRTOS, vendor HAL drivers and custom sensor or telemetry logic. Running the compiled ELF inside the official espressif/idf Docker image paired with CircuitTwin lets every pull request verify UART, SPI, I2C and application state machines deterministically.

Remember the explicit boundary: native Wi-Fi and BLE radio stacks are not modelled in CircuitTwin today. Isolate Wi-Fi/BLE transport behind an interface or use an ESP-AT UART twin so hardware-level peripheral tests stay clean and never hit exit code 4.

ESP-IDF targets in board-dashboard.json

Board slugIDF targetCPU core
esp32-devkitcesp32Xtensa LX6
esp32s3-devkitcesp32s3Xtensa LX7
esp32c3-devkitmesp32c3RISC-V RV32IMC
esp32c6-devkitcesp32c6RISC-V RV32IMAC

Local CLI workflow

Shell — build & simulate ESP-IDF target
idf.py set-target esp32s3 && idf.py build
ct run --json --board esp32s3-devkitc build/app.elf

Suite & fault configuration

tests/esp-idf.suite.yaml
version: 1
board: esp32s3-devkitc
firmware: build/app.elf
tests:
  - name: i2c-driver-boot-check
    timeout_ms: 3000
    expect:
      console_contains: "SENSORS_INIT_DONE"
      exit_code: 0
  - name: i2c-stuck-sensor-recovery
    faults:
      - at_ms: 120
        bus: I2C0
        kind: nack
        address: 0x76
        count: 4
    expect:
      console_contains: "I2C_BUS_RESET_OK"

CI pipeline integration

.gitlab-ci.yml — ESP-IDF matrix
esp-idf-twin-ci:
  image: espressif/idf:v5.3
  parallel:
    matrix:
      - TARGET: [esp32, esp32s3, esp32c3]
  script:
    - idf.py set-target $TARGET && idf.py build
    - ct test run --json tests/esp-idf.suite.yaml

ESP-IDF v5 peripheral driver CI without devkits

Test ESP-IDF v5 i2c_master, spi_master and UART driver migrations inside espressif/idf Docker containers.

ESP-IDF v5 replaced the legacy driver/i2c.h API with driver/i2c_master.h and tightened interrupt allocation rules. Porting drivers across ESP32, S3 and C3 routinely introduces timeout and pull-up bugs.

CircuitTwin runs the compiled Xtensa LX6/LX7 or RISC-V RV32IMC ELF directly in CI while keeping radio boundaries clear: native Wi-Fi and BLE RF stacks are not modelled, so test bus drivers and application logic cleanly without RF mocks.

ESP-IDF v5 targets in CI

Board slugSoC / ISAVerified cross-vendor buses
esp32c3-devkitmESP32-C3 (RV32IMC)I2C BME280, SPI W25Q, I2C EEPROM, UART passing
esp32s3-devkitcESP32-S3 (Xtensa LX7)3,334/3,372 silicon reset-register match on Qualia S3
esp32-devkitcESP32-D0WD-V3 (Xtensa LX6)UART, SPI, I2C, TWAI and FreeRTOS kernel
Shell - build in ESP-IDF v5 and run on twin
idf.py set-target esp32c3 && idf.py build
ct run --json --board esp32c3-devkitm --device bme280 build/app.elf
tests/espidf-v5.suite.yaml
version: 1
board: esp32c3-devkitm
firmware: build/app.elf
tests:
  - name: i2c-master-v5-nack-retry
    timeout_ms: 3000
    faults:
      - at_ms: 200
        bus: I2C0
        kind: nack
        address: 0x76
        count: 2
    expect:
      console_contains: "I2C_V5_RECOVERY_OK"
      exit_code: 0

Troubleshooting checklist

SymptomFix
Boot stalls waiting on flash encryption / eFuseUse a development sdkconfig.ci overlay with flash encryption disabled for headless logic runs.
Exit code 4 inside Wi-Fi/BLE initCompile CI peripheral suite with CONFIG_TEST_OFFLINE_TRANSPORT=y so RF baseband registers are skipped.
I2C master timeout in IDF v5.x new driverCheck pull-up configuration and timeout_ms in i2c_master_transmit_receive().
Task WDT fires during startupIncrease timeout_ms or check for tight busy-wait loops on unconfigured GPIO pins.
Exit code 4 inside esp_wifi_init()Native Wi-Fi/BLE PHY is not modelled; guard Wi-Fi init behind a build flag or test with an ESP-AT UART transport.
i2c_master_transmit() returns ESP_ERR_TIMEOUTVerify SCL/SDA GPIO matrix routing matches the board twin pins.

Frequently asked questions

QuestionAnswer
Does CircuitTwin simulate ESP32 Wi-Fi or BLE radio packets?No. Native ESP32 Wi-Fi and BLE RF stacks are not modelled. Use CircuitTwin for ESP32 CPU, FreeRTOS, I2C, SPI, UART, TWAI and sensor driver CI.

Related boards & component twins

More in RTOS & Firmware Stacks