Skip to content

Build nRF52840 DK fails: variant nRF52DK absent in installed Adafruit framework #321

Description

@zackees

Symptom

Build nRF52840 DK fails on every main push with:

fatal error: variant.h: No such file or directory
cores/nRF5/Uart.h:27:10
   27 | #include "variant.h"

Run: https://github.com/FastLED/fbuild/actions/runs/26694160451

Root cause

fbuild ships one nRF52 framework — Adafruit's framework-arduinoadafruitnrf52 (hardcoded URL in crates/fbuild-packages/src/library/nrf52_core.rs).

The nrf52840_dk board JSON declares build.variant = "nRF52DK" (matching PIO upstream — the board-validator agrees). But the Adafruit framework doesn't have a variants/nRF52DK/ directory. It has variants/pca10056/ instead — PCA10056 is Nordic's product code for the nRF52840-DK, so it's the right hardware. Verified via GitHub API: GET /repos/adafruit/Adafruit_nRF52_Arduino/contents/variants?ref=1.6.1 lists pca10056, no nRF52DK.

variants/nRF52DK/ is in the other nRF52 Arduino framework: sandeepmistry's arduino-nRF5 (the one PIO actually selects for this board). fbuild doesn't ship that one.

Result: cores/nRF5/Uart.h does #include "variant.h", gcc's include search walks the (nonexistent) variants/nRF52DK/ directory, finds nothing, link breaks.

Fix options

Option Pros Cons
A. Per-framework variant aliases: add a small nRF52DK → pca10056 map in SamdCores::get_variant_dir's nrf52 counterpart. Falls back when the literal name is missing. Surgical; preserves PIO-matching board JSON; doesn't pull in a second framework download. Each new "fbuild claims it but Adafruit framework has a different name for it" board needs an entry.
B. Install sandeepmistry's framework alongside Adafruit's; pick based on board. True "supports the full nRF52 board catalog". New download, new resolver, ~3x more code; the sandeepmistry framework is in maintenance mode and lags.
C. Change nrf52840_dk board JSON to variant = "pca10056". One-line fix. Breaks board-validator (diverges from PIO upstream); makes the board JSON lie about its PIO compatibility.
D. Remove nrf52840_dk from the test matrix and bundled boards. Eliminates the broken claim. Loses a board fbuild was supposedly supporting.

Recommended: A. Same shape as the #319 fix for SAMD's get_core_dir (Adafruit-branded build.core = "adafruit" falling back to cores/arduino/). Both bugs are the same pattern: PIO upstream names a thing one way, the installed framework names it differently, fbuild's lookup didn't paper over the difference.

Test plan

  • Unit test get_variant_dir fallback: given a synthetic framework with only variants/pca10056/, get_variant_dir("nRF52DK") should resolve to .../variants/pca10056/.
  • Integration: Build nRF52840 DK workflow turns green on next main push.
  • Sanity-check the other nRF52 workflows (Adafruit Feather NRF52840 Sense, etc.) continue to pass (their board JSONs use Adafruit-native variant names so they should be unaffected by the fallback).

Refs #319 (same shape, SAMD platform).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions