Skip to content

feat(nxplpc): pick up project-local variants/<variant>/pins_arduino.h#521

Merged
zackees merged 1 commit into
mainfrom
feat/nxplpc-project-local-variant
Jun 9, 2026
Merged

feat(nxplpc): pick up project-local variants/<variant>/pins_arduino.h#521
zackees merged 1 commit into
mainfrom
feat/nxplpc-project-local-variant

Conversation

@zackees

@zackees zackees commented Jun 9, 2026

Copy link
Copy Markdown
Member

Minimum cheap step toward #479 (Stage 3) — gets a real Arduino-style hardware-package project building under fbuild without a full external-framework checkout flow.

What

When the project ships <project>/variants/<variant>/pins_arduino.h next to its platformio.ini (e.g. zackees/ArduinoCore-LPC8xx), the nxplpc orchestrator prepends the variant dir to the include path. The bundled Arduino.h stub gains a __has_include guard that pulls in pins_arduino.h when it's available, transparently surfacing LED_BUILTIN, PIN_SPI_*, etc. Without a project-local variant the include is a no-op — bundled stub behavior is preserved for the existing test fixtures.

Verified locally

Against zackees/ArduinoCore-LPC8xx examples/Blink:

Before:

Blink.ino:5:13: error: 'LED_BUILTIN' was not declared in this scope

After (real artifact emitted):

Board: NXP LPC845-BRK / LPC845 @ 30MHz
Memory: 64.00KB Flash, 16.00KB RAM
Compiled 6/6 files
Compiled 1/1 files
Linking firmware.elf
Building firmware.bin
Flash: 384 bytes / 64.00KB (0.6%)
RAM:   8 bytes / 16.00KB (0.0%)
build succeeded in 1.8s (flash: 384 bytes, ram: 8 bytes)

firmware.bin and firmware.elf produced at the expected path.

Tests

soldr cargo test -p fbuild-build nxplpc --lib
test result: ok. 18 passed; 0 failed

What this does NOT do

Intentionally scoped to the cheapest user-unblock:

  • Does not compile user-provided cores/<core>/ sources — the bundled arduino_stub/ + lpc8xx_main.cpp shim still owns the runtime.
  • Does not honor board_build.ldscript; bundled per-MCU linker script still wins.
  • Does not resolve framework-arduino-lpc8xx via PlatformIO's package manager.

Those are the remaining Stage 3 pieces (#479). Filed separately if anyone wants to take them.

Why this scoping

zackees/ArduinoCore-LPC8xx's fbuild CI is currently red exclusively on LED_BUILTIN. Adding the variant dir to the include path is the surgical fix; full external-framework ingestion is a larger lift that can land independently. Doing the smaller change first means we ship green CI now and can take the bigger refactor when there's time.

Stage-3 hookup, partial (#479).

When the project ships an Arduino-style hardware-package layout next to
its `platformio.ini` (e.g. zackees/ArduinoCore-LPC8xx, with
`<project>/variants/<variant>/pins_arduino.h` + `variant.h`), prepend the
variant dir (and its parent `variants/`) to the nxplpc orchestrator's
include path. The bundled `Arduino.h` stub now ends its preamble with

    #if defined(__has_include)
    #  if __has_include("pins_arduino.h")
    #    include "pins_arduino.h"
    #  endif
    #endif

so when the variant dir is on the include path, the variant's
`pins_arduino.h` -> `variant.h` chain provides `LED_BUILTIN`, `PIN_SPI_*`,
etc. Without a project-local variant, nothing changes — the `__has_include`
guard makes the include a no-op and the bundled stub's behavior is
preserved for the existing fixture-only tests.

## Verified locally

Before this patch, against zackees/ArduinoCore-LPC8xx examples/Blink:

    Blink.ino:5:13: error: 'LED_BUILTIN' was not declared in this scope

After:

    Board: NXP LPC845-BRK / LPC845 @ 30MHz
    Memory: 64.00KB Flash, 16.00KB RAM
    Toolchain: arm-none-eabi-gcc 15.2.1
    Compiled 6/6 files
    Compiled 1/1 files
    Linking firmware.elf
    Building firmware.bin
    Flash: 384 bytes / 64.00KB (0.6%)
    RAM:   8 bytes / 16.00KB (0.0%)
    build succeeded in 1.8s (flash: 384 bytes, ram: 8 bytes)

## Tests

cargo test -p fbuild-build nxplpc --lib: 18 pass, 0 fail.

## What this does NOT do

This is the cheapest user-unblock — it gives the bundled-stub Arduino
core access to the project's variant header. It does NOT yet:

  - Compile user-provided `cores/<core>/` sources (the bundled
    `arduino_stub` + `lpc8xx_main.cpp` shim still owns the runtime).
  - Honor `board_build.ldscript` overrides; the bundled per-MCU linker
    script still wins.
  - Resolve `framework-arduino-lpc8xx` via PlatformIO's package manager
    a la `platform_packages = ...` in `platformio.ini`.

Full Stage 3 (#479) covers those. The remaining bits are mostly
orchestrator-side wiring; this PR is the minimum to flip
zackees/ArduinoCore-LPC8xx's fbuild CI green.
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zackees, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 12 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d7a1a91d-e9c5-42d2-80e2-6545644e07b5

📥 Commits

Reviewing files that changed from the base of the PR and between 5a11abd and b8ce83a.

📒 Files selected for processing (2)
  • crates/fbuild-build/src/nxplpc/assets/arduino_stub/Arduino.h
  • crates/fbuild-build/src/nxplpc/orchestrator.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/nxplpc-project-local-variant

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 731ad29 into main Jun 9, 2026
86 of 87 checks passed
@zackees zackees mentioned this pull request Jun 9, 2026
zackees added a commit that referenced this pull request Jun 9, 2026
Ships #521: nxplpc orchestrator picks up project-local
variants/<variant>/pins_arduino.h so projects with Arduino-style
hardware-package layouts (e.g. zackees/ArduinoCore-LPC8xx) build green
under fbuild.
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 9, 2026
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