Repository navigation
perf: get LPC845 back on the slim bridge (printf and ChannelManager no longer linked on small tiers) - #4671
Conversation
Measured on the LPC845 AutoResearch image with the slim-bridge LPC controllers (master), where the link overflowed FLASH by 16,448 bytes. A per-symbol map diff against the pre-slim-bridge build showed the encoder/PixelIterator path was flat (+56 B); the growth was printf: - The scalar formatter erased every type into one out-of-line format_scalar() switch, so formatting any int linked float formatting and libgcc's double routines (dadd/dsub/dmul/d2f/cmpdf, ~6 KB). Split into format_integral()/format_floating(), selected at compile time by format_arg<T>; integer-only programs never reference the float half. Behaviour is pinned per specifier by a new test matrix. - log_emit_prefix() wrote "file(line): KIND: " with fl::printf, so every log site -- stream-form included -- linked the printf engine. Build it with fl::print and a local integer conversion. - ChannelManager, SlimBridgeController and the LPC UART engine logs use stream form, so the registration path the slim bridge adds does not instantiate printf either. LPC845 AutoResearch overflow: 16,448 -> 3,392 bytes. What remains is ChannelManager itself (~3 KB). Host: 315/315 unit, 95/95 examples.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: FastLED/FastLED/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughScalar formatting now uses separate integral and floating-point paths. Log prefix output uses ChangesFormatting and logging
SlimBridgeController direct-show mode
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No actionable issue remains identified for this change; it is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Small-memory builds bypass runtime driver controls and coordinated frame completion. Some asynchronous drivers still depend on that coordination, creating device-local risks of incomplete output and overlapping transfers. No remotely reachable exploit was established. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
…annelManager With printf gone, LPC845 AutoResearch on the slim bridge was still 3,392 bytes over 64 KB, and the remainder was ChannelManager itself (~3 KB: addDriver, registry, waitForReady*, poll, ctor/dtor, DriverInfo cache). Add a DIRECT_SHOW template parameter (default FL_SLIM_BRIDGE_DIRECT_SHOW = !FL_PLATFORM_HAS_LARGE_MEMORY) selecting a SlimBridgeShowPolicy specialization. The direct policy never names ChannelManager: no registration, no runtime enable/disable gate, and the controller calls driver.show() after enqueue as the pre-bridge LPC controllers did. Large platforms are unchanged. Affects LPC and STM32 F1. LPC845 AutoResearch: links at 63.45 KB / 64 KB (+248 B vs the old direct controllers); deployed to an LPC845-BRK, bring-up passes.
…IT_BANG> it uses AutoResearchPwmDmaClockless.h names fl::BusTraits<fl::Bus::BIT_BANG>, whose LPC specialization only arrived through clockless_channel_lpc.h. That header is skipped once another ClocklessController is picked, so the --pwm-dma-cl build failed with 'incomplete type' (pre-existing; also fails before #4671). Include the specialization directly. Links at 59.31 KB.
…#4674) * fix(autoresearch): LPC845 RX-DMA loopback builds fit and get the port The --ws2812-loopback / --pwm-dma-cl LPC845 builds (the only ones that link the real SCT RX-DMA capture) overflowed FLASH by 348 B and RAM by 8 B on master, and once fitted the firmware HardFaulted at boot with PC in heap/stack: the two fixed 512-word capture rings (4 KB of a 16 KB part) left too little heap/stack for the RPC layer. - _lpc_rx_defines(): one place for the LPC RX bench defines. DMA loopback builds also pass FASTLED_AUTORESEARCH_LPC_DMA_LOOPBACK (the sketch leaves out the unrelated ~1 KB pinToggleRx RPC unless --pin-toggle-rx is also given) and FL_LPC_RX_SCT_DMA_RING_WORDS=128 (the sketch caps a capture at 192 edges). - rx_sct_capture: ring size overridable via FL_LPC_RX_SCT_DMA_RING_WORDS (default unchanged at 512, checked against the 1..1024 XFERCOUNT range). - _release_harness_port(): the LPC subprocess benches now close the harness serial interface before the child opens the port, as the RP SPI bench already did (#4207); otherwise the child's client is inert. Loopback build: 62.91 KB / 64 KB flash, RAM fits; firmware boots and answers RPC on an LPC845-BRK. * fix(autoresearch): --pwm-dma-cl LPC845 build includes the BusTraits<BIT_BANG> it uses AutoResearchPwmDmaClockless.h names fl::BusTraits<fl::Bus::BIT_BANG>, whose LPC specialization only arrived through clockless_channel_lpc.h. That header is skipped once another ClocklessController is picked, so the --pwm-dma-cl build failed with 'incomplete type' (pre-existing; also fails before #4671). Include the specialization directly. Links at 59.31 KB.
Same strategy as #4671: printf-form FL_WARN/FL_ERROR calls link the fl::printf engine (parse_format_spec, apply_width, format_integral), and on Teensy 4 all code lives in ITCM (RAM1). Convert the %s/%d sites on the Teensy 4 driver paths (ObjectFLED, SPI, FlexPWM RX, audio, ISR, coroutine, block clockless) and the shared Channel / CLEDController paths to stream form. Output text is unchanged; u8 values stream as numbers. teensy41, fl::printf_detail symbols now 0 in both sketches: - DemoReel100 (addLeds): ITCM 38,368 B -> 35,680 B, flash 58 KB -> 56 KB - typed Channel API: ITCM 55,200 B -> 51,232 B The hex register dumps in rx_flexio_channel and the RMT driver logs are left as printf form. Co-Authored-By: Claude <[email protected]>
…4709) (#4710) * fix: post-3.10.6 memory and host-runner regressions (#4709) - Teensy 4: initChannelDrivers() is now a no-op, as on ESP32 since #2469. FlexIO/ObjectFLED/SPI_UNIFIED registration moves to enableAllDrivers(), so TypedChannel<Bus::X> sketches stop linking every driver into ITCM. Typed Channel sketch on teensy41: RAM1 114.8 KB -> 94.1 KB. Fixes #4708. - Log verbosity defaults to 0 on tiny/small-memory tiers, silencing the FL_WARN_LIT/FL_LOG_LIT literals as well. - Stub: delayNanoseconds/delayMicroseconds honour the fast-exit delay override, so bit-bang wire timing no longer runs in host example runs (ArrayOfLedArrays: >20 s watchdog timeout -> 1.6 s). Co-Authored-By: Claude <[email protected]> * fix: address review on #4709 fixes - Teensy lazy init registers the platform-default ObjectFLED engine so Channel::create(cfg) + FastLED.add(ch) with Bus::AUTO keeps working; enableAllDrivers() registers the full set first so FlexIO keeps priority 8. - Keep the log verbosity default unchanged: full FL_WARN/FL_ERROR/FL_INFO are already compiled out on small tiers, and the *_LIT macros back the LPC845 bring-up check. - Stub timing skip lives in one place (stub delayNanoseconds_impl), which also covers the compile-time delayNanoseconds<NS>(). Co-Authored-By: Claude <[email protected]> * fix(teensy): drop unused-driver DMA buffers and newlib printf from RAM (#4709) - FL_DMAMEM: Teensy DMAMEM placement without the core's `used`, so a driver's .dmabuffers static is dropped when the driver is not linked. Applied to LPUART, FlexIO, ObjectFLED SPI-mode and ObjectFLED bitdata. Typed Channel sketch on teensy41: RAM 85.75 KB -> 73.75 KB. Fixes #4713. - ObjectFLED: replace three error-path Serial.printf calls with Serial.print (same output). printf linked ~16 KB of newlib formatting into ITCM (RAM1) for every Teensy 4 addLeds sketch: DemoReel100 ITCM 59,664 B -> 38,368 B, flash 80 KB -> 58 KB. Co-Authored-By: Claude <[email protected]> * chore(teensy): mark dmamem.h as macro-only for the namespace linter Co-Authored-By: Claude <[email protected]> * perf(teensy): stream-form logs so fl::printf is not linked (#4709) Same strategy as #4671: printf-form FL_WARN/FL_ERROR calls link the fl::printf engine (parse_format_spec, apply_width, format_integral), and on Teensy 4 all code lives in ITCM (RAM1). Convert the %s/%d sites on the Teensy 4 driver paths (ObjectFLED, SPI, FlexPWM RX, audio, ISR, coroutine, block clockless) and the shared Channel / CLEDController paths to stream form. Output text is unchanged; u8 values stream as numbers. teensy41, fl::printf_detail symbols now 0 in both sketches: - DemoReel100 (addLeds): ITCM 38,368 B -> 35,680 B, flash 58 KB -> 56 KB - typed Channel API: ITCM 55,200 B -> 51,232 B The hex register dumps in rx_flexio_channel and the RMT driver logs are left as printf form. Co-Authored-By: Claude <[email protected]> * perf(teensy): convert remaining SPI/RX printf-form logs to stream form (#4709) Review follow-up: SlimSpiBridgeController, SpiChannelEngineAdapter, SPI lane, FlexIO/FlexPWM RX and FL_LOG_OBJECTFLED sites. A Teensy 4 APA102 sketch now links no fl::printf_detail symbols (ITCM 33,952 B). ESP32 DemoReel100 grows ~0.6 KB: RMT keeps fl::printf linked there. Co-Authored-By: Claude <[email protected]> * feat(log)!: make printf-style log formatting a compile error (#4709) printf-form log calls (FL_WARN("x=%d", x)) link the whole fl::printf engine into any image that logs; on Teensy 4 that code sits in RAM1. Every log macro now takes exactly one literal or one << stream chain: - log.h: the multi-argument path of FL_WARN/FL_ERROR/FL_INFO/FL_DBG/ FL_PRINT/FASTLED_*/FL_LOG_ASYNC is FL_STATIC_ASSERT with a message pointing at stream form. The no-op variants (small tiers, logging off, FL_LOG_<channel> disabled) run the same check, so a sketch fails identically on every board. - Convert all 959 printf-form call sites in src/, tests/ and examples/ (%s/%d/%u/%zu -> <<, %x -> fl::to_hex(v), same output text). - color_profile tests also capture println: stream-form logs are emitted through fl::println. Verified: host 317/317 unit + 95/95 examples; Blink builds on esp32dev, esp32dev_idf44, esp32dev_idf33, esp32s3, esp32c6, esp32p4, esp32c3, esp32s2, esp8266, teensy41, teensy31, teensylc, uno, attiny85, rp2040, rp2350, nrf52840, stm32f103c8, stm32f411ce, nucleo_f429zi, lpc845brk, samd51j, samd21, sam3x8e_due, wasm. BREAKING CHANGE: user code calling a FastLED log macro with printf-style arguments no longer compiles; write FL_WARN("x=" << x). Co-Authored-By: Claude <[email protected]> * fix(log): address review on the printf-form ban (#4709) - fl::sstream gets operator<<(const void*) printing 0x<hex>, like %p. Converted pointer arguments otherwise converted to bool ("true"). - Use fl::to_hex for the "0x" << n sites (OTA magic byte, RISC-V interrupt flags) and cast esp_err_t to unsigned before to_hex. - Delete the now-unused log_emit_f / log_format_string helpers. - Fold the converter's "" << seeds and fl::string("lit") wrappers, restore two comments it rewrote, fix stale FL_WARN/FL_ERROR docs. - Test: every log macro's printf form expands to the ban; rename the stale "printf-style" test cases. Co-Authored-By: Claude <[email protected]> * fix: address CodeRabbit review feedback - Replace mojibake in RMT/SPI driver diagnostics and comments with ASCII * fix(ci): claim ESP32-S3 bloat saving; update BLE source assertion (#4709) - esp32s3 Blink image_flash 398,799 -> 392,019 B (CI run 37421506562): the gate requires the saving from removing fl::printf to be claimed. - test_rp2350w_board_config asserted the old printf-form log text. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Gets the LPC845 back onto
fl::SlimBridgeController(#4605) within its 64 KB of flash. This supersedes the revert in #4668.Where the bloat was
I diffed the LPC845 AutoResearch link maps per symbol: the pre-slim-bridge build (
7ff7c4aad0^) against the slim-bridge build (7ff7c4aad0), which overflowed by 16,448 bytes.__aeabi_dadd/dsub/dmul/d2f, cmpdf)format_scalar,format_float, ...)addDriver, registry,waitForReady*,poll)The encoder path was not the cause; the slim bridge's
showPixelsis the same size as the old controller's. The type-erased enum switch that cost space was in printf: oneformat_scalarswitch over every scalar kind, so formatting anyintlinked float formatting and libgcc's doubles. And the logging core's prefix usedfl::printf, so every log site linked the printf engine.Changes
format_integral/format_floating. The specifier switch is split in two, andformat_arg<T>picks one at compile time. Integer-only programs never reference float code. Each specifier's behavior is pinned by a new test matrix.log_emit_prefix/log_emit_newlineusefl::printand a local integer conversion instead offl::printf. A new test checks the exact prefix text, including negative line numbers and INT_MAX.DIRECT_SHOWtemplate parameter (defaultFL_SLIM_BRIDGE_DIRECT_SHOW = !FL_PLATFORM_HAS_LARGE_MEMORY) selects aSlimBridgeShowPolicyspecialization that never names ChannelManager: no registration, no runtime enable/disable gate, and the controller callsdriver.show()itself. Large platforms keep the manager path unchanged. Affected: LPC and STM32 F1.Results
LPC845 AutoResearch overflow at each step:
On hardware (LPC845-BRK through LPC-Link2):
bash autoresearch lpc845deploys andBRING-UP TEST PASSED.Host: 316/316 unit, 95/95 examples. Board builds: Blink on lpc845, lpc804, stm32f103c8, stm32f103tb.
Known, pre-existing
bash autoresearch lpc845 --ws2812-loopbackoverflows on master and on #4668's direct controllers alike (FLASH 176 B, RAM 8 B there; FLASH 340 B / RAM 8 B here). It is tracked separately.Summary by CodeRabbit