FastLED 3.9.15
Loading...
Searching...
No Matches

◆ FL_ALIGN_PROGMEM

#define FL_ALIGN_PROGMEM ( N)
Value:
__attribute__ ((aligned (N)))

Force N-byte alignment for platforms with unaligned access or cache-line optimization.

On some platforms, most notably ARM M0, unaligned access to 'PROGMEM' for multibyte values (e.g. read dword) is not allowed and causes a crash. This macro can help force alignment as needed. The FastLED gradient palette code uses 'read dword', and now uses this macro to make sure that gradient palettes are 4-byte aligned.

Usage: FL_ALIGN_PROGMEM(N) where N is the alignment in bytes

Platform-specific behavior:

  • x86/WASM: Uses attribute((aligned(N))) for cache-line optimization
  • AVR: Caps at 4 bytes (flash PROGMEM doesn't benefit from larger alignment)
  • ESP32: Supports full alignment (cache-line optimization)
  • ESP8266: Caps at 4 bytes (no memalign support)
  • ARM: Supports full alignment

Definition at line 139 of file fastled_progmem.h.