Repository navigation
Description
Motivation
Our emulation test workflows currently compile firmware through PlatformIO, even in cases where fbuild (FastLED's native build tool) would be faster. fbuild drives the compiler directly — no PIO CLI wrapper, no Python platform-manager cycle, better cache behavior (sccache/ccache) — so moving QEMU builds to fbuild should cut per-run build time meaningfully and reduce tool-version flakiness (e.g. the class of problem that produced #2281).
State after #2285:
- AVR8JS Uno: already compiles via fbuild; PR fix(ci): repair all four emulation workflows (ESP32 QEMU + AVR8JS Uno) #2285's
_mirror_fbuild_artifacts_to_pio()copiesfirmware.elf/firmware.hexinto the legacy.pio/build/<env>/path that the workflow consumer reads. This half is done. - ESP32-DEV / C3 / S3 QEMU:
build_with_merged_bin()inci/compiler/pio.pyexplicitly forcesuse_fbuild=False. Reason: fbuild does not producebootloader.binorpartitions.bin— only PlatformIO's ESP-IDF post-build step does — and QEMU needs a merged binary image to boot.
So the remaining work is purely on the ESP32 side, and the blocker is fbuild's lack of bootloader/partitions emission.
Goal
All four emulation workflows build via fbuild end-to-end on master:
- ESP32-DEV QEMU Test
- ESP32-C3 QEMU Test
- ESP32-S3 QEMU Test
- uno AVR8JS Test (already fbuild; keep as baseline)
Expected outcome: measurable wall-clock reduction per QEMU job and fewer PIO-toolchain-version flakes.
Blocker to resolve
ci/compiler/pio.py::build_with_merged_bin() currently contains a workaround (introduced in #2285) that forces PIO to run because fbuild does not emit the bootloader/partitions artifacts required by esptool merge_bin. Any of the following approaches would unblock the switch — an investigator should evaluate them and pick one:
- Have fbuild emit bootloader/partitions natively. Run the ESP-IDF bootloader and partition-table build steps from fbuild using the same toolchain it already drives. Most "correct" long-term answer; biggest up-front investment.
- Cache prebuilt bootloader + partitions per
(board, IDF version, partition layout)tuple. Bootloader contents are deterministic for a given IDF version and board config; partitions come frompartitions.csv. Build them once (via PIO or idf.py) and ship them in the repo or fetch from a cache server. Cheapest if the cache-key is small and stable. - Call
idf.py bootloader/idf.py partition-tableas narrow shell-outs from fbuild. Hybrid: fbuild owns app compile and merged-bin assembly;idf.pybuilds only the two auxiliary artifacts. Avoids reimplementing ESP-IDF build logic inside fbuild. - Teach
esptool merge_binto accept a pre-cached bootloader path via an environment override, so the workflow supplies a known-good bootloader binary and fbuild never has to produce one.
Approach (2) is probably the pragmatic starting point. Approach (1) is the cleanest.
Acceptance criteria
- fbuild produces (or can source from cache)
bootloader.bin+partitions.binfor each ofesp32dev,esp32c3,esp32s3 -
build_with_merged_bin()no longer force-disables fbuild; it uses whichever build tool the caller asked for - All four emulation workflows pass on master using fbuild
-
_mirror_fbuild_artifacts_to_pio()remains only as a compatibility shim for consumers that still read.pio/build/<env>/— or is removed entirely if those consumers are updated to read fbuild's native path - Benchmark: document the per-job wall-clock difference (PIO vs fbuild) for at least one of the three ESP32 workflows in the PR that lands this
Non-goals
- Retiring PIO from other (non-emulation) workflows — out of scope for this issue. Hardware-style CI jobs can continue to use PIO.
- Changing the QEMU / avr8js runner images themselves.
Related
- CI: get all emulation tests (QEMU ESP32-DEV/C3/S3 + AVR8JS Uno) passing on master #2282 (the original failing-emulation issue — recently closed)
- fix(ci): repair all four emulation workflows (ESP32 QEMU + AVR8JS Uno) #2285 (the artifact-mirror + force-PIO workaround that this issue aims to replace)
- CI: esp32c2 (and possibly other esp32 workflows) fail because platformio==6.1.18 is incompatible with pioarduino espressif32 stable #2281 (platformio core version drift — the kind of flake fbuild migration reduces exposure to)
Suggested kickoff
Start by reading ci/compiler/pio.py around build_with_merged_bin() and the _mirror_fbuild_artifacts_to_pio() helper, plus ci/util/fbuild_runner.py, to understand exactly where the PIO dependency is today. From there, evaluate approach (2) first — a cache of prebuilt bootloader/partitions artifacts is likely the smallest viable change.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
perf(ci): use fbuild for ESP32 QEMU merged-bin builds
feat(ci): cache ESP32 bootloader/partitions to enable fbuild for QEMU (…
zackees commentedon Apr 18, 2026
Resolved on master. The blocker this issue described —
build_with_merged_bin()force-disabling fbuild because fbuild didn't emit bootloader/partitions — was already fixed by:perf(ci): use fbuild for ESP32 QEMU merged-bin buildsremoved the force-disablerefactor(ci): drop fbuild→.pio mirror; read merged-bin from active backenddeleted_mirror_fbuild_artifacts_to_piobootloader.bin/partitions.binThe QEMU workflow templates already use
fbuild test-emu. No caching layer is needed on current master; the benchmark ask in the original issue is also moot since there's no PIO-fallback path left to compare against.Closing as already-resolved.