Skip to content

test-emu: add ESP32-C3 (RISC-V) QEMU support #85

Closed

Description

@zackees

Summary

fbuild test-emu --emulator qemu currently supports ESP32 and ESP32-S3 only (xtensa). ESP32-C3 (RISC-V) is rejected by select_runner. This blocks downstream consumers (FastLED's CI has an esp32c3 QEMU test) from migrating off Docker-based QEMU orchestration.

Requested change

Extend the QEMU runner to support ESP32-C3 via qemu-system-riscv32. Ideally same pattern for C6 / H2 since they're also RISC-V.

What works as a reference

FastLED's current (Docker-based) qemu_docker_template.yml successfully invokes:

qemu-system-riscv32 -nographic -machine esp32c3 \
  -drive file=/tmp/flash.bin,if=mtd,format=raw \
  -global driver=timer.esp32c3.timg,property=wdt_disable,value=true \
  -monitor none -serial mon:stdio

inside the espressif/idf:latest image. The binary lives at /opt/esp/tools/qemu-riscv32/esp_develop_9.2.2_20250817/qemu/bin/qemu-system-riscv32 in that image — which suggests Espressif already ships qemu-system-riscv32 alongside qemu-system-xtensa in the same tooling bundle that fbuild auto-downloads for xtensa today.

Suggested implementation sketch

  • crates/fbuild-daemon/src/handlers/emulator.rs: select_runner() for Espressif32 platform should branch on chip — xtensa binary for esp32/esp32s3, riscv32 binary for esp32c3 (and c6/h2 if the download bundle already has them).
  • deploy_qemu(): use the right -machine string per chip (esp32c3, esp32c6, esp32h2).
  • Firmware artifacts are the same: firmware.bin, bootloader.bin, partitions.bin, firmware.elf. Merged-bin assembly logic should be chip-agnostic.
  • DIO flash mode requirement likely carries over for C3 — worth verifying with Espressif's QEMU docs.

Acceptance

fbuild test-emu --emulator qemu \
  --environment esp32c3 \
  --halt-on-success "Starting loop iteration 2" \
  --halt-on-error "Guru Meditation|abort\(\)" \
  --timeout 60 \
  examples/BlinkParallel

completes green on a FastLED esp32c3 project.

Context

Filed from an agent working on the FastLED CI migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions