Skip to content

fix(esp32): add noinline to IRAM_ATTR functions in RMT4 header - #2252

Merged
zackees merged 1 commit into
masterfrom
fix-iram-noinline-rmt4
Apr 11, 2026
Merged

zackees merged 1 commit into
masterfrom
fix-iram-noinline-rmt4

Conversation

@zackees

@zackees zackees commented Apr 11, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Replace inline with __attribute__((noinline)) on 7 IRAM_ATTR functions in channel_driver_rmt4.h
  • GCC 14+ on Xtensa reorders literal pools, placing l32r constants after the instruction that references them, causing linker errors: dangerous relocation: l32r: literal placed after use
  • noinline prevents the compiler from inlining these ISR functions across translation units, keeping literal pool placement stable

Context

Files changed

  • src/platforms/esp/32/drivers/rmt/rmt_4/channel_driver_rmt4.h — 7 functions: handleInterrupt, onThresholdInterrupt, onTxDoneInterrupt, fillNextBuffer, convertByteToRMT, tx_start, findChannelByNumber

Test plan

  • Verify esp32dev build with GCC 14 toolchain (no l32r linker errors)
  • Verify RMT4 LED output still works on esp32dev
  • Verify no regression on esp32s3 (RMT5 path unaffected)

Closes #2247

Summary by CodeRabbit

Release Notes

  • Refactor
    • Optimized internal RMT driver implementation for enhanced stability.

GCC 14+ on Xtensa reorders literal pools, placing l32r constants
after the instruction that references them. This causes linker
errors: "dangerous relocation: l32r: literal placed after use".

Replace `inline` with `__attribute__((noinline))` on all 7
IRAM_ATTR functions defined in channel_driver_rmt4.h to prevent
the compiler from inlining them across translation units and
disrupting literal pool placement.

Closes #2247
@coderabbitai

coderabbitai Bot commented Apr 11, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bb524775-65e2-4afd-abef-150df396a842

📥 Commits

Reviewing files that changed from the base of the PR and between cb64a56 and f8db02e.

📒 Files selected for processing (1)
  • src/platforms/esp/32/drivers/rmt/rmt_4/channel_driver_rmt4.h

📝 Walkthrough

Walkthrough

Removed inline qualifiers and added __attribute__((noinline)) to six RMT4 ISR and helper functions to prevent Xtensa/GCC literal-pool reordering issues, while preserving existing function bodies and dispatch logic.

Changes

Cohort / File(s) Summary
RMT4 Channel Driver Function Inlining
src/platforms/esp/32/drivers/rmt/rmt_4/channel_driver_rmt4.h
Removed inline qualifiers and added __attribute__((noinline)) to handleInterrupt(), onThresholdInterrupt(), onTxDoneInterrupt(), fillNextBuffer(), convertByteToRMT(), tx_start(), and findChannelByNumber() to fix literal-pool reordering issues in IRAM code.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A pool of literals arranged just right,
No longer dancing through the night,
With noinline set and inline gone,
The Xtensa builds march cheerfully on! ✨

✨ 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-iram-noinline-rmt4

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 merged commit c83f763 into master Apr 11, 2026
45 of 67 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📊 Header Compilation Performance

Total Time: 1182.02ms

Top 5 Slowest Headers

  1. FastLED.h - 900.95ms
  2. fl/fastled.h - 388.19ms
  3. fl/task/executor.h - 297.54ms
  4. crgb.h - 222.44ms
  5. fl/gfx/crgb.h - 221.13ms

Warnings

⚠️ Header FastLED.h exceeds 150ms (900.9ms)
⚠️ Header fl/fastled.h exceeds 150ms (388.2ms)
⚠️ Header fl/task/executor.h exceeds 150ms (297.5ms)
⚠️ Header crgb.h exceeds 150ms (222.4ms)
⚠️ Header fl/gfx/crgb.h exceeds 150ms (221.1ms)
⚠️ Header fl/math/ease.h exceeds 150ms (216.2ms)
⚠️ Header fl/math/fixed_point.h exceeds 150ms (213.8ms)
⚠️ Header fl/task/scheduler.h exceeds 150ms (158.1ms)
⚠️ Header fl/stl/singleton.h exceeds 50ms (148.1ms)
⚠️ Header fl/stl/thread_local.h exceeds 50ms (147.2ms)
⚠️ Header fl/stl/thread.h exceeds 50ms (146.0ms)
⚠️ Header platforms/thread.h exceeds 50ms (145.9ms)
⚠️ Header platforms/stub/thread_stub.h exceeds 50ms (145.8ms)
⚠️ Header platforms/stub/thread_stub_stl.h exceeds 50ms (145.8ms)
⚠️ Header fl/task/promise.h exceeds 50ms (125.5ms)
⚠️ Header fl/ui.h exceeds 50ms (119.2ms)
⚠️ Header fl/stl/json.h exceeds 50ms (77.1ms)
⚠️ Header fl/stl/function.h exceeds 50ms (74.1ms)
⚠️ Header fl/math/fixed_point/s4x12.h exceeds 50ms (64.1ms)
⚠️ Header fl/stl/json/types.h exceeds 50ms (59.6ms)
⚠️ Header platforms.h exceeds 50ms (55.6ms)
⚠️ Header platforms/stub/fastled_stub.h exceeds 50ms (55.6ms)
⚠️ Template instantiation time is high (53.2%)

