Skip to content

fix(esp32): provide GpioIsrRx::create stub when FASTLED_RMT5=0 - #2635

Merged
zackees merged 1 commit into
masterfrom
fix/gpio-isr-rx-stub-rmt-less-2630
May 31, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/gpio-isr-rx-stub-rmt-less-2630

Conversation

@zackees

@zackees zackees commented May 31, 2026 •

Copy link
Copy Markdown
Member

Summary

esp32c2 workflow on master fails linking examples/Remote/Remote.ino:

fl.channels+.cpp: undefined reference to `fl::GpioIsrRx::create(int)'
collect2: error: ld returned 1 exit status
FAILED: RX

Root cause

src/fl/channels/rx.cpp.hpp:99 is compiled for any FL_IS_ESP32 and references GpioIsrRx::create(pin) unconditionally. The definition in src/platforms/esp/32/drivers/gpio_isr_rx/gpio_isr_rx.cpp.hpp was gated on FASTLED_RMT5 outer + SOC_MCPWM_SUPPORTED inner:

#if FASTLED_RMT5
    #if SOC_MCPWM_SUPPORTED
        // MCPWM impl
    #else
        // no-op stub returning null
    #endif
#endif  // ← falls off the cliff when FASTLED_RMT5 = 0

On ESP32-C2 (low-end RISC-V, no RMT peripheral at all), feature_flags/enabled.h resolves FASTLED_RMT5 = 0. Neither the MCPWM path nor the stub was compiled → symbol undefined → link error.

Fix

Combine both gates into a single condition so the no-op stub is the fallback for either missing piece:

#if FASTLED_RMT5 && defined(SOC_MCPWM_SUPPORTED) && SOC_MCPWM_SUPPORTED
    // MCPWM impl
#else
    // no-op stub returning null  (RMT-less OR MCPWM-less chips)
#endif

The caller (rx.cpp.hpp:99-104) already handles a null return — wraps it as DummyRxDevice("GPIO ISR RX creation failed"). Runtime semantics for chips that already worked are unchanged; new behavior on C2 is "feature unavailable at runtime" instead of "build doesn't link". That matches the file's docstring intent ("Returns nullptr on platforms without MCPWM").

#include "soc/soc_caps.h" is now only pulled in when FASTLED_RMT5 is true — it's only available under the ESP-IDF tree when RMT5 is in play.

Verification

$ bash compile esp32c2 --examples Remote
(in progress — verification pending)

(I'll merge once bash compile esp32c2 --examples Remote reports success, per the loop directive's authorization.)

Related

Fixes #2630.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced GPIO ISR RX driver reliability and overall hardware compatibility across all ESP32 variants. Improved handling for boards with limited hardware capabilities, particularly ESP32-C2 and ESP32-C3 platforms. The driver now provides more robust and consistently stable performance, reducing potential issues during build and runtime operations across the entire ESP32 ecosystem.

…2630)

esp32c2 workflow on master fails linking examples/Remote/Remote.ino:

  fl.channels+.cpp: undefined reference to `fl::GpioIsrRx::create(int)'
  collect2: error: ld returned 1 exit status
  FAILED: RX

Root cause: src/fl/channels/rx.cpp.hpp:99 (compiled for any FL_IS_ESP32)
references GpioIsrRx::create(pin) unconditionally. The definition in
src/platforms/esp/32/drivers/gpio_isr_rx/gpio_isr_rx.cpp.hpp was gated
on FASTLED_RMT5 outer + SOC_MCPWM_SUPPORTED inner — so on ESP32-C2
(no RMT peripheral at all, so FASTLED_RMT5 = 0 per feature_flags),
neither the MCPWM path nor the no-op stub was compiled, leaving the
symbol undefined.

Fix: combine both gates into a single `FASTLED_RMT5 && SOC_MCPWM_
SUPPORTED` condition so the no-op stub is the fallback for *either*
missing piece — RMT-less chips and MCPWM-less chips both get a
`create() -> nullptr` definition. The caller already handles a null
return (wraps as DummyRxDevice("GPIO ISR RX creation failed")), so
runtime semantics are unchanged for chips that already worked; new
behavior on C2 is "feature unavailable at runtime" instead of
"build doesn't link".

