Repository navigation
Replace padded LPC GPIO fallback accessors - #3221
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesLPC GPIO offset-based register accessor refactor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
…845 (#3224 Tier 1A) (#3226) * fix(arm/m0clockless): forward-declare CMSIS interrupt intrinsics for gcc 15.2+ gcc 15.2+ enforces stricter `-Wtemplate-body` lookup: function templates that reference undeclared names at parse time now error rather than warn. `showLedData` in m0clockless_c.h uses `__get_PRIMASK`, `__enable_irq`, `__disable_irq` directly, and the LPC8xx build of the AutoResearch sketch (which transitively reaches this header via the LPC SCT clockless driver) was failing master compile: m0clockless_c.h:484:24: error: there are no arguments to '__get_PRIMASK' that depend on a template parameter, so a declaration of '__get_PRIMASK' must be available [-Wtemplate-body] Forward-declare the three CMSIS intrinsics with their universal Cortex-M signatures, guarded by `#ifndef` so that platforms which already provide them as macros (Arduino-AVR's WString.h is one such case) keep working without redefinition errors. Surfaced while testing #3224 Tier 1A patches on master. * perf(json): gate float arithmetic paths on Low-memory; -4.3 KB on LPC845 #3224 Tier 1A: kill the single-precision soft-FP cascade on no-FPU targets. Verified on LPC845-BRK with AutoResearch + RX_SCT_WS2812: flash 63,992 B -> 59,648 B (-4,344 B saved) headroom 1,544 B -> 5,888 B (~4x growth) Soft-FP residual drops from 4,564 B to 208 B (only `__aeabi_fcmp*` / `__aeabi_f2iz` / `__clzsi2` remain, totalling ~210 B). ## Root cause The integer-only RPC contract on LPC8xx never receives JSON float values, but several float-handling overloads in the visitor surface were still reachable from the variant dispatch table: | Visitor (variant alternative = `float`) | What it pulls in | |---|---| | `JsonToIntegerVisitor<T>::operator()(float const&)` | `__aeabi_f2iz` + `__aeabi_fcmp*` + `to_string(float, 6)` -> `format_float` -> ~3 KB | | `JsonToBoolVisitor::operator()(float const&)` | `to_string(float, 6)` warning path -> same cascade | | `JsonToStringVisitor::operator()(float const&)` | `to_string(float, 6)` direct | | `float_conversion_visitor<*>::operator()(fl::string const&)` | `fl::parseFloat` which does `mul/add/div/divisor *= 10.0f` -> `__aeabi_fmul/fadd/fdiv` | | `StringConversionVisitor::operator()(float const&)` / `(double const&)` | `to_string(float, 6)` again | All overloads stay defined (the variant dispatcher requires them) but gated on `FL_PLATFORM_HAS_LARGE_MEMORY`: - On Large-memory targets: unchanged behavior, full float<->int<->string conversion + warning strings. - On Low-memory targets: saturate to zero / empty, set an error on TypeConversionResult so the RPC dispatcher reports `float -> int not supported on Low-memory` rather than silently returning garbage. The single change with the biggest weight is `JsonToIntegerVisitor`: its float overload was the single largest reachable consumer of single-prec soft-FP across the LowMemory build. ## Verification ``` PLATFORMIO_SRC_DIR=examples/AutoResearch fbuild build -e lpc845brk -> Flash: 58.25 KB / 64.00 KB (91.0%) RAM: 10.99 KB / 16.00 KB (68.7%) build succeeded ``` LD region overflow: NONE. ~5.7 KB headroom available for new LowMemory feature work, comfortably above the 6 KB target named in #3224's acceptance criteria. Refs #3224 (Tier 1A item A, "Single-precision soft-FP cascade") * fix(lpc/fastpin): switch to FL_STATIC_ASSERT + fl::bit_cast in GPIO accessors Pre-existing master lint failures from PR #3221 (fastpin GPIO fallback rework): - `static_assert` -> `FL_STATIC_ASSERT` (BannedMacrosChecker; the latter keeps compile-time assertions portable on old embedded toolchains). - `reinterpret_cast<volatile u32*>(addr)` -> `fl::bit_cast<volatile u32*>(addr)` (ReinterpretCastChecker; FastLED-blessed alternative for the address-to-pointer conversion that constructs the CMSIS-style peripheral pointer from a numeric base + offset). Surfaced while building #3224 Tier 1A patches on master.
Summary
FL_LPC_GPIO_Typemirror with explicit LPC GPIO offset accessorsLPC_GPIOorGPIOdefinitions when a board package provides themPIN/SET/CLRrelative offsets asserted for the clockless driverContext
Fixes #3218.
Refs #3212.
This keeps the fallback from implying that padding consumes target RAM. The old padded struct was a compile-time MMIO layout only, but the direct offset form is clearer and avoids carrying a large fake register map just to reach
PIN,SET,CLR,NOT,DIRSET, andDIRCLR.Verification
uv run python -m ci.autoresearch lpc845brk --pin-toggle-rx --upload-port COM10 --quiet --skip-schema --timeout 120suv run fbuild .build\pio\lpc845brk build -e lpc845brk --shrink=safe -vzccacheexplicitlyuv run ci/ci-compile.py lpc845brk --examples AutoResearch --backend platformio --max-failures 1 --log-failures .compile-failures-pioSummary by CodeRabbit