Full Report
================================================================================
FASTLED COMPILATION PERFORMANCE REPORT
================================================================================
Generated: 2026-04-11 07:49:23
Compiler: clang++-17
File: ci/perf/test_compile.cpp

SUMMARY
--------------------------------------------------------------------------------
Total Compilation Time:    2,262.47 ms
Frontend Time:             17.55 ms (0.8%)
Backend Time:              127.35 ms (5.6%)

COMPILATION PHASES
--------------------------------------------------------------------------------
Source                    15398.67 ms (680.6%)
Templates                   618.28 ms ( 27.3%)

FASTLED HEADERS (Level 1 - Direct Includes)
--------------------------------------------------------------------------------
  1790.7 ms - FastLED.h (SLOW)
  1086.1 ms - fl/task/executor.h (SLOW)
   601.1 ms - fl/task/promise.h (SLOW)
   551.3 ms - fl/stl/function.h (SLOW)
   470.9 ms - fl/task/scheduler.h (SLOW)
   461.3 ms - fl/stl/singleton.h (SLOW)
   460.6 ms - fl/stl/thread_local.h (SLOW)
   459.4 ms - fl/stl/thread.h (SLOW)
   459.3 ms - platforms/thread.h (SLOW)
   459.2 ms - platforms/stub/thread_stub.h (SLOW)
   459.2 ms - platforms/stub/thread_stub_stl.h (SLOW)
   447.3 ms - fl/fastled.h (SLOW)
   266.8 ms - fl/stl/vector.h (SLOW)
   249.5 ms - crgb.h (SLOW)
   248.2 ms - fl/gfx/crgb.h (SLOW)
   243.2 ms - fl/math/ease.h (SLOW)
   240.6 ms - fl/math/fixed_point.h (SLOW)
   213.7 ms - fl/math/math.h (SLOW)
   207.9 ms - fl/stl/undef.h (SLOW)
   151.7 ms - fl/stl/variant.h (SLOW)