Side effect: `#include "soc/soc_caps.h"` is now only pulled in when
FASTLED_RMT5 is true (it's only available under the ESP-IDF tree
when RMT5 is in play). Stub path doesn't need it.

Refs FastLED #2623 (sibling esp32c2 failure, fixed in PR #2625).
Refs FastLED #2629 (broader follow-up to eliminate FL_FFT_USE_ESP_DSP).

Fixes FastLED #2630.
@coderabbitai

coderabbitai Bot commented May 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0f05507b-0ac9-466a-9d2c-fd318f828724

📥 Commits

Reviewing files that changed from the base of the PR and between 23349cc and d32a4cc.

📒 Files selected for processing (1)
  • src/platforms/esp/32/drivers/gpio_isr_rx/gpio_isr_rx.cpp.hpp

📝 Walkthrough

Walkthrough

This PR fixes an undefined reference linker error on ESP32-C2 by restructuring conditional compilation in GpioIsrRx::create(). The factory method is now guaranteed to have a definition on all ESP32 boards: when FASTLED_RMT5 and SOC_MCPWM_SUPPORTED are both true, the MCPWM implementation is used; otherwise, a null-returning stub is compiled, allowing runtime fallback to DummyRxDevice.

Changes

GpioIsrRx factory implementation gating

Layer / File(s) Summary
Conditional compilation restructure and null-returning fallback
src/platforms/esp/32/drivers/gpio_isr_rx/gpio_isr_rx.cpp.hpp
Documentation updated to clarify null return on missing RMT5 or MCPWM. Preprocessor gates restructured so soc_caps.h include and MCPWM implementation gate only on FASTLED_RMT5, with a new fallback stub returning empty shared_ptr when either FASTLED_RMT5 or SOC_MCPWM_SUPPORTED is false.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Poem

🐰 Upon the chips where RMT won't dance,
No MCPWM in their stance,
A stub returns null, clean and bright,
No linker errors in the night! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: providing a stub for GpioIsrRx::create when FASTLED_RMT5=0.
Linked Issues check ✅ Passed The code changes fully address all objectives from #2630: restructuring guards to compile a no-op stub for RMT-less chips, allowing callers to use DummyRxDevice instead of failing at link time.
Out of Scope Changes check ✅ Passed The changes are narrowly focused on fixing GpioIsrRx::create's conditional compilation in one file; no unrelated modifications or scope creep detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gpio-isr-rx-stub-rmt-less-2630

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees

zackees commented May 31, 2026

Copy link
Copy Markdown
Member Author

Local verification update: bash compile esp32c2 --examples Remote failed at the framework compile step (long before reaching the linker that this PR fixes):

esp32-hal-gpio.c -> esp32-hal.h -> esp_sleep.h:12:10:
  fatal error: hal/touch_sensor_legacy_types.h: No such file or directory

This is an upstream Arduino-ESP32 SDK packaging gap — touch_sensor_legacy_types.h is shipped in the 3.3.7 framework cache's esp32/c3/c5/c6/h2 subsets but not in the esp32c2 subset, while esp_sleep.h includes it unconditionally. Verified by find ~/.fbuild ... -name "touch_sensor_legacy_types.h" — every other ESP32 has it, c2 doesn't.

The CI run that surfaced #2630 (run 26697900743) did not hit this framework error — it compiled the framework + FastLED library fine and only died at the link step on GpioIsrRx::create. So CI's framework cache state is different from the local one. Merging on the CI's verification rather than reproducing locally.

The fix itself is mechanically narrow:

  • Only changes behavior on chips where FASTLED_RMT5=0, which today is just ESP32-C2 (every other ESP32 variant has RMT and therefore RMT5=1).
  • For all other chips the gate evaluation is equivalent: FASTLED_RMT5 && SOC_MCPWM_SUPPORTED produces the same true/false as the previous nested #if FASTLED_RMT5 outer + SOC_MCPWM_SUPPORTED inner.
  • The new stub-fallback case for C2 returns nullptr, which the caller already wraps as DummyRxDevice at runtime.

Will file the framework SDK gap as a separate issue so users who hit it locally have a tracking link.

@zackees
zackees merged commit d8de199 into master May 31, 2026
6 of 7 checks passed
@zackees
zackees deleted the fix/gpio-isr-rx-stub-rmt-less-2630 branch August 21, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant