Repository navigation
Description
Symptom
esp32c2 workflow on master fails on the RX (examples/Remote/Remote.ino) example with:
lib/FastLED/libFastLED.a(fl.channels+_5e4c.o):
in function `fl::shared_ptr<fl::RxDevice>
fl::RxDevice::create<(fl::RxDeviceType)1>(int)':
fl.channels+.cpp: undefined reference to `fl::GpioIsrRx::create(int)'
collect2: error: ld returned 1 exit status
FAILED: RX
Reproducible from the esp32c2 workflow log in run 26697900743.
Root cause
src/fl/channels/rx.cpp.hpp:99 (compiled for any FL_IS_ESP32) instantiates:
template <>
fl::shared_ptr<RxDevice> RxDevice::create<RxDeviceType::ISR>(int pin) FL_NOEXCEPT {
auto device = GpioIsrRx::create(pin);
...
}GpioIsrRx::create()'s definition lives in src/platforms/esp/32/drivers/gpio_isr_rx/gpio_isr_rx.cpp.hpp, and its compilation is gated by two preprocessor conditions:
#ifdef FL_IS_ESP32
#if FASTLED_RMT5 // ← outer guard
#if defined(SOC_MCPWM_SUPPORTED) && SOC_MCPWM_SUPPORTED
// MCPWM implementation of create()
#else
// No-op stub: create() returning nullptr
#endif
#endif // FASTLED_RMT5 // ← stops here on RMT-less chips
#endifOn ESP32-C2 (a low-end RISC-V part), there is no RMT peripheral (SOC_RMT_SUPPORTED = 0). feature_flags/enabled.h:111-119 then resolves:
#if !defined(FASTLED_RMT5)
#if FASTLED_ESP32_RMT5_ONLY_PLATFORM // false on C2
#define FASTLED_RMT5 1
#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) && FASTLED_ESP32_HAS_RMT
#define FASTLED_RMT5 1
#else
#define FASTLED_RMT5 0 // ← C2 lands here
#endif
#endifSo on C2: FASTLED_RMT5 = 0 → outer guard fails → neither the MCPWM create() nor the stub create() gets compiled → linker can't find the symbol → build dies.
The caller in fl/channels/rx.cpp.hpp is only gated on FL_IS_ESP32, not on FASTLED_RMT5, so it always tries to link against the symbol.
Fix
The no-op stub is the right answer for any ESP32 board that lacks the hardware path — whether the reason is "no MCPWM" or "no RMT at all". Restructure the gates so the stub is the fallback for both:
#ifdef FL_IS_ESP32
#if FASTLED_RMT5
#include "soc/soc_caps.h"
#endif
#if FASTLED_RMT5 && defined(SOC_MCPWM_SUPPORTED) && SOC_MCPWM_SUPPORTED
// MCPWM implementation
fl::shared_ptr<GpioIsrRx> GpioIsrRx::create(int pin) FL_NOEXCEPT {
return GpioIsrRxMcpwm_create(pin);
}
#else
// No MCPWM hardware OR no RMT5 support → ISR RX not available
fl::shared_ptr<GpioIsrRx> GpioIsrRx::create(int pin) FL_NOEXCEPT {
(void)pin;
return fl::shared_ptr<GpioIsrRx>();
}
#endif
#endif // FL_IS_ESP32The caller in rx.cpp.hpp:99-104 already handles a null return — it wraps it as DummyRxDevice("GPIO ISR RX creation failed"). So returning null on C2 gives a clean runtime "feature not available" path instead of a link-time stop-the-build.
Test plan
-
bash compile esp32c2 --examples Remotesucceeds (was failing). -
bash compile esp32s3 --examples Remotestill succeeds (MCPWM path unchanged). -
bash compile esp32c3 --examples Remotestill succeeds (RMT5 yes, MCPWM no → falls into stub). -
bash test fl_channels --cppcontinues to pass on the host.
Related
- esp32c2: AudioFftParity fails — esp_dsp.h missing on ESP32-C2 toolchain #2623 — sibling esp32c2 failure (AudioFftParity
esp_dsp.h), fixed via filter in fix(examples): restrict AudioFftParity to ESP32 boards with esp_dsp #2625. - fl::audio::fft: eliminate FL_FFT_USE_ESP_DSP opt-in, auto-detect via FL_HAS_INCLUDE + scalar fallback #2629 — follow-up to eliminate the
FL_FFT_USE_ESP_DSPopt-in in favor ofFL_HAS_INCLUDEprobing.
Activity
fix(esp32): provide GpioIsrRx::create stub when FASTLED_RMT5=0 (fixes F…