Skip to content

fix(board-db): add build.extra_flags for nRF52840 boards (Arduino macros)#299

Merged
zackees merged 1 commit into
mainfrom
fix/nrf52840-extra-flags
May 30, 2026
Merged

fix(board-db): add build.extra_flags for nRF52840 boards (Arduino macros)#299
zackees merged 1 commit into
mainfrom
fix/nrf52840-extra-flags

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented May 30, 2026

Summary

board added
nrf52840_dk -DARDUINO_NRF52_DK
nrf52840_dk_adafruit -DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA
adafruit_feather_nrf52840_sense -DARDUINO_NRF52840_FEATHER_SENSE -DNRF52840_XXAA

This unblocks FastLED nrf52840_dk, nrf52840_supermini (via real_board_name="nrf52840_dk_adafruit"), and adafruit_feather_nrf52840_sense workflows.

The full sweep — every other bundled board missing extra_flags, including the rest of the nRF52 family — is a separate follow-up tracked at #298 (re-run enrich_boards end-to-end to import extra_flags for everything).

Test plan

  • cargo check -p fbuild-config clean.
  • cargo test -p fbuild-config --lib board:: — 56/56 (was 53/53 before; +3 regression tests).
  • CI on FastLED side: nrf52840_dk, nrf52840_supermini, adafruit_feather_nrf52840_sense workflows should now reach actual compilation past the static_assert.

Refs #298

Generated with Claude Code (https://claude.com/claude-code)

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced nRF52840 board support with updated compiler definitions for Adafruit Feather, DK, and DK Adafruit variants.
  • Tests

    • Added unit tests to verify correct compiler definitions are applied for nRF52840 boards.

Review Change Stack

…ros)

Three nRF52840 board JSONs in the bundled DB were missing
`build.extra_flags`, so the Arduino board-detection macros that
FastLED's `platforms/arm/nrf52/fastpin_arm_nrf52_variants.h` keys on
were never defined. Every nRF52 build fell through to the
"Unknown nRF52840 variant" fallback block (which marks many pins
invalid), and `examples/Apa102/Apa102.ino` blew up at
`fl/system/fastpin_base.h:146` with
`static assertion failed: This pin has been marked as an invalid pin`.

Restore `extra_flags` from the upstream PlatformIO board JSONs:

  nrf52840_dk                      -> -DARDUINO_NRF52_DK
  nrf52840_dk_adafruit             -> -DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA
  adafruit_feather_nrf52840_sense  -> -DARDUINO_NRF52840_FEATHER_SENSE -DNRF52840_XXAA

This unblocks FastLED's `nrf52840_dk`, `nrf52840_supermini` (via
`real_board_name="nrf52840_dk_adafruit"`), and
`adafruit_feather_nrf52840_sense` workflows.

Adds three regression tests (`test_nrf52840_dk_carries_arduino_macro`,
`test_nrf52840_dk_adafruit_carries_arduino_macro`,
`test_adafruit_feather_nrf52840_sense_carries_arduino_macro`) that
assert each board's `get_defines()` includes the expected
`ARDUINO_<BOARD>=1` keys. Full board suite passes 56/56.

Tracking the broader gap (many other bundled boards also missing
`extra_flags` — full nRF52 family, IAP*, LGT8F*, etc.) at #298 so
this PR can stay minimal and focused on the immediate FastLED unblock.

Refs #298
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fb037f78-6c75-4a7f-af04-45ff94ed4721

📥 Commits

Reviewing files that changed from the base of the PR and between 4f315ff and f4d0b2b.

📒 Files selected for processing (4)
  • crates/fbuild-config/assets/boards/json/adafruit_feather_nrf52840_sense.json
  • crates/fbuild-config/assets/boards/json/nrf52840_dk.json
  • crates/fbuild-config/assets/boards/json/nrf52840_dk_adafruit.json
  • crates/fbuild-config/src/board/tests.rs

📝 Walkthrough

Walkthrough

Adds compile-time preprocessor flags (extra_flags) to three nRF52840 board configurations and introduces three unit tests that verify BoardConfig::get_defines() includes the expected Arduino-specific macro definitions for each board variant.

Changes

nRF52840 Board Configuration Flags

Layer / File(s) Summary
Board configuration flags
crates/fbuild-config/assets/boards/json/adafruit_feather_nrf52840_sense.json, crates/fbuild-config/assets/boards/json/nrf52840_dk.json, crates/fbuild-config/assets/boards/json/nrf52840_dk_adafruit.json
Adds extra_flags entries under build.core to each of three nRF52840 board JSON files, defining board-specific Arduino preprocessor symbols (ARDUINO_NRF52_DK, ARDUINO_NRF52840_FEATHER_SENSE, ARDUINO_NRF52840_PCA10056) and device family markers (NRF52840_XXAA).
Board configuration tests
crates/fbuild-config/src/board/tests.rs
Introduces three regression tests validating that BoardConfig::get_defines() correctly extracts and returns the expected Arduino and nRF52840 preprocessor macros for each board variant.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

  • #298: Directly restores the missing build.extra_flags configuration for these nRF52840 board variants and adds comprehensive test coverage for BoardConfig::get_defines() to prevent regression.

Poem

🐰 Three boards now wear their flags with pride,
Arduino macros compile-time-supplied,
The tests stand guard to keep them true,
So nRF52840s know just what to do!
Simple, clean, and oh-so-bright. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding build.extra_flags configuration entries to three nRF52840 board JSON files to define Arduino compiler macros.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nrf52840-extra-flags

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees zackees merged commit 7057e21 into main May 30, 2026
82 of 83 checks passed
@zackees zackees deleted the fix/nrf52840-extra-flags branch May 30, 2026 16:02
zackees added a commit that referenced this pull request May 30, 2026
…298) (#312)

PR #299 unblocked FastLED CI for 3 priority nRF52840 boards by patching
their JSONs manually. This is the follow-up broader sweep: re-runs
enrich_boards (now with proper merge semantics) to restore
build.extra_flags on every board family fbuild already shipped without
the Arduino macros they need.

Changes:

* enrich_boards.rs: merge PIO-supplied build/upload fields into the
  existing fbuild JSON rather than wholesale replacing them. This
  preserves fbuild-only fields PIO no longer ships (e.g. legacy
  arduino.ldscript that PIO has moved into SCons builder scripts) while
  still picking up extra_flags, vid/pid, partitions, etc.
* 601 board JSONs touched across 16 platforms: intel_mcs51 (264),
  atmelsam (81), libretiny (47), nordicnrf52 (45), microchippic32 (39),
  espressif32 (35), nordicnrf51 (14), timsp430 (13),
  freescalekinetis (12), maxim32 (9), infineonxmc (8), ststm8 (8),
  lgt8f (7), nxpimxrt (6), nxplpc (6), siliconlabsefm32 (5). Most gain a
  full extra_flags string with ARDUINO_<BOARD> / NRF52840_XXAA / etc.
* tests: add test_nrf52840_sweep_arduino_macros covering the remaining
  Adafruit nRF52840 family (feather/clue/itsybitsy/metro/ledglasses/
  circuitplay) and test_non_nrf52_sweep_arduino_macros covering SAMD
  (zero/mkrzero/adafruit_feather_m0), 8051 (AT89S51), and PIC32
  (chipkit_uc32).

Validation:
* uv run python ci/validate_boards.py: 247 drift failures (down from
  817 on main) -- remaining "extra in our asset" entries are
  intentional fbuild-only fields (e.g. build.arduino.ldscript).
* soldr cargo check / clippy --workspace --all-targets -D warnings: pass
* bash ./test (full workspace): 0 failures across all crates

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant