Repository navigation
docs(esp8266): correct the stale FASTLED_USE_PROGMEM claim (#743) - #3824
Merged
Merged
Conversation
#743 reported that gradient palettes land in RAM on ESP8266, citing the comment "Default to NOT using PROGMEM here". The reporter read the code correctly; the comment is what's wrong now. fastled_progmem.h dispatches on platform before it tests the flag: #if defined(__EMSCRIPTEN__) || ... #include "platforms/null_progmem.h" #elif defined(ESP8266) #include "platforms/esp/8266/progmem_esp8266.h" <-- exits here ... #else #if (FASTLED_USE_PROGMEM == 1) <-- never reached progmem_esp8266.h maps FL_PROGMEM to real PROGMEM and FL_PGM_READ_* to real pgm_read_*, so ESP8266 tables are flash-resident regardless of the 0. Verified by symbol placement in a linked image: 4023ac68 T hot_gp (DEFINE_GRADIENT_PALETTE) 40239ef0 T myRedWhiteBluePalette_p (TProgmemPalette16) both inside .irom0.text @ 0x40201010, while .data/.rodata/.bss sit at 0x3ffexxxx. RAM-resident .rodata in that whole image is 940 bytes. So the flag is inert on ESP8266 and the header, the platform README and the compile-time assert all implied otherwise. Comments and one #error string only: - led_sysdefs_esp8266.h: replace the misleading one-liner with the dispatch explanation and the symbol evidence. - README.md: same, plus a pointer from the "typical settings" line so the FASTLED_USE_PROGMEM=0 there doesn't read as "constants in RAM". - compile_test.hpp: the assert stays (drift guard), but its message now says the flag is inert rather than implying it controls placement. No behavior change. esp8266 ColorPalette is byte-identical before and after: 269475 B flash / 28012 B RAM. `bash test --cpp --clean` 359/359, `bash lint` clean. Confirmed the assert still fires with the new text when FASTLED_USE_PROGMEM=1 is forced. Note: led_sysdefs_esp8266.h is guarded by ci/hooks/protect_platform_headers.py; edited via the documented FL_AGENT_ALLOW_PROTECTED_WRITE override, as this is a comment-only change to that file. Closes #743 Co-Authored-By: Claude <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe ESP8266 documentation now explains platform-selected PROGMEM support, flash placement, gradient palette linking, and the compatibility value of ChangesESP8266 PROGMEM behavior
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
✨ 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 |
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.
Closes #743. Comment-only; no behavior change.
The report was right about the code, wrong about today
#743 says gradient palettes land in RAM on ESP8266, citing:
The reporter read that correctly. The comment is what's stale.
fastled_progmem.hdispatches on platform before it ever tests the flag:progmem_esp8266.hmapsFL_PROGMEM→ realPROGMEMandFL_PGM_READ_*→ realpgm_read_*. ESP8266 tables are flash-resident regardless of the 0.Measured, not inferred
Symbols from a linked ESP8266 image:
against the section map:
.data0x3ffe8000.rodata0x3ffe8620.irom0.text0x40201010(242 KB)Both palettes are in flash. RAM-resident
.rodataacross the entire image is under 1 KB.Changes
Three files, comments and one
#errorstring:led_sysdefs_esp8266.h— replace the misleading one-liner with the dispatch explanation and the symbol evidence.README.md— same, plus a pointer from the "Typical settings:FASTLED_USE_PROGMEM=0" line so it doesn't read as "constants in RAM".compile_test.hpp— the assert stays (it's a useful drift guard), but its message now says the flag is inert instead of implying it controls placement.I kept the assert rather than deleting it: pinning the declared value has value even when the value is inert, and flipping it to 1 would make the header claim something untrue without moving any data.
Verification
bash compile esp8266 --examples ColorPalette--defines FASTLED_USE_PROGMEM=1bash test --cpp --cleanbash lintNote on the protected file
led_sysdefs_esp8266.his guarded byci/hooks/protect_platform_headers.py. I used the documentedFL_AGENT_ALLOW_PROTECTED_WRITEoverride, deliberately and only because this is a comment-only edit to that file — flagging it so the override isn't invisible in review.What this does not claim
The ISR flash-cache hazard, the 2019 alignment crash, and the origin of the
0are all covered in the research writeup on the issue. Short version: the clockless output path reads zero PROGMEM and isFL_IRAM-placed; gradient palettes are 4-byte aligned viaFL_ALIGN_PROGMEM; and the0arrived unexplained in the 2016 "ESP8266 first light" commit.🤖 Generated with Claude Code
Summary by CodeRabbit
FASTLED_USE_PROGMEMis retained for compatibility and must remain set to0.