Repository navigation
Description
Symptom
Every sam3x8e_due and sam3x8e_due (digix merged) CI build on master fails at parse time inside fl/channels/bus.h:
.../system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:489:20: error: expected identifier before '(' token
489 | #define UART ((Uart *)0x400E0800U)
| ^
.../fl/channels/bus.h:54:5: note: in expansion of macro 'UART'
Cascades to:
.../fl/channels/bus.h:150:28: error: 'Bus' was not declared in this scope; did you mean 'fl::Bus'?
Every example (AnalogOutput, Animartrix, Apa102, …) fails identically. Reproducible run: https://github.com/FastLED/FastLED/actions/runs/26677701998
Root cause
Atmel's CMSIS header sam3x8e.h defines peripheral pointer macros — #define UART ((Uart *)0x400E0800U), and similarly SPI and I2S. These get pulled in transitively through platforms/is_platform.h ↓ Arduino.h ↓ CMSIS on the SAM3X8E build.
src/fl/channels/bus.h (and bus_priorities.h) then declare:
enum class Bus : fl::u8 {
...,
SPI, // ← preprocessor expands to ((Spi*)0x40008000U)
I2S, // ← preprocessor expands to ((I2s*)0x400A0000U)
UART, // ← preprocessor expands to ((Uart*)0x400E0800U)
...
};The preprocessor doesn't understand enum class scoping — bare identifiers UART/SPI/I2S are macro-expanded regardless of position.
ESP32 doesn't hit this because its register types are typedefs (uart_dev_t etc.), not #defines with the bare name.
Affected jobs
sam3x8e_duesam3x8e_due (digix merged)
(Any future SAM3X8E-family board will hit the same.)
Proposed fix
Wrap the enum definition (and the constexpr lookup in bus_priorities.h) with #pragma push_macro / #undef / #pragma pop_macro for UART, SPI, I2S:
#pragma push_macro("UART")
#pragma push_macro("SPI")
#pragma push_macro("I2S")
#undef UART
#undef SPI
#undef I2S
// ... existing enum / lookup code that mentions Bus::UART / Bus::SPI / Bus::I2S ...
#pragma pop_macro("I2S")
#pragma pop_macro("SPI")
#pragma pop_macro("UART")GCC, Clang, MSVC all support #pragma push_macro / pop_macro. The pop restores the original CMSIS register macros for any downstream TU that needs them as register pointers.
Only bus.h and bus_priorities.h reference these names outside the ESP32-only platform tree, so the change is contained.
Renaming the enumerators (e.g. Bus::SPI → Bus::SPI_BUS) would be cleaner but breaks the documented public API (fl::Bus::SPI is used in README examples and in ws2816_opts.mBus = fl::Bus::SPI patterns).
Repro
bash compile sam3x8e_due --examples Blink on Linux.
Filed automatically while triaging broken builds; intent is to open a PR immediately.
Activity