FASTLED HEADERS (Nested Includes - Up to 10 Levels)
--------------------------------------------------------------------------------
FastLED.h (1790.7ms)
  ├─ 1086.1 ms - fl/task/executor.h
  │ ├─  601.1 ms - fl/task/promise.h
  │ │ ├─  551.3 ms - fl/stl/function.h
  │ │ │ ├─  266.8 ms - fl/stl/vector.h
  │ │ │ │ ├─  213.7 ms - fl/math/math.h
  │ │ │ │ │ └─  207.9 ms - fl/stl/undef.h
  │ │ │ │ │   └─  338.9 ms - stdlib.h
  │ │ │ │ │     ├─  181.9 ms - cstdlib
  │ │ │ │ │     │ └─  338.9 ms - stdlib.h
  │ │ │ │ │     │   ├─  181.9 ms - cstdlib
  │ │ │ │ │     │   ├─   81.6 ms - types.h
  │ │ │ │ │     │   ├─    4.6 ms - locale_t.h
  │ │ │ │ │     │   └─    4.5 ms - floatn.h
  │ │ │ │ │     ├─   81.6 ms - types.h
  │ │ │ │ │     │ ├─   81.6 ms - types.h
  │ │ │ │ │     │ │ ├─   81.6 ms - types.h
  │ │ │ │ │     │ │ ├─   15.8 ms - select.h
  │ │ │ │ │     │ │ ├─   12.7 ms - endian.h
  │ │ │ │ │     │ │ └─   10.0 ms - pthreadtypes.h
  │ │ │ │ │     │ ├─   15.8 ms - select.h
  │ │ │ │ │     │ │ └─    0.5 ms - sigset_t.h
  │ │ │ │ │     │ ├─   12.7 ms - endian.h
  │ │ │ │ │     │ │ └─    0.5 ms - byteswap.h
  │ │ │ │ │     │ └─   10.0 ms - pthreadtypes.h
  │ │ │ │ │     │   └─    9.4 ms - thread-shared-types.h
  │ │ │ │ │     ├─    4.6 ms - locale_t.h
  │ │ │ │ │     └─    4.5 ms - floatn.h
  │ │ │ │ ├─   23.3 ms - fl/stl/initializer_list.h
  │ │ │ │ ├─   18.7 ms - fl/stl/allocator.h
  │ │ │ │ │ └─   12.8 ms - fl/stl/bitset.h
  │ │ │ │ │   └─    8.2 ms - fl/stl/bitset_dynamic.h
  │ │ │ │ │     └─    2.2 ms - fl/stl/unique_ptr.h
  │ │ │ │ │       └─    0.5 ms - fl/stl/utility.h
  │ │ │ │ ├─    2.8 ms - fl/stl/basic_vector.h
  │ │ │ │ └─    0.8 ms - fl/stl/functional.h
  │ │ │ ├─  151.7 ms - fl/stl/variant.h
  │ │ │ │ └─  149.8 ms - fl/stl/new.h
  │ │ │ │   └─  149.7 ms - platforms/new.h
  │ │ │ │     └─  149.7 ms - platforms/shared/new.h
  │ │ │ │       └─  129.4 ms - new
  │ │ │ │         ├─   60.7 ms - c++config.h
  │ │ │ │         │ └─   54.5 ms - os_defines.h
  │ │ │ │         └─    0.7 ms - version.h
  │ │ │ ├─   92.5 ms - fl/stl/shared_ptr.h
  │ │ │ │ ├─   79.7 ms - fl/stl/type_traits.h
  │ │ │ │ │ └─   73.1 ms - fl/stl/move.h
  │ │ │ │ ├─    7.7 ms - fl/stl/atomic.h
  │ │ │ │ │ └─    6.8 ms - platforms/atomic.h
  │ │ │ │ │   └─    6.7 ms - platforms/shared/atomic.h
  │ │ │ │ └─    0.8 ms - fl/stl/bit_cast.h
  │ │ │ ├─   29.9 ms - fl/stl/compiler_control.h
  │ │ │ └─    4.8 ms - fl/stl/algorithm.h
  │ │ │   └─    2.1 ms - fl/math/random.h
  │ │ │     └─    1.0 ms - fl/math/random8.h
  │ │ └─   44.5 ms - fl/stl/string.h
  │ │   ├─   13.2 ms - fl/stl/basic_string.h
  │ │   │ ├─    1.1 ms - fl/stl/not_null.h
  │ │   │ ├─    1.0 ms - fl/stl/iterator.h
  │ │   │ └─    0.6 ms - fl/stl/charconv.h
  │ │   ├─    8.8 ms - fl/stl/span.h
  │ │   │ └─    3.5 ms - fl/math/geometry.h
  │ │   ├─    5.6 ms - fl/stl/string_view.h
  │ │   └─    1.5 ms - fl/stl/optional.h
  │ ├─  470.9 ms - fl/task/scheduler.h
  │ │ ├─  461.3 ms - fl/stl/singleton.h
  │ │ │ └─  460.6 ms - fl/stl/thread_local.h
  │ │ │   └─  459.4 ms - fl/stl/thread.h
  │ │ │     └─  459.3 ms - platforms/thread.h
  │ │ │       └─  459.2 ms - platforms/stub/thread_stub.h
  │ │ │         └─  459.2 ms - platforms/stub/thread_stub_stl.h
  │ │ │           └─  453.9 ms - thread
  │ │ │             ├─  270.1 ms - std_thread.h
  │ │ │             └─  149.9 ms - this_thread_sleep.h
  │ │ └─    8.7 ms - fl/task/task.h
  │ │   └─    3.6 ms - fl/trace.h
  │ │     ├─    2.3 ms - fl/stl/chrono.h
  │ │     └─    1.0 ms - fl/stl/tuple.h
  │ ├─   11.8 ms - platforms/await.h
  │ │ └─   11.3 ms - platforms/coroutine_runtime.h
  │ │   └─    9.7 ms - fl/system/engine_events.h
  │ │     ├─    5.1 ms - fl/math/screenmap.h
  │ │     │ └─    3.7 ms - fl/stl/flat_map.h
  │ │     └─    3.1 ms - fl/math/xymap.h
  │ │       └─    0.8 ms - fl/math/lut.h
  │ └─    0.8 ms - fl/task/promise_result.h
  ├─  447.3 ms - fl/fastled.h
  │ ├─  249.5 ms - crgb.h
  │ │ ├─  248.2 ms - fl/gfx/crgb.h
  │ │ │ └─  243.2 ms - fl/math/ease.h
  │ │ │   └─  240.6 ms - fl/math/fixed_point.h
  │ │ │     ├─   91.4 ms - fl/math/fixed_point/s4x12.h
  │ │ │     │ ├─   70.2 ms - fl/math/sin32.h
  │ │ │     │ │ └─   66.9 ms - fl/math/simd.h
  │ │ │     │ │   └─   66.4 ms - fl/math/simd/types.h
  │ │ │     │ │     └─   66.2 ms - platforms/simd.h
  │ │ │     │ ├─    1.0 ms - fl/math/fixed_point/traits.h
  │ │ │     │ └─    0.8 ms - fl/math/fixed_point/isqrt.h
  │ │ │     ├─   19.2 ms - fl/math/fixed_point/s24x8.h
  │ │ │     ├─   18.8 ms - fl/math/fixed_point/s8x8.h
  │ │ │     ├─   18.6 ms - fl/math/fixed_point/s8x24.h
  │ │ │     └─   18.6 ms - fl/math/fixed_point/s16x16.h
  │ │ └─    0.8 ms - chsv.h
  │ │   └─    0.7 ms - fl/gfx/hsv.h
  │ ├─   86.7 ms - platforms.h
  │ │ └─   86.6 ms - platforms/stub/fastled_stub.h
  │ │   ├─   49.3 ms - platforms/stub/fastspi_stub.h
  │ │   │ └─   49.3 ms - platforms/stub/fastspi_stub_generic.h
  │ │   │   ├─   42.9 ms - platforms/shared/active_strip_data/active_strip_data.h
  │ │   │   │ └─   40.8 ms - fl/id_tracker.h
  │ │   │   │   └─   39.9 ms - fl/stl/mutex.h
  │ │   │   │     └─   39.8 ms - platforms/mutex.h
  │ │   │   │       └─   39.6 ms - platforms/stub/mutex_stub.h
  │ │   │   └─    5.9 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  │ │   └─   37.2 ms - platforms/stub/clockless_stub.h
  │ │     └─   37.2 ms - platforms/stub/clockless_channel_stub.h
  │ │       ├─   13.3 ms - fl/system/log.h
  │ │       │ └─   12.8 ms - fl/stl/strstream.h
  │ │       ├─   13.2 ms - fl/channels/data.h
  │ │       │ └─    9.8 ms - fl/channels/config.h
  │ │       │   ├─    2.2 ms - fl/chipsets/chipset_timing_config.h
  │ │       │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │ │       │   └─    1.8 ms - fl/chipsets/spi.h
  │ │       ├─    2.4 ms - fl/channels/manager.h
  │ │       ├─    1.5 ms - fl/stl/weak_ptr.h
  │ │       └─    1.1 ms - fl/channels/driver.h
  │ ├─   42.1 ms - colorutils.h
  │ │ └─   41.3 ms - fl/gfx/colorutils.h
  │ │   ├─    8.9 ms - fl/gfx/blur.h
  │ │   │ └─    4.7 ms - fl/gfx/canvas.h
  │ │   │   └─    2.9 ms - fl/math/alpha.h
  │ │   └─    3.3 ms - fl/gfx/fill.h
  │ ├─   23.8 ms - pixel_controller.h
  │ │ ├─   17.2 ms - pixel_iterator.h
  │ │ │ └─   17.1 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │ │   ├─    5.1 ms - fl/chipsets/encoders/apa102.h
  │ │ │   │ └─    3.9 ms - fl/chipsets/encoders/encoder_utils.h
  │ │ │   │   └─    3.3 ms - fl/gfx/gamma_lut.h
  │ │ │   ├─    4.5 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │ │   ├─    1.1 ms - fl/chipsets/encoders/sk9822.h
  │ │ │   └─    0.8 ms - fl/chipsets/encoders/hd108.h
  │ │ └─    2.6 ms - rgbw.h
  │ │   └─    2.4 ms - fl/gfx/rgbw.h
  │ └─   23.2 ms - pixeltypes.h
  │   ├─   19.5 ms - lib8tion.h
  │   │ ├─   10.0 ms - fl/math/math8.h
  │   │ │ ├─    5.3 ms - fl/math/intmap.h
  │   │ │ │ └─    4.1 ms - platforms/intmap.h
  │   │ │ ├─    2.5 ms - fl/math/scale8.h
  │   │ │ │ └─    2.5 ms - platforms/scale8.h
  │   │ │ │   └─    1.0 ms - platforms/shared/scale8.h
  │   │ │ └─    2.1 ms - platforms/math8.h
  │   │ │   └─    1.7 ms - platforms/shared/math8.h
  │   │ ├─    2.2 ms - fl/math/beat.h
  │   │ │ └─    1.2 ms - fl/math/trig8.h
  │   │ │   └─    1.2 ms - platforms/trig8.h
  │   │ │     └─    1.1 ms - platforms/shared/trig8.h
  │   │ ├─    0.5 ms - fl/math/qfx.h
  │   │ └─    0.5 ms - fl/math/time_functions.h
  │   └─    3.3 ms - crgb.hpp
  ├─  120.4 ms - fl/ui.h
  │ ├─   77.7 ms - fl/stl/json.h
  │ │ └─   60.3 ms - fl/stl/json/types.h
  │ │   └─    7.6 ms - fl/stl/limits.h
  │ ├─   10.3 ms - fl/ui_impl.h
  │ │ └─    9.7 ms - platforms/ui_defs.h
  │ │   ├─    2.1 ms - platforms/shared/ui/json/audio.h
  │ │   │ └─    1.0 ms - platforms/shared/ui/json/audio_internal.h
  │ │   ├─    1.6 ms - platforms/shared/ui/json/button.h
  │ │   │ └─    0.6 ms - platforms/shared/ui/json/ui_internal.h
  │ │   ├─    0.9 ms - platforms/shared/ui/json/checkbox.h
  │ │   ├─    0.9 ms - platforms/shared/ui/json/help.h
  │ │   └─    0.8 ms - platforms/shared/ui/json/number_field.h
  │ └─    6.1 ms - fl/stl/url.h
  ├─   35.5 ms - fl/stl/stdint.h
  │ └─   35.3 ms - platforms/int.h
  │   └─   34.8 ms - platforms/shared/int.h
  │     └─   34.7 ms - platforms/shared/int_linux.h
  └─   28.4 ms - chipsets.h
    ├─   11.6 ms - fl/chipsets/ucs7604.h
    │ └─    8.7 ms - fl/chipsets/encoders/ucs7604.h
    ├─    6.7 ms - fl/chipsets/apa102.h
    ├─    1.7 ms - fl/chipsets/lpd880x.h
    ├─    0.9 ms - fl/chipsets/encoders/ws2816.h
    └─    0.8 ms - fl/chipsets/p9813.h
fl/task/executor.h (1086.1ms)
  ├─  601.1 ms - fl/task/promise.h
  │ ├─  551.3 ms - fl/stl/function.h
  │ │ ├─  266.8 ms - fl/stl/vector.h
  │ │ │ ├─  213.7 ms - fl/math/math.h
  │ │ │ │ └─  207.9 ms - fl/stl/undef.h
  │ │ │ │   └─  338.9 ms - stdlib.h
  │ │ │ │     ├─  181.9 ms - cstdlib
  │ │ │ │     │ └─  338.9 ms - stdlib.h
  │ │ │ │     │   ├─  181.9 ms - cstdlib
  │ │ │ │     │   │ └─  338.9 ms - stdlib.h
  │ │ │ │     │   ├─   81.6 ms - types.h
  │ │ │ │     │   │ ├─   81.6 ms - types.h
  │ │ │ │     │   │ ├─   15.8 ms - select.h
  │ │ │ │     │   │ ├─   12.7 ms - endian.h
  │ │ │ │     │   │ └─   10.0 ms - pthreadtypes.h
  │ │ │ │     │   ├─    4.6 ms - locale_t.h
  │ │ │ │     │   └─    4.5 ms - floatn.h
  │ │ │ │     ├─   81.6 ms - types.h
  │ │ │ │     │ ├─   81.6 ms - types.h
  │ │ │ │     │ │ ├─   81.6 ms - types.h
  │ │ │ │     │ │ │ ├─   81.6 ms - types.h
  │ │ │ │     │ │ │ ├─   15.8 ms - select.h
  │ │ │ │     │ │ │ ├─   12.7 ms - endian.h
  │ │ │ │     │ │ │ └─   10.0 ms - pthreadtypes.h
  │ │ │ │     │ │ ├─   15.8 ms - select.h
  │ │ │ │     │ │ │ └─    0.5 ms - sigset_t.h
  │ │ │ │     │ │ ├─   12.7 ms - endian.h
  │ │ │ │     │ │ │ └─    0.5 ms - byteswap.h
  │ │ │ │     │ │ └─   10.0 ms - pthreadtypes.h
  │ │ │ │     │ │   └─    9.4 ms - thread-shared-types.h
  │ │ │ │     │ ├─   15.8 ms - select.h
  │ │ │ │     │ │ └─    0.5 ms - sigset_t.h
  │ │ │ │     │ ├─   12.7 ms - endian.h
  │ │ │ │     │ │ └─    0.5 ms - byteswap.h
  │ │ │ │     │ └─   10.0 ms - pthreadtypes.h
  │ │ │ │     │   └─    9.4 ms - thread-shared-types.h
  │ │ │ │     ├─    4.6 ms - locale_t.h
  │ │ │ │     └─    4.5 ms - floatn.h
  │ │ │ ├─   23.3 ms - fl/stl/initializer_list.h
  │ │ │ ├─   18.7 ms - fl/stl/allocator.h
  │ │ │ │ └─   12.8 ms - fl/stl/bitset.h
  │ │ │ │   └─    8.2 ms - fl/stl/bitset_dynamic.h
  │ │ │ │     └─    2.2 ms - fl/stl/unique_ptr.h
  │ │ │ │       └─    0.5 ms - fl/stl/utility.h
  │ │ │ ├─    2.8 ms - fl/stl/basic_vector.h
  │ │ │ └─    0.8 ms - fl/stl/functional.h
  │ │ ├─  151.7 ms - fl/stl/variant.h
  │ │ │ └─  149.8 ms - fl/stl/new.h
  │ │ │   └─  149.7 ms - platforms/new.h
  │ │ │     └─  149.7 ms - platforms/shared/new.h
  │ │ │       └─  129.4 ms - new
  │ │ │         ├─   60.7 ms - c++config.h
  │ │ │         │ └─   54.5 ms - os_defines.h
  │ │ │         │   └─   49.7 ms - features.h
  │ │ │         └─    0.7 ms - version.h
  │ │ ├─   92.5 ms - fl/stl/shared_ptr.h
  │ │ │ ├─   79.7 ms - fl/stl/type_traits.h
  │ │ │ │ └─   73.1 ms - fl/stl/move.h
  │ │ │ ├─    7.7 ms - fl/stl/atomic.h
  │ │ │ │ └─    6.8 ms - platforms/atomic.h
  │ │ │ │   └─    6.7 ms - platforms/shared/atomic.h
  │ │ │ └─    0.8 ms - fl/stl/bit_cast.h
  │ │ ├─   29.9 ms - fl/stl/compiler_control.h
  │ │ └─    4.8 ms - fl/stl/algorithm.h
  │ │   └─    2.1 ms - fl/math/random.h
  │ │     └─    1.0 ms - fl/math/random8.h
  │ └─   44.5 ms - fl/stl/string.h
  │   ├─   13.2 ms - fl/stl/basic_string.h
  │   │ ├─    1.1 ms - fl/stl/not_null.h
  │   │ ├─    1.0 ms - fl/stl/iterator.h
  │   │ └─    0.6 ms - fl/stl/charconv.h
  │   ├─    8.8 ms - fl/stl/span.h
  │   │ └─    3.5 ms - fl/math/geometry.h
  │   ├─    5.6 ms - fl/stl/string_view.h
  │   └─    1.5 ms - fl/stl/optional.h
  ├─  470.9 ms - fl/task/scheduler.h
  │ ├─  461.3 ms - fl/stl/singleton.h
  │ │ └─  460.6 ms - fl/stl/thread_local.h
  │ │   └─  459.4 ms - fl/stl/thread.h
  │ │     └─  459.3 ms - platforms/thread.h
  │ │       └─  459.2 ms - platforms/stub/thread_stub.h
  │ │         └─  459.2 ms - platforms/stub/thread_stub_stl.h
  │ │           └─  453.9 ms - thread
  │ │             ├─  270.1 ms - std_thread.h
  │ │             │ ├─   78.9 ms - tuple
  │ │             │ ├─   52.5 ms - iosfwd
  │ │             │ ├─   38.6 ms - refwrap.h
  │ │             │ ├─   36.1 ms - gthr.h
  │ │             │ └─   11.7 ms - unique_ptr.h
  │ │             └─  149.9 ms - this_thread_sleep.h
  │ │               ├─  108.1 ms - chrono.h
  │ │               └─   30.9 ms - cerrno
  │ └─    8.7 ms - fl/task/task.h
  │   └─    3.6 ms - fl/trace.h
  │     ├─    2.3 ms - fl/stl/chrono.h
  │     └─    1.0 ms - fl/stl/tuple.h
  ├─   11.8 ms - platforms/await.h
  │ └─   11.3 ms - platforms/coroutine_runtime.h
  │   └─    9.7 ms - fl/system/engine_events.h
  │     ├─    5.1 ms - fl/math/screenmap.h
  │     │ └─    3.7 ms - fl/stl/flat_map.h
  │     └─    3.1 ms - fl/math/xymap.h
  │       └─    0.8 ms - fl/math/lut.h
  └─    0.8 ms - fl/task/promise_result.h
