Skip to content

boards: lib-select uses the build's nRF52 core; reject boards without the env framework; Renesas flash excludes .id_code - #2070

Merged
zackees merged 4 commits into
mainfrom
fix/board-checks-2042
Nov 18, 2026
Merged

zackees merged 4 commits into
mainfrom
fix/board-checks-2042

Conversation

@zackees

@zackees zackees commented Nov 18, 2026

Copy link
Copy Markdown
Member

Part of #2042 (boards group): item 2, the framework check from #2039 / #2055, and the Renesas flash figure left over from #2065.

Item 2: fbuild lib-select now uses the nRF52 core the build uses

  • fbuild lib-select used to show Adafruit's framework-arduinoadafruitnrf52/libraries for every nRF52 board. Since fix(nrf52): build Seeed XIAO nRF52840 boards against Seeed's core (#2017) #2030, the Seeed XIAO nRF52840 boards build with Seeed's core.
  • New fbuild_build::nrf52::installed_cores (crates/fbuild-build-arm/src/nrf52/mod.rs) picks the core through the existing core_select::selected_framework. It then builds the package with the same nrf52_packages_from_resolved the orchestrator uses, so the env's platform_packages override is applied too. Nothing is downloaded.
  • lib-select resolves the board through fbuild_build::resolution::resolve_board, so board_build.* overrides and project-local boards are honored. That board config now also supplies the board defines, which were previously read without overrides.
  • A separate refactor commit first moves lib-select's nested info helper to module level, so resolve_framework stays under the 100-line clippy limit.

Framework check (from #2039 / #2055)

  • ensure_board_buildable(board_id, framework: Option<&str>) now also rejects a bundled board whose frameworks list is missing a framework named in the env's framework value. That value is comma-separated and matched case-insensitively. PlatformIO's BuildFrameworks (platformio 6.1.18, builder/tools/piobuild.py) stops with "This board doesn't support arduino framework!" in the same case.
  • PlatformIO has no framework aliases here; it compares the names exactly as listed.
  • If the board JSON has no frameworks key, the board is not rejected. Currently no bundled board lacks the key.
  • An empty list ([]) means the board supports no framework, as in PlatformIO. Three boards on supported platforms have one: at90pwm216 and at90pwm316 (atmelavr) and samc21_xpro (atmelsam). They don't build today: on main, at90pwm216 fails in the compiler on pins_arduino.h, and samc21_xpro downloads the 36 MB SAM core and then fails with unsupported SAM MCU.
  • The check runs in two places: in ResolutionContext::resolve_board, which is the build funnel and reads the env's framework, and in the daemon's resolve_env_platform. The free resolve_board and platform_for_board have no env and pass None.
  • With framework = arduino, 101 bundled boards on supported platforms are now rejected. The guard test pins that number, and it checks that the rejected boards are exactly the ones whose list lacks arduino.
  • No board that builds today is rejected:
    • All 95 envs under tests/ were checked, after resolving the esp32c6 and adafruit_grand_central_m4 aliases. Every one that names a framework lists it.
    • tests/platform/ch559 has no framework. Its platform, intel_mcs51, was already rejected.
    • None of FastLED's ci/boards.py boards found in the bundle is rejected.

Renesas flash figure (from #2065)

  • PlatformIO renesas-ra builder/main.py uses SIZEPROGREGEXP=r"^(?:\.text|\.data|\.rodata|\.text.align|\.ARM.exidx)\s+(\d+).*".
  • ArduinoCore-renesas 1.6.0 platform.txt uses recipe.size.regex=^(?:\.data|\.text|\.rodata)\S*?\s+([0-9]+).*, and its compiler.elf2hex.bin.flags=-O binary -j .text -j .data.
  • fsp.ld places .id_code in the ID_CODE region. In variants/MINIMA/memory_regions.ld, ID_CODE_START = 0x01010018 with length 0x20, while FLASH is 0x0–0x40000.
  • So .id_code is neither code flash nor part of firmware.bin. Counting it against the 256 KiB max_flash was wrong.
  • RenesasLinker::report_size now leaves out NON_CODE_FLASH_SECTIONS = [".id_code"] before the generic classification. On the real uno_r4_minima section table, flash goes from 28,060 to 28,032, which matches PlatformIO. RAM stays 4,140.
  • Other platforms are unchanged.

Tests

  • RED first:
    • The new tests failed to compile against main: ensure_board_buildable took one argument, and renesas_size_info and nrf52_framework_libraries did not exist.
    • On main, lib-select mapped every nRF52 board to Nrf52Cores::new, which is Adafruit's core.
  • GREEN:
    • fbuild-config board:: (133 tests)
    • fbuild-build-engine resolution (11)
    • fbuild-core elf_size (16)
    • fbuild-build-arm renesas/nrf52 (78)
    • fbuild-cli lib_select (6)
    • fbuild-daemon handlers::operations (66)
  • Workspace clippy -D warnings is clean, and dylint passes on the touched crates.

E2E (dev mode, scratch projects)

  • fbuild lib-select on xiaoble_adafruit: framework: framework-arduinoadafruitnrf52-seeed @ .../files-Seeed_nRF52_Boards-1.1.13/.... It selected Adafruit_TinyUSB_Arduino, SPI and Wire from the Seeed core.
  • fbuild lib-select on adafruit_feather_nrf52840: framework: framework-arduinoadafruitnrf52 @ .../dl-framework-arduinoadafruitnrf52-1.10601.0/....
  • nrf52840_mdk (Zephyr-only nRF52840) with framework = arduino:
    • On main: it fetched packages and compiled, then failed in the compiler on Adafruit_TinyUSB (FreeRTOS.h: No such file or directory).
    • Now it stops before anything is resolved: board 'nrf52840_mdk' cannot be built by fbuild: it doesn't support the arduino framework (its frameworks: zephyr).
  • at90pwm216 now stops with ... (its frameworks: none). On main it failed in the compiler on pins_arduino.h.
  • Normal blinks still build:
    • tests/platform/nrf52840_dk and a scratch nrf52840_dk blink: 47,308 B flash, 8,584 B RAM.
    • xiaoble_adafruit: 28,348 / 7,476.
    • adafruit_feather_nrf52840: 47,204 / 8,416.
  • uno_r4_minima blink: build succeeded (flash: 28032 bytes, ram: 4140 bytes). It was 28,060 before this change.

Not in scope, found during E2E

  • The nRF52 orchestrator adds the core's SPI and Wire folders as include directories only.
    • SPI.cpp is compiled only for the TinyUSB host adapter. Wire.cpp is never compiled.
    • So a sketch that calls Wire.begin() fails to link (undefined reference to TwoWire::begin()), even though lib-select selects Wire.
    • This is the same before and after this PR: the code is unchanged (crates/fbuild-build-arm/src/nrf52/orchestrator.rs, "Framework library includes").

…mework

Behaviour-preserving: the display-name/libraries/root helper moves to
module level so resolve_framework has room under clippy's too_many_lines
for the nRF52 core selection that follows.

Part of #2042 (boards group).
fbuild lib-select showed Adafruit's libraries folder for every nRF52
board, but the Seeed XIAO nRF52840 boards build with Seeed's core since
#2030. New fbuild_build::nrf52::installed_cores reuses core_select's
selected_framework and the orchestrator's nrf52_packages_from_resolved
(platform_packages override included), without downloading. lib-select
resolves the board through the build funnel, so board_build.* overrides
and project-local boards also apply to its board defines.

Part of #2042 (boards group).
…work

PlatformIO's BuildFrameworks stops with "This board doesn't support
arduino framework!" when the env's framework is not in the board's
frameworks list; fbuild failed late in the compiler instead.
ensure_board_buildable now takes the env's framework (comma-separated,
case-insensitive) and raises UnsupportedBoard for a missing one. A board
JSON without a frameworks key is not checked; an empty list supports no
framework, as in PlatformIO. ResolutionContext::resolve_board and the
daemon's resolve_env_platform pass the env framework.

With framework = arduino this rejects 101 bundled boards on supported
platforms (Zephyr/mbed/ESP-IDF/bare-metal only); every env under tests/
still passes.

Part of #2042 (boards group).
fsp.ld places .id_code in the ID_CODE region (0x01010018), not code
flash, and firmware.bin (-j .text -j .data) does not carry it. Counting
it against the 256 KiB max_flash gave 28,060 on uno_r4_minima; leaving
it out gives 28,032, PlatformIO renesas-ra's SIZEPROGREGEXP figure
(.text|.data|.rodata|.text.align|.ARM.exidx). Other platforms keep the
generic allocated-with-contents classification.

Part of #2042 (boards group).
@coderabbitai

coderabbitai Bot commented Nov 18, 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

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.

1 participant