Repository navigation
perf(ci): use fbuild for ESP32 QEMU merged-bin builds - #2292
Conversation
fbuild's ESP32 orchestrator (>= 2.1.7) already emits bootloader.bin, partitions.bin, and boot_app0.bin alongside firmware.bin. PR #2285 conservatively disabled fbuild for merged-bin builds based on an earlier assumption that those artifacts were PIO-only; that assumption no longer holds. - Extend _mirror_fbuild_artifacts_to_pio() to also mirror the three ESP32 boot/partition artifacts from .fbuild/build/<env>/release/ into the legacy .pio/build/<env>/ path. - Drop the use_fbuild=False force-override inside build_with_merged_bin() so the compiler honors whichever build tool the caller asked for. Verified locally: - bash compile esp32s3 --examples Blink produces firmware.bin, bootloader.bin, partitions.bin, boot_app0.bin in both the fbuild release dir and the mirrored .pio/build/<env>/ path. - esptool merge-bin produces a valid 4MB image (0xE9 magic at both bootloader and app offsets) directly from fbuild's artifacts. - bash test --cpp: 300/300 pass. - bash lint (Python): clean. Refs #2287 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
📝 WalkthroughWalkthroughUpdated fbuild-to-PlatformIO artifact mirroring in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ci/compiler/pio.py (1)
1193-1210: Removal ofuse_fbuild=Falseoverride is sound; one stale docstring to tidy.Routing through
_internal_build_no_lockcorrectly honorsself.use_fbuild:
- fbuild path →
_build_with_fbuild→ now mirrors the full artifact set into.pio/build/<env>/via the updated_mirror_fbuild_artifacts_to_pio.- PIO path →
_init_platformio_buildrunspio runproducing the artifacts in.pio/build/<env>/before_internal_build_no_lockreturns “Built during initialization”.Minor drift worth addressing while you're here:
_internal_build_no_lock's docstring at line 708 still says "Only call from build()", butbuild_with_merged_binis now a second legitimate caller. Either relax the docstring or add a brief note explaining the merged-bin call site.✏️ Suggested docstring tweak
def _internal_build_no_lock( self, example: str, cancelled: threading.Event ) -> SketchResult: - """Build a specific example without lock management. Only call from build().""" + """Build a specific example without lock management. + + Intended callers: ``build()`` (normal per-example path) and + ``build_with_merged_bin()`` (single-example merged-bin path). Callers + are responsible for any lock management. + """🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci/compiler/pio.py` around lines 1193 - 1210, Update the _internal_build_no_lock docstring to reflect that it is called from both build() and build_with_merged_bin (not only build()); locate the _internal_build_no_lock function and change the docstring text to either list both legitimate callers or phrase it generically (e.g., "Callers include build() and build_with_merged_bin") so the documentation matches current usage and avoids implying a single allowed caller.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ci/compiler/pio.py`:
- Around line 1193-1210: Update the _internal_build_no_lock docstring to reflect
that it is called from both build() and build_with_merged_bin (not only
build()); locate the _internal_build_no_lock function and change the docstring
text to either list both legitimate callers or phrase it generically (e.g.,
"Callers include build() and build_with_merged_bin") so the documentation
matches current usage and avoids implying a single allowed caller.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0c86ba40-00c9-4f7b-89b1-3db21c266b66
📒 Files selected for processing (1)
ci/compiler/pio.py
… mirror Replaces the ``_mirror_fbuild_artifacts_to_pio`` workaround with a direct read from whichever backend produced the artifacts. Adds ``PioCompiler._artifacts_dir(env_name)`` returning either ``.fbuild/build/<env>/release/`` (when use_fbuild=True) or ``.pio/build/<env>/`` (PlatformIO). ``build_with_merged_bin`` and ``get_merged_bin_path`` both use the helper, so esptool merge_bin runs against fbuild's output without any cross-directory copy. The mirror was added in #2285 and extended in #2292 to bridge fbuild output into ``.pio/build/`` so legacy consumers (QEMU/AVR8JS workflows, crash decoder, ``build_with_merged_bin``) kept working. The new ``fbuild test-emu`` workflows (#2296) read fbuild's release dir directly, leaving ``build_with_merged_bin`` as the only remaining consumer — and that is now also fbuild-aware, so the mirror has no callers left. Diagnostic dump in the missing-artifacts branch now labels the active backend's dir explicitly and lists both possible locations, so the debug story when artifacts vanish is at least as good as before. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`ci/ci-cppcheck.py` shells out to `pio check`, which requires a fully
populated PlatformIO project tree. Boards now compiled by fbuild don't
get their partition CSVs (e.g. `huge_app.csv`) written into the PIO
project dir, so `pio check` fails in CMake configure:
Missing partition table file `.../.build/pio/esp32c2/huge_app.csv`
UserSideException: Processing esp32c2 ...
This has kept esp32c2 red on master since #2292 (2026-04-18) and blocks
PR #2300.
Short-term: detect fbuild output presence by testing
`.build/.fbuild/build/<env>/release/` (the fbuild artifact dir returned
by `PioCompiler._artifacts_dir` in `ci/compiler/pio.py`). When that
directory exists for the target board, skip `pio check` with a visible
SKIP notice and return 0 rather than fail CI.
This accepts a temporary cppcheck-coverage gap on fbuild-default boards
(esp32c2 today, s3/c3/c6 on deck) until the proper clang-tool-chain-bin
integration lands — tracked by:
- #2301 — fbuild cppcheck support
- #2302 — esp32c2 CI regression (closed by this commit)
- #2303 — umbrella: clang-tool-chain-bin for IWYU + cppcheck +
other linting tools
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…CI (#2305) `ci/ci-cppcheck.py` shells out to `pio check`, which requires a fully populated PlatformIO project tree. Boards now compiled by fbuild don't get their partition CSVs (e.g. `huge_app.csv`) written into the PIO project dir, so `pio check` fails in CMake configure: Missing partition table file `.../.build/pio/esp32c2/huge_app.csv` UserSideException: Processing esp32c2 ... This has kept esp32c2 red on master since #2292 (2026-04-18) and blocks PR #2300. Short-term: detect fbuild output presence by testing `.build/.fbuild/build/<env>/release/` (the fbuild artifact dir returned by `PioCompiler._artifacts_dir` in `ci/compiler/pio.py`). When that directory exists for the target board, skip `pio check` with a visible SKIP notice and return 0 rather than fail CI. This accepts a temporary cppcheck-coverage gap on fbuild-default boards (esp32c2 today, s3/c3/c6 on deck) until the proper clang-tool-chain-bin integration lands — tracked by: - #2301 — fbuild cppcheck support - #2302 — esp32c2 CI regression (closed by this commit) - #2303 — umbrella: clang-tool-chain-bin for IWYU + cppcheck + other linting tools Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Completes the QEMU→fbuild migration tracked in #2287.
Approach chosen: option (1) from #2287 — "have fbuild emit bootloader/partitions natively" — which turns out to already be done in the currently-pinned fbuild (>=2.1.12 per `pyproject.toml`; installed 2.1.16). Reading `fbuild/crates/fbuild-build/src/esp32/orchestrator.rs` shows step 14 "Prepare boot artifacts for deployment / emulation" already writes `bootloader.bin`, `partitions.bin`, and `boot_app0.bin` into `.fbuild/build//release/` alongside `firmware.bin`. The assumption in PR #2285 that fbuild does not emit those files is stale.
So this PR is just plumbing:
No changes needed to the QEMU workflow templates — they still read from `.pio/build//` and the mirror puts the files there.
No changes needed to FastLED/fbuild.
Verification (local)
Remaining (CI)
Test plan
Refs #2287
🤖 Generated with Claude Code
Summary by CodeRabbit