Skip to content

fix(esp32): install the board's SDK variant tree, not just the mcu slice (#1897) - #1898

Merged
zackees merged 1 commit into
mainfrom
agent/1897-p4-slice-variant
Nov 4, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1897-p4-slice-variant

Conversation

@zackees

@zackees zackees commented Nov 4, 2026

Copy link
Copy Markdown
Member

Fixes #1897. This is the sole root failure behind the three red checks on #1896
(ESP32-P4 / build, and the CI selected coverage / CI summary aggregates).

The bug

The per-chip libs slices (#1890 / #1895) fetch a slice keyed on build.mcu and
extract exactly one tools/esp32-arduino-libs/<mcu>/ tree. But esp32-p4-evboard,
esp32-p4, esp32-p4_r3(p4) and m5stack-tab5-p4 declare
build.chip_variant = esp32p4_es, and the build takes every SDK include dir,
prebuilt archive, linker script and bootloader from board.sdk_variant(). So on a
fresh cache the build had esp32p4/ but no esp32p4_es/:

variants/esp32p4/pins_arduino.h:5:10: fatal error: soc/soc_caps.h: No such file or directory

(run 41863325814, job 126692350332 — the other 12 board jobs passed)

sdk_libs_installed(mcu) made it worse by answering "present" for the partial
install, so fbuild install --check was green too. The whole-bundle path masked
this entirely: it always extracted all nine chip trees.

The fix

  • required_sdk_variants(mcu, sdk_variant) — the trees a board links against,
    mcu first, the chip variant appended when it differs.
  • ensure_libs(libs_url, mcu, sdk_variant) — completes every required tree,
    fetching each missing one as its own slice. Between fetches it re-checks, so a
    whole-bundle archive (and any release with no slice for that chip) still costs a
    single download.
  • sdk_libs_installed(mcu, sdk_variant) — requires all of them, so the offline
    fbuild install --check can no longer report a partial SDK as installed.
  • A chip-variant tree still missing after the fetch is a hard
    PackageError naming the variant, instead of a soc_caps.h compile error
    buried in the Arduino core.

Plumbing: resolve_pioarduino_packages and provision_sdk_libs take the board
(or its variant) from the caller that already has it, so no new lookups.

Tests (TDD, RED first)

missing_sdk_variants / required_sdk_variants and the install predicate are
unit-tested; the behavioural test is
sdk_libs_installed_requires_the_board_chip_variant_tree (seeded esp32p4 only →
false, plus esp32p4_es → true).

RED with the pre-fix semantics stubbed in: 3 failed / 323 passed, panics at
left: ["esp32p4"] right: ["esp32p4", "esp32p4_es"] and
assertion failed: !fw.sdk_libs_installed("esp32p4", "esp32p4_es").

GREEN:

fbuild-library --lib:    326 passed; 0 failed; 7 ignored
fbuild-build-esp --lib:  214 passed; 0 failed; 1 ignored
fmt --check:             clean
test layout:             ok (8 categories)
platform boundary:       rows=44; dylint_rows=43 (rc 0)
LOC:                     build.rs 1000->996, packages.rs 994->999, libs.rs 500->595, tests.rs 719->765

End-to-end on a fresh cache

Isolated FBUILD_CACHE_DIR, mirror manifest on, same board/env as CI
(fbuild build tests/platform/esp32p4 -e esp32p4 --quick):

tools/.libs-archives/af2a031d…/framework-arduinoespressif32-libs@core-3.3.12+esp32p4/
tools/.libs-archives/af2a031d…/framework-arduinoespressif32-libs@core-3.3.12+esp32p4_es/
tools/esp32-arduino-libs/esp32p4/include/soc/esp32p4/include/soc/soc_caps.h
tools/esp32-arduino-libs/esp32p4_es/include/soc/esp32p4/include/soc/soc_caps.h
Compiled 60/60 files → build succeeded in 7.8s

Before the fix the same setup is exactly the CI failure above. Note the cost win
is preserved: two ~82 MB slices (164 MB) instead of the 3 GB whole bundle.

Deliberately not done

  • No cross-target (x86_64-apple-darwin) clippy here — it fails to link
    ring/zstd-sys on this host; the workspace host clippy is the local gate and
    linux / Check is the authority.
  • Older libs releases with no esp32p4_es slice (5.3 / 5.4 / 3.3.4 / 3.0.4) fall
    back to the whole bundle for that variant, which is correct but downloads 3 GB.
    Teaching the fetch layer to prefer a whole bundle when any required variant has
    no slice is a separate follow-up, not smuggled in here.

Per-chip libs slices ship exactly one `esp32-arduino-libs/<chip>/` tree, and
`ensure_libs` asked for it by `build.mcu`. ESP32-P4 ES boards
(`esp32-p4-evboard` and friends) declare `build.chip_variant = esp32p4_es`,
and every SDK include/lib/ld path comes from `board.sdk_variant()`, so a fresh
cache had `esp32p4/` but no `esp32p4_es/`: `ESP32-P4 / build` died on
`variants/esp32p4/pins_arduino.h: soc/soc_caps.h: No such file or directory`
on every PR that selected the board (#1897).

`ensure_libs`/`sdk_libs_installed` now take the board's SDK variant and
require every tree the build links against; missing variants are fetched as
their own slice, re-checking between fetches so a whole-bundle archive still
costs one download. `sdk_libs_installed` stops reporting "present" for a
partial install, and a chip-variant tree that is still missing after the fetch
fails with an actionable error instead of a compile error much later.
@zackees

zackees commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Fixes #1897.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@zackees
zackees added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 1d60923 Nov 4, 2026
39 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 5, 2026
@zackees
zackees deleted the agent/1897-p4-slice-variant branch November 5, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

fix(esp32): per-chip libs slices install only mcu, so ESP32-P4 ES boards have no esp32p4_es SDK tree

1 participant