fl/fastled.h (447.3ms)
  ├─  249.5 ms - crgb.h
  │ ├─  248.2 ms - fl/gfx/crgb.h
  │ │ └─  243.2 ms - fl/math/ease.h
  │ │   └─  240.6 ms - fl/math/fixed_point.h
  │ │     ├─   91.4 ms - fl/math/fixed_point/s4x12.h
  │ │     │ ├─   70.2 ms - fl/math/sin32.h
  │ │     │ │ └─   66.9 ms - fl/math/simd.h
  │ │     │ │   └─   66.4 ms - fl/math/simd/types.h
  │ │     │ │     └─   66.2 ms - platforms/simd.h
  │ │     │ │       └─   66.1 ms - platforms/shared/simd_x86.hpp
  │ │     │ ├─    1.0 ms - fl/math/fixed_point/traits.h
  │ │     │ └─    0.8 ms - fl/math/fixed_point/isqrt.h
  │ │     ├─   19.2 ms - fl/math/fixed_point/s24x8.h
  │ │     ├─   18.8 ms - fl/math/fixed_point/s8x8.h
  │ │     ├─   18.6 ms - fl/math/fixed_point/s8x24.h
  │ │     └─   18.6 ms - fl/math/fixed_point/s16x16.h
  │ └─    0.8 ms - chsv.h
  │   └─    0.7 ms - fl/gfx/hsv.h
  ├─   86.7 ms - platforms.h
  │ └─   86.6 ms - platforms/stub/fastled_stub.h
  │   ├─   49.3 ms - platforms/stub/fastspi_stub.h
  │   │ └─   49.3 ms - platforms/stub/fastspi_stub_generic.h
  │   │   ├─   42.9 ms - platforms/shared/active_strip_data/active_strip_data.h
  │   │   │ └─   40.8 ms - fl/id_tracker.h
  │   │   │   └─   39.9 ms - fl/stl/mutex.h
  │   │   │     └─   39.8 ms - platforms/mutex.h
  │   │   │       └─   39.6 ms - platforms/stub/mutex_stub.h
  │   │   │         └─   39.6 ms - platforms/stub/mutex_stub_stl.h
  │   │   └─    5.9 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  │   └─   37.2 ms - platforms/stub/clockless_stub.h
  │     └─   37.2 ms - platforms/stub/clockless_channel_stub.h
  │       ├─   13.3 ms - fl/system/log.h
  │       │ └─   12.8 ms - fl/stl/strstream.h
  │       ├─   13.2 ms - fl/channels/data.h
  │       │ └─    9.8 ms - fl/channels/config.h
  │       │   ├─    2.2 ms - fl/chipsets/chipset_timing_config.h
  │       │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │       │   └─    1.8 ms - fl/chipsets/spi.h
  │       ├─    2.4 ms - fl/channels/manager.h
  │       ├─    1.5 ms - fl/stl/weak_ptr.h
  │       └─    1.1 ms - fl/channels/driver.h
  ├─   42.1 ms - colorutils.h
  │ └─   41.3 ms - fl/gfx/colorutils.h
  │   ├─    8.9 ms - fl/gfx/blur.h
  │   │ └─    4.7 ms - fl/gfx/canvas.h
  │   │   └─    2.9 ms - fl/math/alpha.h
  │   └─    3.3 ms - fl/gfx/fill.h
  ├─   23.8 ms - pixel_controller.h
  │ ├─   17.2 ms - pixel_iterator.h
  │ │ └─   17.1 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │   ├─    5.1 ms - fl/chipsets/encoders/apa102.h
  │ │   │ └─    3.9 ms - fl/chipsets/encoders/encoder_utils.h
  │ │   │   └─    3.3 ms - fl/gfx/gamma_lut.h
  │ │   ├─    4.5 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │   ├─    1.1 ms - fl/chipsets/encoders/sk9822.h
  │ │   └─    0.8 ms - fl/chipsets/encoders/hd108.h
  │ └─    2.6 ms - rgbw.h
  │   └─    2.4 ms - fl/gfx/rgbw.h
  └─   23.2 ms - pixeltypes.h
    ├─   19.5 ms - lib8tion.h
    │ ├─   10.0 ms - fl/math/math8.h
    │ │ ├─    5.3 ms - fl/math/intmap.h
    │ │ │ └─    4.1 ms - platforms/intmap.h
    │ │ ├─    2.5 ms - fl/math/scale8.h
    │ │ │ └─    2.5 ms - platforms/scale8.h
    │ │ │   └─    1.0 ms - platforms/shared/scale8.h
    │ │ └─    2.1 ms - platforms/math8.h
    │ │   └─    1.7 ms - platforms/shared/math8.h
    │ ├─    2.2 ms - fl/math/beat.h
    │ │ └─    1.2 ms - fl/math/trig8.h
    │ │   └─    1.2 ms - platforms/trig8.h
    │ │     └─    1.1 ms - platforms/shared/trig8.h
    │ ├─    0.5 ms - fl/math/qfx.h
    │ └─    0.5 ms - fl/math/time_functions.h
    └─    3.3 ms - crgb.hpp
