Repository navigation
fix(nrf52): defer PCA10056 pin map when community TARGET_* override is set - #2627
Conversation
…s set SuperMini / nice!nano v2 / nRFMicro all reuse the nrf52840_dk_adafruit BSP via ci/boards.py, so the Adafruit BSP auto-defines ARDUINO_NRF52840_PCA10056 alongside the community TARGET_* override. Both blocks then defined FastPin<0..>, tripping the #error guard and producing redefinition diagnostics. Gate the PCA10056 block on the absence of TARGET_SUPERMINI_NRF52840 / TARGET_NICE_NANO_V2 / TARGET_NRFMICRO so the explicit override wins over the BSP default. Closes #2626 Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a preprocessor sentinel that detects community nRF52 TARGET_* overrides and gates the ARDUINO_NRF52840_PCA10056 pin-mapping block so community-target mappings take precedence; also adds a manual ChangesnRF52 Board Pin-Mapping Priority
CI Workflow: nrf52840_supermini
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h`:
- Line 352: Update the inline comment that currently references issue `#2422` to
instead reference issue `#2626` so it correctly documents the gate fixing the
build failure from conflicting pin definitions; locate the comment containing
"PCA10056 pin map (see issue `#2422`)" in fastpin_arm_nrf52_variants.h and replace
the issue number with "`#2626`" while preserving the rest of the sentence and
context.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5fba35f2-8bb8-4234-bf56-82b313cc2031
📒 Files selected for processing (1)
src/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h
Address review feedback on #2627: replace the three inline !defined(TARGET_*) clauses on the PCA10056 guard with a single __FASTLED_NRF52_USER_TARGET_OVERRIDE sentinel defined once at the top of the file. Adding a new community-board TARGET_* now requires extending exactly one OR-chain instead of editing every BSP-default block that might need to defer to it. Also documents the layering choice (header guard vs. -UARDUINO_NRF52840_PCA10056 in ci/boards.py) — header-side guard works for non-PlatformIO consumers who set TARGET_* by hand. Co-Authored-By: Claude Opus 4.7 <[email protected]>
The push-master-only trigger meant the FastPin redefinition fix on this PR could not be exercised by CI until merge. Adding workflow_dispatch lets us run the build against PR branches for pre-merge verification. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…2638) Follow-up to #2636. After switching `xiaoblesense_adafruit` to reuse the `nrf52840_dk_adafruit` BSP variant (which defines `ARDUINO_NRF52840_PCA10056`), the master post-merge build failed with "#error Cannot define more than one board at a time": both the PCA10056 pin map block and the new TARGET_XIAOBLE block fired. Same shape as PR #2627 fixed for SuperMini / nice!nano / nRFMicro. Add `TARGET_XIAOBLE_NRF52840_SENSE` to the `__FASTLED_NRF52_USER_TARGET_OVERRIDE` OR-chain at the top of `fastpin_arm_nrf52_variants.h` so the PCA10056 block stands down when the XIAO target is set. Refs #2634 (#2636 post-merge run 26700041082). Co-authored-by: Claude Opus 4.7 <[email protected]>
Summary
SUPERMINI_NRF52840,NICE_NANO_NRF52840, andNRFMICRO_NRF52840all reuse thenrf52840_dk_adafruitBSP viaci/boards.py, so the Adafruit BSP auto-definesARDUINO_NRF52840_PCA10056alongside the communityTARGET_*override.fl::FastPin<0..>, tripping the#error "Cannot define more than one board at a time"guard plus C++ redefinition diagnostics — see the pre-fix CI run.ARDUINO_NRF52840_PCA10056block on a single__FASTLED_NRF52_USER_TARGET_OVERRIDEsentinel (set when anyTARGET_*is in scope) so the explicit user override wins over the BSP-supplied default. No behavior change for any board that does not set one of the threeTARGET_*macros.Closes #2626.
Test plan
bash compile supermini_nrf52840 --examples Blink— gets past the FastPin redefinition error this PR targets.bash lintclean.nrf52840_superminitriggered on this branch (run 26699376709) confirms the FastPin redefinition is resolved — compilation now completes and the build proceeds to the LTO link phase, where it hits a pre-existingError: offset out of range(binary too large for ARM Thumb branch range). That size/link failure is out of scope for this PR per the loop instructions ("don't fix the boards failing size checks"); the supermini workflow will remain red on size until size is addressed separately, but the underlying compile bug this PR targets is verifiably fixed.nrf52840_dk/nrf52_xiaoblesensefailures are a different fbuild-sidevariant.h: No such file or directorybug tracked separately (nrf52: nrf52840_dk fails to build — Adafruit BSP cores cannot find variant.h #2631, nrf52: nrf52_xiaoblesense fails to build — Adafruit BSP cores cannot find variant.h #2633).adafruit_feather_nrf52840_sensealso fails on the same size/link issue (nrf52: adafruit_feather_nrf52840_sense fails to build — Adafruit BSP cores cannot find variant.h #2632 closed as a size failure).Reviewer follow-ups addressed
Pushed an iteration commit collapsing the three inline
!defined(TARGET_*)guards into a single__FASTLED_NRF52_USER_TARGET_OVERRIDEsentinel after second-opinion review flagged the hand-maintained allowlist as a maintenance smell. Now adding a new community-boardTARGET_*requires extending exactly one OR-chain.🤖 Generated with Claude Code