Repository navigation
feat(autoresearch): FL_AUTORESEARCH_LITE_RPC tier define + fix LPC PWM_DMA CHUNK_BITS - #3522
Merged
Merged
Conversation
…M_DMA CHUNK_BITS Two related additions from planning the AutoResearch flash-budget squeeze on LPC845 (#3517 Phase A prerequisite): 1. `FL_AUTORESEARCH_LITE_RPC` — auto-derived from the existing memory tier (`!FL_PLATFORM_HAS_LARGE_MEMORY`). On LPC8xx / AVR Uno-class / STM32F1 / ESP8266 / Teensy LC/3.0-3.2 / Renesas UNO / ATtiny 2-3 KB it evaluates to 1 by default. Users can override with `-DFL_AUTORESEARCH_LITE_RPC=0` to force full-fat mode on a low-memory platform (will overflow) or `-DFL_AUTORESEARCH_LITE_RPC=1` to force lite mode on a large-memory platform (useful for measuring what lite mode ships). Follows the same override / `_OVERRIDDEN` flag pattern as the sibling `FL_PLATFORM_HAS_LARGE_MEMORY` tier defines. Rationale: LPC845 vanilla AutoResearch sits at 53.3 KB / 64 KB (83%). Adding `FASTLED_LPC_PWM_DMA=1` and/or `FASTLED_LPC_SPI_DMA=1` (the #3517 Phase A/B silicon acceptance payloads) will push over budget without a lite path. Ownership of the actual RPC-infrastructure swap-out (JSON → line-based text or protobuf) is a follow-up decision; this define lands first so the gate exists. 2. `src/platforms/arm/lpc/clockless_arm_lpc_pwm_dma.h` — add a defensive `#ifndef FASTLED_LPC_PWM_DMA_CHUNK_BITS #define ... 64u #endif` at the top. The macro used to live in the legacy template header; it was moved into the channels-API runtime helper (`drivers/sct_dma/lpc_sct_dma_runtime.h`) as part of PR #3460 without leaving a fallback for the legacy path. Result: any user building with `-DFASTLED_LPC_PWM_DMA=1` on top of `addLeds<>` today hits `error: 'FASTLED_LPC_PWM_DMA_CHUNK_BITS' was not declared in this scope`. Fixed here so the legacy template compiles again while #3517 Phase A.3 retirement is being planned. ## Verification - `bash test --cpp` — 344/344 pass - `bash bloat lpc845 --allow-overflow` — vanilla AutoResearch still fits at 53.3 KB / 64 KB (83.3%) — the tier define has zero code footprint when it evaluates to auto-default Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds two independent preprocessor macro fallbacks: ChangesCompile-time Macro Fallbacks
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
zackees
added a commit
that referenced
this pull request
Jul 1, 2026
… A.2) Delivers Phase A.2 of the LPC845 DMA-driver burn-down meta issue. ## Changes 1. **`src/platforms/arm/lpc/clockless_channel_lpc.h`** (new) — LPC845 `ClocklessController<>` template that routes classic `addLeds<WS2812, PIN, GRB>()` through the SCT+DMA channels-API engine via `BusTraits<Bus::BIT_BANG>::instancePtr()`. Mirrors the pattern from `src/platforms/wasm/clockless_channel_wasm.h` and `src/platforms/stub/clockless_channel_stub.h`. Sets `FL_CLOCKLESS_CONTROLLER_DEFINED` so the classic template selection downstream sees the adapter first. Only compiles when `FL_IS_ARM_LPC_845 && FASTLED_LPC_PWM_DMA` — vanilla LPC845 builds without the flag stay on the bit-bang default. 2. **`src/platforms/arm/lpc/fastled_arm_lpc.h`** — dispatch reorder. `FASTLED_LPC_PWM_DMA=1` now picks the channels-API adapter instead of the legacy `clockless_arm_lpc_pwm_dma.h` template. The bit-bang default is still included on any build that has NOT set `FL_CLOCKLESS_CONTROLLER_DEFINED` above it. The legacy header is no longer transitively pulled in on any path — it's slated for retirement per #3517 Phase A.3 once silicon validation confirms parity. 3. **`src/fl/remote/rpc/type_to_json.h`** — fix pre-existing u32/u16 overload ambiguity. Adding an explicit `TypeToJson<fl::u32>` / `TypeToJson<fl::u16>` specialization routes unsigned 32/16-bit values through the `i64` json constructor. Without this, GCC 15 flags: error: call of overloaded 'json(const long unsigned int&)' is ambiguous for any RPC handler that carries a `fl::u32` (e.g. `pwmDmaClFrameOnce(int, fl::u32 rgb, int)` from `AutoResearchPwmDmaClockless.h`). Bug was masked before this PR because the legacy `clockless_arm_lpc_pwm_dma.h` compile error short-circuited the build earlier — the new adapter path exposes it because it actually compiles. ## Measured flash-budget impact on LPC845 - Vanilla AutoResearch: **53.29 KB / 64 KB (83.3%)** — unchanged (my Phase A.2 adapter is compile-gated on `FASTLED_LPC_PWM_DMA`, not active in vanilla) - With `-DFASTLED_LPC_PWM_DMA=1`: **64.23 KB — 236 bytes OVER budget** Before this PR: `-DFASTLED_LPC_PWM_DMA=1` failed to compile at all (`FASTLED_LPC_PWM_DMA_CHUNK_BITS undeclared` + `FastPin<>` template visibility errors from the abandoned legacy header). After this PR: it compiles, links to 64.23 KB. The remaining 236 B is a real budget gap that Phase A.3 (retire the legacy template file entirely) and/or the `FL_AUTORESEARCH_LITE_RPC` implementation (from #3522) will close. ## Verification - [x] `bash test --cpp` — 344/344 tests pass - [x] `bash compile wasm --examples AutoResearch` — clean - [x] `bash bloat lpc845` vanilla — 53.29 KB (unchanged) - [ ] Silicon validation of `--pwm-dma-cl` — env-blocked (pyocd hangs enumerating CMSIS-DAP on this Windows session; #3517 Phase A.1 acceptance requires working flash + serial round-trip) Refs: #3517 (meta), #3460 (channels engine PR), #3468 (host TX→RX byte-match), #3454 (SPI DMA driver), #3522 (LITE_RPC tier define + CHUNK_BITS bug fix). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
zackees
added a commit
that referenced
this pull request
Jul 1, 2026
… A.2) (#3527) * feat(autoresearch): FL_AUTORESEARCH_LITE_RPC tier define + fix LPC PWM_DMA CHUNK_BITS Two related additions from planning the AutoResearch flash-budget squeeze on LPC845 (#3517 Phase A prerequisite): 1. `FL_AUTORESEARCH_LITE_RPC` — auto-derived from the existing memory tier (`!FL_PLATFORM_HAS_LARGE_MEMORY`). On LPC8xx / AVR Uno-class / STM32F1 / ESP8266 / Teensy LC/3.0-3.2 / Renesas UNO / ATtiny 2-3 KB it evaluates to 1 by default. Users can override with `-DFL_AUTORESEARCH_LITE_RPC=0` to force full-fat mode on a low-memory platform (will overflow) or `-DFL_AUTORESEARCH_LITE_RPC=1` to force lite mode on a large-memory platform (useful for measuring what lite mode ships). Follows the same override / `_OVERRIDDEN` flag pattern as the sibling `FL_PLATFORM_HAS_LARGE_MEMORY` tier defines. Rationale: LPC845 vanilla AutoResearch sits at 53.3 KB / 64 KB (83%). Adding `FASTLED_LPC_PWM_DMA=1` and/or `FASTLED_LPC_SPI_DMA=1` (the #3517 Phase A/B silicon acceptance payloads) will push over budget without a lite path. Ownership of the actual RPC-infrastructure swap-out (JSON → line-based text or protobuf) is a follow-up decision; this define lands first so the gate exists. 2. `src/platforms/arm/lpc/clockless_arm_lpc_pwm_dma.h` — add a defensive `#ifndef FASTLED_LPC_PWM_DMA_CHUNK_BITS #define ... 64u #endif` at the top. The macro used to live in the legacy template header; it was moved into the channels-API runtime helper (`drivers/sct_dma/lpc_sct_dma_runtime.h`) as part of PR #3460 without leaving a fallback for the legacy path. Result: any user building with `-DFASTLED_LPC_PWM_DMA=1` on top of `addLeds<>` today hits `error: 'FASTLED_LPC_PWM_DMA_CHUNK_BITS' was not declared in this scope`. Fixed here so the legacy template compiles again while #3517 Phase A.3 retirement is being planned. ## Verification - `bash test --cpp` — 344/344 pass - `bash bloat lpc845 --allow-overflow` — vanilla AutoResearch still fits at 53.3 KB / 64 KB (83.3%) — the tier define has zero code footprint when it evaluates to auto-default Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(lpc): route addLeds<WS2812> through channels engine (#3517 Phase A.2) Delivers Phase A.2 of the LPC845 DMA-driver burn-down meta issue. ## Changes 1. **`src/platforms/arm/lpc/clockless_channel_lpc.h`** (new) — LPC845 `ClocklessController<>` template that routes classic `addLeds<WS2812, PIN, GRB>()` through the SCT+DMA channels-API engine via `BusTraits<Bus::BIT_BANG>::instancePtr()`. Mirrors the pattern from `src/platforms/wasm/clockless_channel_wasm.h` and `src/platforms/stub/clockless_channel_stub.h`. Sets `FL_CLOCKLESS_CONTROLLER_DEFINED` so the classic template selection downstream sees the adapter first. Only compiles when `FL_IS_ARM_LPC_845 && FASTLED_LPC_PWM_DMA` — vanilla LPC845 builds without the flag stay on the bit-bang default. 2. **`src/platforms/arm/lpc/fastled_arm_lpc.h`** — dispatch reorder. `FASTLED_LPC_PWM_DMA=1` now picks the channels-API adapter instead of the legacy `clockless_arm_lpc_pwm_dma.h` template. The bit-bang default is still included on any build that has NOT set `FL_CLOCKLESS_CONTROLLER_DEFINED` above it. The legacy header is no longer transitively pulled in on any path — it's slated for retirement per #3517 Phase A.3 once silicon validation confirms parity. 3. **`src/fl/remote/rpc/type_to_json.h`** — fix pre-existing u32/u16 overload ambiguity. Adding an explicit `TypeToJson<fl::u32>` / `TypeToJson<fl::u16>` specialization routes unsigned 32/16-bit values through the `i64` json constructor. Without this, GCC 15 flags: error: call of overloaded 'json(const long unsigned int&)' is ambiguous for any RPC handler that carries a `fl::u32` (e.g. `pwmDmaClFrameOnce(int, fl::u32 rgb, int)` from `AutoResearchPwmDmaClockless.h`). Bug was masked before this PR because the legacy `clockless_arm_lpc_pwm_dma.h` compile error short-circuited the build earlier — the new adapter path exposes it because it actually compiles. ## Measured flash-budget impact on LPC845 - Vanilla AutoResearch: **53.29 KB / 64 KB (83.3%)** — unchanged (my Phase A.2 adapter is compile-gated on `FASTLED_LPC_PWM_DMA`, not active in vanilla) - With `-DFASTLED_LPC_PWM_DMA=1`: **64.23 KB — 236 bytes OVER budget** Before this PR: `-DFASTLED_LPC_PWM_DMA=1` failed to compile at all (`FASTLED_LPC_PWM_DMA_CHUNK_BITS undeclared` + `FastPin<>` template visibility errors from the abandoned legacy header). After this PR: it compiles, links to 64.23 KB. The remaining 236 B is a real budget gap that Phase A.3 (retire the legacy template file entirely) and/or the `FL_AUTORESEARCH_LITE_RPC` implementation (from #3522) will close. ## Verification - [x] `bash test --cpp` — 344/344 tests pass - [x] `bash compile wasm --examples AutoResearch` — clean - [x] `bash bloat lpc845` vanilla — 53.29 KB (unchanged) - [ ] Silicon validation of `--pwm-dma-cl` — env-blocked (pyocd hangs enumerating CMSIS-DAP on this Windows session; #3517 Phase A.1 acceptance requires working flash + serial round-trip) Refs: #3517 (meta), #3460 (channels engine PR), #3468 (host TX→RX byte-match), #3454 (SPI DMA driver), #3522 (LITE_RPC tier define + CHUNK_BITS bug fix). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Jul 1, 2026
zackees
added a commit
that referenced
this pull request
Jul 1, 2026
…Phase A.3) (#3529) The classic `ClocklessController<>` template that supplied the LPC845 SCT+DMA fast path is now `clockless_channel_lpc.h` (landed in #3527), which routes through `ChannelEngineLpcSctDma` via `BusTraits<Bus::BIT_BANG>`. Nothing in the tree still `#include`s the legacy header: $ grep -rn '#include.*clockless_arm_lpc_pwm_dma' src/ examples/ tests/ (no results) Safe to delete. Keeping two code paths for the same peripheral risked: 1. Divergent register-programming choices (the legacy template still had `TODO(2842)` markers that got moved into the channels-API runtime `lpc_sct_dma_runtime.cpp.hpp`). 2. Confusion for users about which path they get when `FASTLED_LPC_PWM_DMA=1` is set. Also updates `src/platforms/arm/lpc/README.md`: - Supported-platforms row for LPC845 replaces "PWM+DMA legacy template (#2850)" with the channels-API engine + `addLeds<>` route (#3527). - Files section marks `clockless_arm_lpc_pwm_dma.h` as retired with an explanation. Historical / provenance comment references inside `drivers/sct_dma/channel_engine_lpc_sct_dma.{h,cpp.hpp}` and `drivers/sct_dma/lpc_sct_dma_runtime.{h,cpp.hpp}` are kept — those narrate the design derivation, they're not `#include` breakage risks. ## Verification - `bash test --cpp` — 345/345 pass (unchanged from master) - `bash bloat lpc845 --allow-overflow` — vanilla LPC845 build still 53.29 KB (the retired header was never linked in vanilla anyway; users had to opt into it, and #3527 already routed that opt-in through the channels adapter) - With `-DFASTLED_LPC_PWM_DMA=1` build still overflows by 236 B — that budget gap needs the `FL_AUTORESEARCH_LITE_RPC` implementation (from #3522) to close. Refs: #3517 (meta issue), #3527 (Phase A.2 addLeds routing), #3522 (tier define), #2850 (original PR that shipped this file). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisite for #3517 Phase A / B silicon acceptance on LPC845.
1.
FL_AUTORESEARCH_LITE_RPCtier defineAuto-derived from the existing memory tier:
FL_AUTORESEARCH_LITE_RPC = !FL_PLATFORM_HAS_LARGE_MEMORY. On LPC8xx / AVR Uno-class / STM32F1 / ESP8266 / Teensy LC / 3.0-3.2 / Renesas UNO / ATtiny 2-3 KB parts it evaluates to1by default. Users can override with-DFL_AUTORESEARCH_LITE_RPC=0(force full-fat) or=1(force lite on big platforms for measurement).Follows the same override / `_OVERRIDDEN` flag pattern as the sibling
FL_PLATFORM_HAS_LARGE_MEMORYtier defines. Zero runtime cost — pure compile-time gate.Rationale. LPC845 vanilla AutoResearch already sits at 53.3 KB / 64 KB flash (83.3%). Adding
FASTLED_LPC_PWM_DMA=1and/orFASTLED_LPC_SPI_DMA=1— the #3517 Phase A/B silicon acceptance payloads — will push over the 64 KB flash budget without a lite path. This PR lands the gate first; the actual RPC-infrastructure swap-out (JSON → line-based text or protobuf) is a follow-up implementation decision.Search keywords:
lite RPC,autoresearch tier,flash budget,FL_PLATFORM_HAS_LARGE_MEMORY.2.
clockless_arm_lpc_pwm_dma.h— restoreFASTLED_LPC_PWM_DMA_CHUNK_BITSThe macro used to live in the legacy template header. It was moved into the channels-API runtime helper (
drivers/sct_dma/lpc_sct_dma_runtime.h) as part of #3460 without a fallback for the legacy path. Result: any user building with-DFASTLED_LPC_PWM_DMA=1on top of the classicaddLeds<>template hits:Fixed here with a defensive
#ifndef ... #define ... 64u #endifat the top of the header (same default value as the channels-API runtime). The legacy template header is scheduled for retirement in #3517 Phase A.3; this fix keeps it compiling until that ships.Verification
bash test --cpp— 344/344 passbash bloat lpc845 --allow-overflow— vanilla AutoResearch still fits at 53.3 KB / 64 KB (83.3%)FL_PLATFORM_HAS_LARGE_MEMORY = 0); no code path change until the lite RPC infrastructure landsFollow-up (out of scope for this PR)
FL_AUTORESEARCH_LITE_RPC == 1branch inAutoResearchLowMemory.h— swapfl::Remotefor the lite dispatcher, keep the CSV wire contract soci/autoresearch/test_lpc_*.pyrunners don't need to branch by build mode.FASTLED_LPC_PWM_DMA=1+FASTLED_LPC_SPI_DMA=1deltas after the swap and confirm both fit in 64 KB.Test plan
-DFASTLED_LPC_PWM_DMA=1after the CHUNK_BITS fix + eventual lite RPC swapRefs: #3517 (meta), #3460 (moved CHUNK_BITS out), #3454 (SPI DMA driver), #3468 (SCT DMA channels engine).
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Generated with Claude Code
Summary by CodeRabbit