fl/ui.h (120.4ms)
  ├─   77.7 ms - fl/stl/json.h
  │ └─   60.3 ms - fl/stl/json/types.h
  │   └─    7.6 ms - fl/stl/limits.h
  ├─   10.3 ms - fl/ui_impl.h
  │ └─    9.7 ms - platforms/ui_defs.h
  │   ├─    2.1 ms - platforms/shared/ui/json/audio.h
  │   │ └─    1.0 ms - platforms/shared/ui/json/audio_internal.h
  │   ├─    1.6 ms - platforms/shared/ui/json/button.h
  │   │ └─    0.6 ms - platforms/shared/ui/json/ui_internal.h
  │   ├─    0.9 ms - platforms/shared/ui/json/checkbox.h
  │   ├─    0.9 ms - platforms/shared/ui/json/help.h
  │   └─    0.8 ms - platforms/shared/ui/json/number_field.h
  └─    6.1 ms - fl/stl/url.h
fl/stl/stdint.h (35.5ms)
  └─   35.3 ms - platforms/int.h
    └─   34.8 ms - platforms/shared/int.h
      └─   34.7 ms - platforms/shared/int_linux.h

TOP 20 SLOWEST OPERATIONS
--------------------------------------------------------------------------------
  1.  1790.7 ms - Source: FastLED.h
  2.  1790.7 ms - Total Source: 
  3.  1086.1 ms - Source: fl/task/executor.h
  4.   654.5 ms - Total ParseClass: 
  5.   601.1 ms - Source: fl/task/promise.h
  6.   551.3 ms - Source: fl/stl/function.h
  7.   470.9 ms - Source: fl/task/scheduler.h
  8.   461.3 ms - Source: fl/stl/singleton.h
  9.   460.6 ms - Source: fl/stl/thread_local.h
 10.   459.4 ms - Source: fl/stl/thread.h
 11.   459.3 ms - Source: platforms/thread.h
 12.   459.2 ms - Source: platforms/stub/thread_stub.h
 13.   459.2 ms - Source: platforms/stub/thread_stub_stl.h
 14.   453.9 ms - Source: thread
 15.   447.3 ms - Source: fl/fastled.h
 16.   270.1 ms - Source: std_thread.h
 17.   266.8 ms - Source: fl/stl/vector.h
 18.   249.5 ms - Source: crgb.h
 19.   248.2 ms - Source: fl/gfx/crgb.h
 20.   243.2 ms - Source: fl/math/ease.h

