Repository navigation
fix(teensy4): empty FL_PROGMEM to avoid GCC section type conflict - #2436
Conversation
Teensy 4.x core (`__IMXRT1062__`) defines `PROGMEM` as
`__attribute__((section(".progmem")))`. GCC raises "section type conflict"
errors when a single translation unit declares variables of different types
with conflicting section attributes. The `fl.fx+.cpp` unity build aggregates
several headers that declare PROGMEM data of different types:
- colorpalettes.h: RainbowColors_p (CRGB[])
- fl/math/sin32.h: sinCosPairedLut (i32[])
- fl/audio/mic_response_data.h: kMicResponseFreqs (float[])
This has been failing every teensy41 CI build since at least commit
ebb48e6 (5+ commits prior to this fix), with errors like:
colorpalettes.h:23:35: error: 'RainbowColors_p' causes a section
type conflict with 'fl::sinCosPairedLut'
sin32.h:22:29: error: 'fl::sinCosPairedLut' causes a section type
conflict with 'fl::audio::kMicResponseFreqs'
Teensy 4 has a unified linear address space; const data goes to .rodata in
flash automatically via the linker script. The PROGMEM section attribute is
unnecessary on this platform and is the sole cause of the conflict.
Fix: special-case `FL_PROGMEM` to expand to nothing on `__IMXRT1062__`. User
code that uses Arduino's `PROGMEM` directly is unaffected — only FastLED-
internal `FL_PROGMEM` declarations skip the section attribute.
Verification:
- bash lint clean
- bash test --cpp passes 303/303 (host build unaffected)
CI verification of the actual fix (teensy41 build) will run once this is
pushed.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
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)
📝 WalkthroughWalkthroughThis PR conditionally redefines the ChangesTeensy 4.x FL_PROGMEM Conditional Definition
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Summary
Special-case
FL_PROGMEMto expand to nothing on Teensy 4.x (__IMXRT1062__). Resolves a long-standing CI failure on theteensy41workflow.Surfaced during PR #2435 review per @zackees — splitting into a follow-up because it's pre-existing and unrelated to that PR's IChannel changes.
Background
Teensy 4.x core defines
PROGMEMas__attribute__((section(".progmem"))). GCC raises "section type conflict" errors when a single translation unit declares variables of different types with conflicting section attributes. Thefl.fx+.cppunity build aggregates several headers that declare PROGMEM data of different types:colorpalettes.h—RainbowColors_p(CRGB[])fl/math/sin32.h—sinCosPairedLut(i32[])fl/audio/mic_response_data.h—kMicResponseFreqs(float[])Sample failure (master, every commit since at least
ebb48e610f):teensy41has been failing on master for the last 5+ commits with this error: 2f7d1332, 8a339fc4, 68106e80, ebb48e61, 6d3b4d4c — all the same root cause.Why this fix is safe
Teensy 4 has a unified linear address space (Cortex-M7, IMXRT1062 with 2 MB flash + 1 MB RAM). The Teensy linker script places
constdata in.rodataautomatically — flash placement does not require thePROGMEMsection attribute. The attribute is the sole cause of the conflict.Emitting empty
FL_PROGMEMonly affects FastLED-internal declarations. User code that uses Arduino'sPROGMEMmacro directly is unaffected — the upstreamPROGMEMmacro is unchanged.Diff
src/fastled_progmem.h:(Plus an explanatory comment block; full diff in the commit.)
Verification
bash lintclean.bash test --cpppasses 303/303 (host build unaffected —__IMXRT1062__not defined on host).teensy41build will run in CI on this PR — that's the load-bearing verification.Related
__IMXRT1062__(Teensy 4.0, Teensy 4.1, Teensy MicroMod).🤖 Generated with Claude Code
Summary by CodeRabbit