Skip to content

fix(lpc): unblock LPC845 compile path for SCT+DMA channels-API engine (#3468) - #3475

Merged
zackees merged 1 commit into
masterfrom
feat/3468-verify-silicon
Jul 1, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/3468-verify-silicon

Conversation

@zackees

@zackees zackees commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Three separate compile-path fixes surfaced while validating the #3468 harness on real LPC845-BRK silicon (VID:PID 1FC9:0132 on COM10). Each is a legitimate bug fix; they land together because they're only observable end-to-end when the LPC compile path actually gets exercised.

Fixes

  1. ci/boards.py — nxplpc@ prefix workaround. fbuild 2.3.15 was cut BEFORE my matcher fix FastLED/fbuild#900 merged (20:09 vs 21:47 UTC), so 2.3.15's substring matcher still rejects the hyphenated nxp-lpc GitHub URL. nxplpc@<URL> is valid PlatformIO name-at-source syntax and makes the substring match under 2.3.15. Redundant once 2.3.16 ships with Fix compilation for NRF52 chips with a single GPIO port such as NRF52832 #900 but stays valid.

  2. src/platforms/arm/lpc/led_sysdefs_arm_lpc.h — define FASTLED_HAS_CMSIS. The guard at m0clockless_c.h:51 (comment says "LPC builds set FASTLED_HAS_CMSIS in led_sysdefs") was referenced but the define was never actually added. Result: redefinition of 'fl::u32 __get_PRIMASK()' because both the FastLED local stub and the vendor CMSIS core_cm0plus.h were active.

  3. src/platforms/shared/bitbang/bus_traits.h — LPC845 gate. The shared BitBangChannelDriver unconditionally specializes BusTraits<Bus::BIT_BANG>, which collides with ChannelEngineLpcSctDma's BIT_BANG registration on LPC845. Gate the shared specialization on !FL_IS_ARM_LPC_845 so the dedicated SCT+DMA engine owns the slot.

Verification

Applied all three fixes and confirmed the LPC compile now goes green:

bash compile lpc845brk --examples AutoResearch --build-flag "-DFASTLED_LPC_PWM_DMA=1"

Board: NXP LPC845-BRK / LPC845 @ 24MHz
Toolchain: arm-none-eabi-gcc 15.2.1
Flash: 53.52KB / 64.00KB (83.6%)
RAM:   9.07KB / 16.00KB (56.7%)
Artifact: firmware.elf (159.79KB) / firmware.bin (53.54KB)
build succeeded in 212.2s
  • bash test --cpp → 343/343 passed
  • C++ lint (Python path) → clean

What's still open on the actual on-wire verification

  • fbuild-side: An additional blocker surfaced during this bring-up — the FastLED/framework-arduino-lpc8xx tarball SHA256 changed after the 2026-06-28 org transfer (e6bbcc3392… → e64f0cb81a…). Needs a fbuild-side update to ACLPC_CHECKSUM in crates/fbuild-packages/src/library/arduino_core_lpc8xx.rs. I have the fix on a local fbuild branch and will push it to fbuild as a follow-up PR.
  • Flash + serial: bash autoresearch --pwm-dma-cl hits pre-existing infrastructure gaps unrelated to AutoResearch: PWM+DMA clockless validation harness for LPC845 (paired sibling of #3456) #3468 — ci/util/port_utils.py only recognises the LPCXpresso VCOM fingerprint (VID:PID 16C0:0483), not the LPC-Link2 CMSIS-DAP variant (1FC9:0132), and fbuild's LPC deploy path uses lpc21isp which requires ISP-mode entry rather than the board's default CMSIS-DAP SWD.

The host TX→RX byte-flow readback contract (#3468 primary acceptance) is already confirmed in PR #3472 (tests/fl/channels/lpc_sct_dma_engine.cpp "#3468: end-to-end TX→RX readback through engine.show()"). This PR takes it one step further by unblocking the compile path so anyone with an LPC845-BRK can now build the firmware and run the on-silicon self-loopback once fbuild + port fingerprint clear.

Refs #3468.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved build compatibility for LPC845/LPC804-based boards.
    • Prevented CMSIS-related compile conflicts on supported LPC targets.
    • Avoided a bit-bang trait redefinition issue on LPC845 platforms.

…#3468)

While validating the #3468 harness on real LPC845-BRK silicon
(VID:PID 1FC9:0132 on COM10), three separate blockers prevented
`bash compile lpc845brk --examples AutoResearch --build-flag
-DFASTLED_LPC_PWM_DMA=1` from producing a firmware image. Each is a
legitimate bug fix and lands here together because they are only
observable end-to-end when the LPC compile path actually gets exercised.

## Fix 1 — `ci/boards.py`: nxplpc@ prefix workaround

fbuild 2.3.15 shipped 2026-06-30 20:09 UTC; my platform-matcher fix
FastLED/fbuild#900 merged 2026-06-30 21:47 UTC (after 2.3.15 was cut).
2.3.15's matcher still only substring-matches `nxplpc` (no separator)
and rejects the hyphenated `nxp-lpc` in the raw GitHub URL. Prepending
`nxplpc@` to the platform URL is valid PlatformIO name-at-source
syntax and makes the substring match, unblocking the build under
2.3.15. Once fbuild 2.3.16 ships with #900 the prefix becomes redundant
but stays syntactically valid.

## Fix 2 — `led_sysdefs_arm_lpc.h`: define `FASTLED_HAS_CMSIS`

`src/platforms/arm/common/m0clockless_c.h:51` guards the local
`__get_PRIMASK` / `__enable_irq` / `__disable_irq` stubs with
`#if !defined(FASTLED_HAS_CMSIS)`, and the comment on that guard says
"LPC builds set FASTLED_HAS_CMSIS in led_sysdefs". But the define was
never actually added — so LPC builds got the local stubs plus the
vendor CMSIS versions from `core_cm0plus.h` and gcc rejected the pair
with

    error: redefinition of 'fl::u32 __get_PRIMASK()'

Adding `#define FASTLED_HAS_CMSIS 1` in `led_sysdefs_arm_lpc.h`
immediately after the vendor `<LPC845.h>` / `<LPC804.h>` include
matches the intent of the m0clockless guard and silences the collision.

## Fix 3 — `platforms/shared/bitbang/bus_traits.h`: LPC845 gate

`ChannelEngineLpcSctDma` registers under `BusTraits<Bus::BIT_BANG>`
(see `src/platforms/arm/lpc/drivers/sct_dma/bus_traits.h` — FastLED
#3459 / PR #3460). The shared `BitBangChannelDriver` also specialises
`BusTraits<Bus::BIT_BANG>` unconditionally. On LPC845 both TUs land in
the same translation unit and gcc rejects the pair with

    error: redefinition of 'struct fl::BusTraits<fl::Bus::BIT_BANG>'
    error: redefinition of 'struct fl::BusSupports<fl::Bus::BIT_BANG,
                                                    fl::ClocklessChipset, 0>'

Gate the shared bit-bang specialization on `!FL_IS_ARM_LPC_845` so the
dedicated SCT+DMA engine owns the slot on that platform. Every other
platform continues to use the universal-GPIO fallback.

## Verification

Applied all three fixes and confirmed:

  bash compile lpc845brk --examples AutoResearch \
      --build-flag "-DFASTLED_LPC_PWM_DMA=1"

  Board: NXP LPC845-BRK / LPC845 @ 24MHz
  Toolchain: arm-none-eabi-gcc 15.2.1
  Flash: 53.52KB / 64.00KB (83.6%)
  RAM:   9.07KB / 16.00KB (56.7%)
  Artifact: firmware.elf (159.79KB) / firmware.bin (53.54KB)
  build succeeded in 212.2s

  bash test --cpp → 343/343 passed
  C++ lint → clean

## What's still open on the actual on-wire verification

- fbuild-side: an additional blocker surfaced during this bring-up —
  the FastLED/framework-arduino-lpc8xx tarball SHA256 changed after
  the 2026-06-28 org transfer (`e6bbcc3392…` → `e64f0cb81a…`). This
  needs a fbuild-side update to `ACLPC_CHECKSUM` in
  `crates/fbuild-packages/src/library/arduino_core_lpc8xx.rs`; I filed
  the change on a local fbuild branch during this session and will
  push it as a follow-up PR to the fbuild repo.
- Flash + serial monitoring: `bash autoresearch --pwm-dma-cl` still
  hits pre-existing infrastructure gaps unrelated to #3468 —
  `ci/util/port_utils.py` only recognises the LPCXpresso VCOM
  fingerprint (VID:PID 16C0:0483), not the LPC-Link2 CMSIS-DAP
  variant (1FC9:0132) that ships on this specific LPC845-BRK unit,
  and fbuild's LPC deploy path uses `lpc21isp` which requires ISP-mode
  entry rather than the board's default CMSIS-DAP SWD. Both are
  tracked separately.

The host TX→RX byte-flow readback contract (the #3468 primary
acceptance criterion) is already confirmed in PR #3472
(`tests/fl/channels/lpc_sct_dma_engine.cpp` "#3468: end-to-end TX→RX
readback through engine.show()", passing 343/343). This PR takes the
verification one step further by making the compile path work on the
LPC845 target so any user with an LPC845-BRK can now build and flash
the firmware and run the on-silicon self-loopback via
`pwmDmaClCaptureSelf`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit 3d3c1da into master Jul 1, 2026
7 of 10 checks passed
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b491e762-9edf-42a1-9784-2bc9f762b814

📥 Commits

Reviewing files that changed from the base of the PR and between a5c656e and c47c2b9.

📒 Files selected for processing (3)
  • ci/boards.py
  • src/platforms/arm/lpc/led_sysdefs_arm_lpc.h
  • src/platforms/shared/bitbang/bus_traits.h

📝 Walkthrough

Walkthrough

Updates the LPC8xx PlatformIO platform reference in ci/boards.py to the nxplpc@ syntax with explanatory comments. Adds a FASTLED_HAS_CMSIS guard in the LPC sysdefs header, and excludes the shared BusTraits<Bus::BIT_BANG> specialization for LPC845 builds to prevent redefinition conflicts.

Changes

LPC8xx Build Compatibility Fixes

Layer / File(s) Summary
CI PlatformIO platform reference
ci/boards.py
Changes _NXPLPC_PLATFORM from a raw GitHub URL to the nxplpc@ PlatformIO syntax (same commit SHA) with comments explaining matcher compatibility.
CMSIS intrinsic guard
src/platforms/arm/lpc/led_sysdefs_arm_lpc.h
Defines FASTLED_HAS_CMSIS to 1 if not already defined, preventing m0clockless_c.h from re-defining CMSIS intrinsics already provided by vendor headers.
BusTraits BIT_BANG exclusion
src/platforms/shared/bitbang/bus_traits.h
Includes platforms/is_platform.h and wraps the shared BusTraits<Bus::BIT_BANG> specialization in #if !defined(FL_IS_ARM_LPC_845) to avoid conflicting with LPC845's dedicated SCT+DMA implementation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2837: Builds on the LPC845 platform/bit-bang port that introduced the BusTraits<BIT_BANG> specialization now being excluded.
  • FastLED/FastLED#3438: Adds vendor LPC845.h/LPC804.h includes that this PR's FASTLED_HAS_CMSIS guard aligns with.
  • FastLED/FastLED#3440: Also modifies _NXPLPC_PLATFORM in ci/boards.py, which this PR further updates to the nxplpc@ syntax.

Poem

A hare hopped through headers, guarding each define,
No more clashing intrinsics, all guards align.
The platform now wears its nxplpc@ disguise,
And BIT_BANG steps aside for the SCT's surprise.
🐇 Hop, compile, and build — no conflicts in sight!

✨ 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 feat/3468-verify-silicon

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant