Skip to content

esp32c2: GpioIsrRx::create undefined when FASTLED_RMT5=0 (RMT-less chips) #2630

Closed

Description

@zackees

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
#endif

On 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
#endif

So 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_ESP32

The 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 Remote succeeds (was failing).
  • bash compile esp32s3 --examples Remote still succeeds (MCPWM path unchanged).
  • bash compile esp32c3 --examples Remote still succeeds (RMT5 yes, MCPWM no → falls into stub).
  • bash test fl_channels --cpp continues to pass on the host.

Related

Activity

  1. added a commit that references this issue on May 31, 2026
    d8de199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions