Permalink
Browse files

Force gradient palettes to be aligned in memory on ARM. Only needed o…

…n some ARM platforms, but rather than play whack-a-mole with future chipsets and their requirements, we'll just be a little extra careful here. Fixes #428.
  • Loading branch information...
kriegsman committed Mar 24, 2017
1 parent fbe8c5b commit 06a5abcf1fa65115adb42a79e112a34e6c8ff5a7
Showing with 15 additions and 0 deletions.
  1. +2 −0 colorutils.h
  2. +13 −0 fastled_progmem.h
View
@@ -1668,9 +1668,11 @@ void nblendPaletteTowardPalette( CRGBPalette16& currentPalette,
//
#define DEFINE_GRADIENT_PALETTE(X) \
FL_ALIGN_PROGMEM \
extern const TProgmemRGBGradientPalette_byte X[] FL_PROGMEM =
#define DECLARE_GRADIENT_PALETTE(X) \
FL_ALIGN_PROGMEM \
extern const TProgmemRGBGradientPalette_byte X[] FL_PROGMEM
View
@@ -63,6 +63,19 @@ FASTLED_NAMESPACE_BEGIN
#endif
// On some platforms, most notably ARM M0, unaligned access
// to 'PROGMEM' for multibyte values (eg read dword) is
// not allowed and causes a crash. This macro can help
// force 4-byte 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.
#ifdef FASTLED_ARM
#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
#else
#define FL_ALIGN_PROGMEM
#endif
FASTLED_NAMESPACE_END
#endif

0 comments on commit 06a5abc

Please sign in to comment.