Repository navigation
fix(lpc): compile-time assert rx_sct_capture bases match vendor CMSIS PAL (#3517 Phase C partial) - #3535
Merged
Conversation
… PAL
Adds `static_assert` on the 5 base-address constants at the top of
`rx_sct_capture.cpp.hpp` verifying they identity-equal the vendor CMSIS
`<PERIPH>_BASE` macros from `<LPC845.h>`:
SYSCON_BASE = 0x40048000u
SWM0_BASE = 0x4000C000u
INPUTMUX_BASE = 0x4002C000u
SCT0_BASE = 0x50004000u
DMA0_BASE = 0x50008000u
Cross-checked against NXP mcux-sdk `devices/LPC845/LPC845.h`.
## Rationale — narrow-scope contribution to #3517 Phase C
The full Phase C acceptance calls for migrating all ~48 register access
sites in this file from `reg(kSctBase, kOff*)` to `SCT0->FIELD` typed
accesses. That's a substantial mechanical refactor with real miskey
risk when the LPC toolchain is not compile-testable from this
environment (silicon flash is env-blocked; only host + WASM builds are
verifiable). Rather than ship a risky mass-rename that could break
LPC845 users, this PR does the minimum-risk compile-time safety net:
- The base-address constants are already correct — the `static_assert`s
prove that at build time.
- Any future vendor-header bump that changes a base surfaces as a
build error, not a silent runtime misbehavior on real silicon.
- The rest of Phase C — call-site migration — is left for a follow-up
when a maintainer with LPC845-BRK access can compile-test each
transformed line.
## Verification
- [x] `bash test --cpp` — 345/345 pass (host builds ignore the LPC845
gate; static_asserts only fire on real LPC845 builds)
- [x] Grep confirms no other base-address literals in
`src/platforms/arm/lpc/` need the same treatment (the runtime
helper and the SPI DMA driver already use vendor typedef access
everywhere)
Refs: #3517 Phase C (partial delivery — pins the safety net,
outstanding call-site migration deferred), #3437 register-map
remediation.
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 (1)
📝 WalkthroughWalkthroughAdded compile-time static_assert checks in rx_sct_capture.cpp.hpp for LPC845 builds, validating that hardcoded base address constants (SYSCON, SWM, INPUTMUX, SCT, DMA) match corresponding vendor-provided BASE macros. ChangesBase Address Validation
Estimated code review effort: 1 (Trivial) | ~3 minutes ✨ 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 |
55 tasks
zackees
added a commit
that referenced
this pull request
Jul 1, 2026
…3538) Regression from #3535 — the vendor CMSIS base-address identity checks used raw `static_assert(...)`. `BannedMacrosChecker` flags 5 violations: static_assert(kSysconBase == SYSCON_BASE, ...) static_assert(kSwmBase == SWM0_BASE, ...) static_assert(kInputMuxBase == INPUTMUX_BASE, ...) static_assert(kSctBase == SCT0_BASE, ...) static_assert(kDmaBase == DMA0_BASE, ...) Rationale (from the linter): `FL_STATIC_ASSERT` keeps compile-time assertions portable on old embedded toolchains. Fix: include `fl/stl/static_assert.h` and replace `static_assert` with `FL_STATIC_ASSERT` — same semantics on modern compilers, macro-based fallback on old ones. ## Verification - `bash test --cpp` — 345/345 pass - The `FL_STATIC_ASSERT`s still fire against LPC845 vendor CMSIS `<PERIPH>_BASE` macros the same way; behavior identical - `BannedMacrosChecker` should now find 0 violations in this file Refs: #3535 (introduced the regression), #3517 Phase C. 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.
Narrow-scope Phase C contribution to #3517.
Adds
static_asserton the 5 base-address constants at the top ofrx_sct_capture.cpp.hppverifying identity with the vendor CMSIS<PERIPH>_BASEmacros:All cross-checked against NXP mcux-sdk
devices/LPC845/LPC845.h.Why this narrower scope
Full Phase C calls for migrating ~48 register access sites in this file from
reg(kSctBase, kOff*)to typedSCT0->FIELDaccess. That's a substantial mechanical refactor with real miskey risk when the LPC toolchain isn't compile-testable from this coding environment (silicon flash is env-blocked per the meta issue's pyocd discussion).Rather than ship a risky mass-rename that could break LPC845 users, this PR does the minimum-risk safety net:
static_asserts prove it at build timeVerification
bash test --cpp— 345/345 pass (host builds skip the LPC845 gate)Refs: #3517 Phase C (partial), #3437.
Summary by CodeRabbit