feat(test-emu): add ESP32-C3 RISC-V QEMU support#90
Conversation
Extend `fbuild test-emu --emulator qemu` to cover the RISC-V ESP32 family
in addition to the existing Xtensa (ESP32 / ESP32-S3) support. This
unblocks FastLED's CI migration off Docker onto the native `fbuild
test-emu` runner for C3/C6/H2 parts.
Changes:
- `fbuild-packages::toolchain::esp_qemu` grows a generic `EspQemu` handle
plus a shared `EspQemuArch` enum (`Xtensa` / `Riscv32`). The existing
`EspQemuXtensa` wrapper keeps the same public API; a new
`EspQemuRiscv32` wrapper ships the RISC-V variant.
* URL pattern and release tag are identical to the Xtensa build
(`esp-develop-9.2.2-20250817`, `qemu-riscv32-softmmu-...`).
* SHA256 checksums verified from the upstream Espressif QEMU release
for all five host targets (mingw, linux x86_64/aarch64, macOS
x86_64/aarch64).
* New `FBUILD_QEMU_RISCV32_PATH` override env var mirrors the
Xtensa one.
* ESP-IDF tools fallback walks `tools/qemu-riscv32/*` in addition
to `tools/qemu-xtensa/*`.
- `fbuild-daemon::handlers::emulator`:
* `is_qemu_supported_esp32_mcu` now accepts `esp32c3`, `esp32c6`,
`esp32h2` via `EspQemuArch::for_mcu`. `esp32s2` remains unsupported
(no upstream machine).
* New `resolve_esp_qemu_for_mcu` helper selects the right binary
based on MCU and replaces the previous hard-coded
`EspQemuXtensa::new` calls in both `deploy_qemu` and `QemuRunner`.
* `select_runner` error messages updated to list both arches.
- `fbuild-deploy::esp32::build_qemu_args`: doc-comment now documents
the expanded MCU set. No functional change required — the function
already emits `-machine <mcu>` / `driver=timer.<mcu>.timg` which
matches what qemu-system-riscv32 expects for C3/C6/H2. PSRAM branch
is a no-op on RISC-V parts (they have no PSRAM).
- README: emulator support matrix + QEMU notes + sample `[env:esp32c3]`
block updated.
Tests:
- 7 passing in `fbuild-packages::toolchain::esp_qemu::tests`
(arch_for_mcu, find_qemu_binary direct/nested for both arches,
Windows iconv hydration)
- 3 new `select_runner_explicit_qemu_accepts_esp32{c3,c6,h2}` plus
`select_runner_explicit_qemu_rejects_esp32s2` — all passing in
`fbuild-daemon::handlers::emulator::tests`
- `is_qemu_supported_esp32_mcu_accepts_riscv` new; the rejection test
now guards s2 + p4
Closes #85.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…m stash Two test fns (prepare_avr8js_script_writes_into_cache_dir and avr8js_cache_marker_points_to_package_json) were pulled in through a stash merge but reference functions that don't exist on this branch. Removing them is purely additive relative to origin/main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 19 minutes and 55 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Extends
fbuild test-emu --emulator qemu(andfbuild deploy --to emu) tocover the RISC-V ESP32 family in addition to the existing Xtensa support.
This unblocks FastLED's CI migration off Docker onto the native
fbuild test-emurunner for ESP32-C3 parts.qemu-system-xtensa):esp32,esp32s3(existing, unchanged)qemu-system-riscv32):esp32c3,esp32c6,esp32h2(new)Closes #85.
What changed
fbuild-packages::toolchain::esp_qemugrew a sharedEspQemuArchenumand a generic
EspQemupackage handle. The existingEspQemuXtensawrapper keeps its public API; a new
EspQemuRiscv32wrapper ships theRISC-V variant. Same upstream release tag (
esp-develop-9.2.2-20250817),archive stem differs (
qemu-riscv32-softmmu-...). SHA256s pulled fromthe upstream release for all five host targets (Windows mingw, Linux
x86_64/aarch64, macOS x86_64/aarch64). New
FBUILD_QEMU_RISCV32_PATHenv override mirrors the Xtensa one.
fbuild-daemon::handlers::emulator:is_qemu_supported_esp32_mcunow delegates toEspQemuArch::for_mcu,which accepts C3/C6/H2 and rejects S2/P4.
resolve_esp_qemu_for_mcuhelper picks the right binary based onMCU and replaces the previous hard-coded
EspQemuXtensa::newcallsin
deploy_qemuandQemuRunner::run.select_runnererror messages updated to list both arches.fbuild-deploy::esp32::build_qemu_argsneeded no functional change —it already emits
-machine <mcu>/driver=timer.<mcu>.timg, whichmatches what
qemu-system-riscv32expects for C3/C6/H2. The doc commentwas updated to reflect the expanded MCU set. PSRAM branch is a no-op on
RISC-V parts.
sample
[env:esp32c3]block updated.Test plan
cargo build --releaseinfbuildroot builds cleanlycargo test --release -p fbuild-packages --lib esp_qemu— 7 passing(new:
arch_for_mcu_maps_xtensa_and_riscv,find_qemu_binary_direct_bin_riscv, plus existing xtensa variants)cargo test --release -p fbuild-daemon --lib handlers::emulator—32 passing, 0 failures including:
select_runner_explicit_qemu_accepts_esp32c3select_runner_explicit_qemu_accepts_esp32c6select_runner_explicit_qemu_accepts_esp32h2select_runner_explicit_qemu_rejects_esp32s2is_qemu_supported_esp32_mcu_accepts_riscvis_qemu_supported_esp32_mcu_rejects_unsupported(s2, p4, atmega328p)examples/Blinksketch foresp32c3inFastLED via
fbuild build -e esp32c3(150.8s cold), then invokedfbuild test-emu --emulator qemu --environment esp32c3. Theqemu-system-riscv32bundle was auto-downloaded, the C3 firmwarebooted into the arduino-esp32 bootloader + app, hit
setup()/loop(),and streamed serial output. No "unsupported MCU" error. The RMT
peripheral subsequently timed out inside
showPixels()— that'sexpected under QEMU (RMT is not fully modeled) and outside the
scope of this PR, which is purely about making the runner
reachable for C3/C6/H2.
Confidence
exercise
select_runnerand package URL synthesis; a hardware-equivalentsmoke run was only done for C3.
and Linux bundles are downloaded on-demand; fbuild will refuse the
install if the SHA doesn't match.
🤖 Generated with Claude Code