Skip to content

fix(teensy4): empty FL_PROGMEM to avoid GCC section type conflict - #2436

Merged
zackees merged 1 commit into
masterfrom
fix-teensy4-progmem-section-conflict
May 10, 2026
Merged

zackees merged 1 commit into
masterfrom
fix-teensy4-progmem-section-conflict

Conversation

@zackees

@zackees zackees commented May 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Special-case FL_PROGMEM to expand to nothing on Teensy 4.x (__IMXRT1062__). Resolves a long-standing CI failure on the teensy41 workflow.

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 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[])

Sample failure (master, every commit since at least ebb48e610f):

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'

teensy41 has 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 const data in .rodata automatically — flash placement does not require the PROGMEM section attribute. The attribute is the sole cause of the conflict.

Emitting empty FL_PROGMEM only affects FastLED-internal declarations. User code that uses Arduino's PROGMEM macro directly is unaffected — the upstream PROGMEM macro is unchanged.

Diff

src/fastled_progmem.h:

 /// PROGMEM keyword for storage
+#if defined(__IMXRT1062__)
+#define FL_PROGMEM
+#else
 #define FL_PROGMEM                PROGMEM
+#endif

(Plus an explanatory comment block; full diff in the commit.)

Verification

  • bash lint clean.
  • bash test --cpp passes 303/303 (host build unaffected — __IMXRT1062__ not defined on host).
  • The actual teensy41 build will run in CI on this PR — that's the load-bearing verification.

Related

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed compilation errors on Teensy 4.x microcontroller boards when program memory variables were used.

Review Change Stack

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]>
@coderabbitai

coderabbitai Bot commented May 10, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e286d7ff-aacb-49a5-9802-738048868379

📥 Commits

Reviewing files that changed from the base of the PR and between 3d295fc and 337baa9.

📒 Files selected for processing (1)
  • src/fastled_progmem.h

📝 Walkthrough

Walkthrough

This PR conditionally redefines the FL_PROGMEM macro in fastled_progmem.h to evaluate as empty on Teensy 4.x platforms (when __IMXRT1062__ is defined) and as PROGMEM elsewhere, resolving GCC section type conflicts without affecting other platforms.

Changes

Teensy 4.x FL_PROGMEM Conditional Definition

Layer / File(s) Summary
Platform-specific Macro Definition
src/fastled_progmem.h
FL_PROGMEM is conditionally defined: empty for Teensy 4.x (__IMXRT1062__), otherwise maps to PROGMEM.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit hops through compile-time zones,
Where Teensy's sections make painful moans,
One empty macro, simple and clean,
Stops conflicts unseen—the fix, serene! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: conditionally making FL_PROGMEM empty for Teensy 4.x to resolve a GCC section type conflict issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-teensy4-progmem-section-conflict

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit 19a01a3 into master May 10, 2026
6 of 8 checks passed
@zackees
zackees deleted the fix-teensy4-progmem-section-conflict branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant