Repository navigation
fix(esp32): install the board's SDK variant tree, not just the mcu slice (#1897) - #1898
Merged
Merged
Conversation
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.
Member
Author
|
Fixes #1897. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1897. This is the sole root failure behind the three red checks on #1896
(
ESP32-P4 / build, and theCI selected coverage/CI summaryaggregates).The bug
The per-chip libs slices (#1890 / #1895) fetch a slice keyed on
build.mcuandextract exactly one
tools/esp32-arduino-libs/<mcu>/tree. Butesp32-p4-evboard,esp32-p4,esp32-p4_r3(p4) andm5stack-tab5-p4declarebuild.chip_variant = esp32p4_es, and the build takes every SDK include dir,prebuilt archive, linker script and bootloader from
board.sdk_variant(). So on afresh cache the build had
esp32p4/but noesp32p4_es/:(run 41863325814, job 126692350332 — the other 12 board jobs passed)
sdk_libs_installed(mcu)made it worse by answering "present" for the partialinstall, so
fbuild install --checkwas green too. The whole-bundle path maskedthis entirely: it always extracted all nine chip trees.
The fix
required_sdk_variants(mcu, sdk_variant)— the trees a board links against,mcufirst, 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 offlinefbuild install --checkcan no longer report a partial SDK as installed.PackageErrornaming the variant, instead of asoc_caps.hcompile errorburied in the Arduino core.
Plumbing:
resolve_pioarduino_packagesandprovision_sdk_libstake 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_variantsand the install predicate areunit-tested; the behavioural test is
sdk_libs_installed_requires_the_board_chip_variant_tree(seededesp32p4only →false, plusesp32p4_es→true).RED with the pre-fix semantics stubbed in: 3 failed / 323 passed, panics at
left: ["esp32p4"] right: ["esp32p4", "esp32p4_es"]andassertion failed: !fw.sdk_libs_installed("esp32p4", "esp32p4_es").GREEN:
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):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
x86_64-apple-darwin) clippy here — it fails to linkring/zstd-syson this host; the workspace host clippy is the local gate andlinux / Checkis the authority.esp32p4_esslice (5.3 / 5.4 / 3.3.4 / 3.0.4) fallback 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.