PERFORMANCE FLAGS
--------------------------------------------------------------------------------
⚠️  SLOW HEADERS (>50.0ms):
    - FastLED.h (1790.7ms)
    - fl/task/executor.h (1086.1ms)
    - fl/task/promise.h (601.1ms)
    - fl/stl/function.h (551.3ms)
    - fl/task/scheduler.h (470.9ms)
    - fl/stl/singleton.h (461.3ms)
    - fl/stl/thread_local.h (460.6ms)
    - fl/stl/thread.h (459.4ms)
    - platforms/thread.h (459.3ms)
    - platforms/stub/thread_stub.h (459.2ms)

⚠️  Template instantiation time is high (27.3% of total)
✓  Lexing time is acceptable (<10% of total)

RECOMMENDATIONS
--------------------------------------------------------------------------------
1. Consider optimizing FastLED.h (1790.7ms)
2. Consider optimizing fl/task/executor.h (1086.1ms)
3. Consider optimizing fl/task/promise.h (601.1ms)

================================================================================

zackees added a commit that referenced this pull request Jun 30, 2026
)

Brings the classic-ESP32 RMT (rmt_4) driver in line with the
ChannelEngine + Peripheral API-object pattern that UART, FlexIO, and
RMT5 already use. This is Phase 1 + Phase 3 of the plan in #3458:
peripheral wrapper + bus-holder shape cleanup. Phase 2 (the actual
ESP-IDF lifecycle calls) was already implemented — the stale
"Stubs (to be implemented in Phase 3B)" comment misled the survey.

## What moved through the wrapper

The new `IRMT4Peripheral` virtual interface (`irmt4_peripheral.h`)
covers exactly the ESP-IDF lifecycle/control surface:

  - rmt_config()
  - rmt_driver_install() / rmt_driver_uninstall()
  - rmt_set_tx_thr_intr_en()
  - rmt_set_tx_intr_en()
  - rmt_set_gpio() / rmt_set_pin()
  - esp_intr_alloc() / esp_intr_free()

`Rmt4PeripheralESP` is the real-hardware concrete impl. The engine
holds a `shared_ptr<IRMT4Peripheral>` and routes those calls through
it.

## What does NOT go through the wrapper

The IRAM ISR hot path stays inline in the engine header. Virtual
dispatch from the ISR would defeat the `FL_NO_INLINE` literal-pool
placement guarantees on Xtensa (#2247 / #2252):

  - direct RMT.* register reads/writes
  - gpio_matrix_out() disconnect
  - fillNextBuffer() double-buffer refill
  - tx_start() per-platform register kicks

The interface header's docblock spells this out explicitly under
"Interface scope — what's OUT".

## BusTraits<Bus::RMT> uses the holder pattern

`bus_traits.h` now constructs a `detail::Rmt4BusHolder { peripheral,
driver }`, mirroring `detail::UartBusHolder` exactly. The static
`gHolder` keeps both lifetimes paired and the function-local-static
guard means we still only emit one `BusTraits<Bus::RMT>` definition
per program.

## Stale comment removed

`channel_driver_rmt4.cpp.hpp` had a "Stubs (to be implemented in
Phase 3B)" banner above `acquireChannel()` / `releaseChannel()` /
`configureChannel()`. Those are all implemented — they install the
driver, configure the channel, allocate the hardware buffer, etc.
The banner was a leftover from the Phase-3A scaffolding and gave a
misleading impression of the driver's completeness.

## Tests + validation

- `bash test --cpp` — 340/340 pass on this branch.
- `clang-format --dry-run --Werror` clean on all new + edited files.
- `bash compile esp32dev --examples AutoResearch` is currently
  blocked on this Windows box by a separate fbuild spec-file
  backslash regression (`cc1plus: fatal error: C:Usersniteris...`)
  that also reproduces on plain master. Tracked separately —
  not introduced by this PR. CI on Linux will exercise the build.

## Out of scope

- `Rmt4PeripheralMock` for host-side unit tests of the engine's
  channel acquire/reconfigure/release strategies — straightforward
  follow-up but not in this PR.
- RMT5 (S3/C3/C6/H2/P4) — separate driver, already conforms.
- The TX/RX `rmt_4` + `rmt_rx` peripheral merge — flagged in the
  survey, explicitly out of scope.

Closes #3458.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees deleted the fix-iram-noinline-rmt4 branch August 30, 2026 22:22
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.

I2SClockBasedLedDriver (third party / Yves) causes compile warnings and linker errors

1 participant