Skip to content

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

Closed

Description

@ewowi

No Linker errors on master of March 31, latest master has

.pio/build/esp32-d0/lib657/FastLED/fl/build/platforms+.cpp.o: in function `_ZN22I2SClockBasedLedDriver7i2sStopEv':
/Users/ewoud/Developer/GitHub/MoonModules/MoonLight/.pio/libdeps/esp32-d0/FastLED/src/third_party/yves/I2SClockBasedLedDriver/I2SClockBasedLedDriver.h:1157:(.iram1.3[_ZN22I2SClockBasedLedDriver7i2sStopEv]+0x6): dangerous relocation: l32r: literal placed after use: (.literal._ZN22I2SClockBasedLedDriver7i2sStopEv+0x4)
/Users/ewoud/Developer/GitHub/MoonModules/MoonLight/.pio/libdeps/esp32-d0/FastLED/src/third_party/yves/I2SClockBasedLedDriver/I2SClockBasedLedDriver.h:843:(.iram1.3[_ZN22I2SClockBasedLedDriver7i2sStopEv]+0x27): dangerous relocation: l32r: literal placed after use: .literal._ZN22I2SClockBasedLedDriver7i2sStopEv

proposal: remove it as we have now the (channel) engines.

Activity

  1. zackees commented on Apr 4, 2026

    @zackees
    Member

    This is a 16 way spi driver using the LCD_CAM (esp32s3) and I2S peripherals (esp32dev). This driver hasn't been migrated yet but now's a good time to start on this.

  2. ewowi commented on Apr 4, 2026

    @ewowi
    Author

    I know as I work with @hpwit on it, see hpwit/I2SClocklessLedDriver#48 and hpwit/I2SClocklessLedDriver#51

    In which I work towards a new release. Best thing is wait for the new release as that will be an easy to lib_dep library (esp-idf 5.5 compatible )

    Also fully compatible with FastLED Channel API as it will have runtime creation, config and destruction

    Actually latest dev commit is what I use in MoonLight as alternative to the FastLED Channels API.

    So let's discuss priority and timeline , this dev commit can already be integrated with FastLED, only thing is it is tuned for esp-idf 5.5

    The old version which is now in third party / Yves has bugs (not only compile and link but also runtime)

  3. zackees commented on Apr 5, 2026

    @zackees
    Member

    My migration willl have async processing with ISR buffer refills. Hpwit didn't put that in as far as I know.

    You are more than welcome to take our driver and wrap it in standalone form without attribution. But attribution is appreciated.

  4. ewowi commented on Apr 5, 2026

    @ewowi
    Author

    I am not a real specialist in driver code. I work together with @hpwit to leave his code as untouched as possible, but add better management around it.

    So I think best is to work 'async' on this. Also because I don't have the time to really dive in.

    So could you do one thing on the third party Yves driver: guard all its files (.h/.cpp) with #ifdef . So if you use FastLED but not using third party / Yves driver there are no warnings or (in yesterdays master) link errors.

  5. hpwit commented on Apr 5, 2026

    @hpwit

    My migration willl have async processing with ISR buffer refills. Hpwit didn't put that in as far as I know.

    You are more than welcome to take our driver and wrap it in standalone form without attribution. But attribution is appreciated.

    Hello could you please explain what you have in mind exactly? The buffer refill is currently done In ISR.
    More than happy to integrate your idea in the buffer.

  6. zackees commented on Apr 6, 2026

    @zackees
    Member

    did not know the ISR was doing buffer re-fill. The big thing is that channel driver for fastled4 has a interface and the I2SClock driver does not fullfill it so it can't cooperate with the rest of the system. FastLED's system is a little bit more complex because it inserts padding on the fly and handles groups of identical chipsets.

    The channel driver has to cooperatively allow pending main thread tasks (wifi coroutines, audio processing) to run until the last group has finished or entered into a draining state, in which case the FastLED.show() completely yeilds back to the main thread to compute the next frame or handle other tasks.

    If I were to just have the driver wrapped then it would be a blocking call.

  7. hpwit commented on Apr 6, 2026

    @hpwit

    did not know the ISR was doing buffer re-fill. The big thing is that channel driver for fastled4 has a interface and the I2SClock driver does not fullfill it so it can't cooperate with the rest of the system. FastLED's system is a little bit more complex because it inserts padding on the fly and handles groups of identical chipsets.

    The channel driver has to cooperatively allow pending main thread tasks (wifi coroutines, audio processing) to run until the last group has finished or entered into a draining state, in which case the FastLED.show() completely yeilds back to the main thread to compute the next frame or handle other tasks.

    If I were to just have the driver wrapped then it would be a blocking call.

    Hello
    By adding padding you mean being able to handle several types of led at the same time or something else ?
    When you execute a show in the I2s driver it is in blocking function unless you ask it to give you back the control using the NO_WAIT option. I am using a semaphore for that. It's explained in the documentation.
    If you can give me a specific example of what you wanna do.
    Regards

  8. ewowi commented on Apr 6, 2026

    @ewowi
    Author

    Above discussion triggered me to finally finish 2 years of dev, making it ready for merge into main, merge it and publishing a new release: see https://github.com/hpwit/I2SClocklessLedDriver/releases/tag/1.4 🥳

  9. ewowi commented on Apr 6, 2026

    @ewowi
    Author

    @zackees , can I convince you to include this repo and branch and pull request any changes you would like to add on this repo, so we have one consistent codebase instead of 2?
    I promise you this is good code, as I set up linting as you learned me and will add unit tests as well the coming day, so you should be familiar with it ;-)

  10. zackees commented on Apr 6, 2026

    @zackees
    Member

    Can I convince you to include this repo and branch and submit pull requests for any changes you would like to add, so we maintain one consistent codebase instead of two?

    TL;DR: I'm happy to backport, yes also I think the I2S repo's need to re-write their driver using my "autoresearch" agent. See below.


    First, I want to acknowledge that @hpwit is a stronger driver developer than I am. That is clear from the quality and depth of his driver work, and I have a lot of respect for what he built.

    What I Built

    Since around November, I’ve been building an automated research and validation system for driver development. This is a framework that allows drivers to be developed, tested, and validated in an automated way using real hardware, unit tests, and a JSON-RPC control layer between a host machine and the device.

    It's easier to show the innovation if we just dive into code immediately:

    #!/usr/bin/env bash
    
    PROMPT="Use the auto research framework to implement I2S driver for esp32dev
    on the attached device. Don't stop until it works."
    
    # solder pin 1 to pin 2 on esp32dev, then attach it to the computer through the USB port.
    git clone https://github.com/fastled/fastled
    cd fastled
    
    claude --dangerously-skip-permissions -m "$PROMPT"
    
    # now get a cup of coffee and come back in an hour

    Autoresearch is a borrowed term from Andrej Karpathy's AI centered research but the change here in FastLED is that we aren't training models, we are doing driver/feature development that requires a physical chip to validate. Auto research has a way to edit and evaluation function to score the output, FastLED uses an RX device to evaluate how close the LED signal matches expected timings.

    The key architectural change that made this work was splitting drivers into two layers:

    • Platform-neutral Channel Driver

      • Waveform generation
      • Buffering
      • Transposition
      • Scheduling
    • Platform-specific Peripheral Layer

      • ESP implementation
      • Mock peripheral used for unit tests

    This separation turned out to be extremely important. It moved most of the complex logic into a platform-neutral layer that can be unit tested and reasoned about automatically, while keeping the ESP-specific code very small and isolated.

    Once I made that split, the automated system became dramatically more effective at debugging and optimizing drivers, because the really complex logic was now testable in isolation and the hardware-specific layer was small enough to reason about at the datasheet level.

    This refactor alone exposed a large number of bugs in the PARLIO driver and made optimization much easier.

    For example:

    • The driver can automatically switch between Wave3 and Wave8 encoding depending on chipset timing.
    • This optimization exists entirely in the platform-neutral layer.
    • The ESP peripheral layer does not need to know about any of this.
    • It just transmits the bitstream.
    • The mock peripheral reports what was transmitted.
    • Unit tests validate whether the correct encoding path was chosen.

    Development Time Impact

    The impact on development time has been pretty significant.

    Before the automated research system

    • I2S: ~1–2 years
    • RMT: ~1–2 months

    With the automated research system

    • PARLIO early prototype: ~2 weeks
    • PARLIO rewrite: 2 days
    • UART: 2 days
    • I2S: 1 day
    • Clocked I2S: ~4 hours

    Possible Paths Forward

    I see a few possible paths forward:

    Option 1

    Automated research maintains the I2S, LCD, and PARLIO drivers inside FastLED and they are machine validated.

    Other driver interfaces could wrap these drivers so we reduce long term maintenance and avoid having multiple independent low level implementations to maintain.

    Option 2

    FastLED makes a special exception and treats some drivers as third party drivers, and development on those continues manually outside the main driver framework.

    Option 3

    The drivers remain separate, but features and bug fixes are translated and backported between them, potentially with automated tooling helping with the translation work.


    My Position

    Based on development speed and long term maintenance, I think Option 1 or Option 3 gives the strongest long term outcome, but I am open to discussion because this affects more than just me.

    To be clear:

    • I am not trying to replace or diminish the manual driver work.
    • I did not port that code.
    • The manual implementation solved the problem and established the ground truth for what a correct driver needs to do.

    What I built is a framework around development, testing, and validation so that future driver work and IDF migrations do not require that level of manual effort again.

    The goal is to turn what used to be a multi-year effort into something repeatable, testable, and maintainable.


    Going Forward

    This auto-research tool that I've developed is the first open source implementation of the concept for embedded. This thread represents the first public disclosure of this framework, and you are both the first to know about it's capabilities, though I have hinted about it in other threads.

    If there are features that have been on the wishlist but were too time consuming to implement manually, this system is very good at tackling exactly those kinds of problems.

    So the real question I am trying to answer is this:

    How do we best align driver development so that everyone benefits from this tooling and we do not duplicate effort going forward?

    And zooming out a bit, I think this is also where things are heading in general. The tools for automated research, testing, and code generation are getting better very quickly. Driver development is probably not going to get more manual over time, it is going to get less manual.

    So how about this: I'll do a backport when all of this is done

  11. hpwit commented on Apr 6, 2026

    @hpwit

    this comment was accidentally deleted by zackees

  12. ewowi commented on Apr 6, 2026

    @ewowi
    Author

    If I understand correctly , above means that FastLED parallel drivers / engines are what is currently exposed in the channels API isn't it ?
    So third party / Yves is than legacy what is going to be removed? So you have one driver system as I2S is already supported. Maybe lcd_cam not , will that be added?

    But ultimately third party / yves will be redundant ?

    So hpwit and I will maintain i2s clockless driver. But as an alternative to the FastLED engines. Maybe some day it will disappear , we will see

  13. zackees commented on Apr 6, 2026

    @zackees
    Member

    Can you run this for fun?

    #!/usr/bin/env bash
    
    PROMPT="Use the auto research framework to implement I2S driver for esp32dev
    on the attached device. Don't stop until it works."
    
    # solder pin 1 to pin 2 on esp32dev, then attach it to the computer through the USB port.
    git clone https://github.com/fastled/fastled
    cd fastled
    
    claude --dangerously-skip-permissions -m "$PROMPT"
  14. zackees commented on Apr 6, 2026

    @zackees
    Member

    If I understand correctly , above means that FastLED parallel drivers / engines are what is currently exposed in the channels API isn't it ? So third party / Yves is than legacy what is going to be removed? So you have one driver system as I2S is already supported. Maybe lcd_cam not , will that be added?

    But ultimately third party / yves will be redundant ?

    So hpwit and I will maintain i2s clockless driver. But as an alternative to the FastLED engines. Maybe some day it will disappear , we will see

    LCD_CAM and LCD_RGB (the other esp32p4 16-way driver) are both implemented via the auto research tool yes.

  15. zackees commented on Apr 6, 2026

    @zackees
    Member

    If I understand correctly , above means that FastLED parallel drivers / engines are what is currently exposed in the channels API isn't it ? So third party / Yves is than legacy what is going to be removed?

    Correct.

  16. zackees commented on Apr 6, 2026

    @zackees
    Member

    If I can be of any help in that endeavour let me know.

    @hpwit What if the auto research tool was applied to your esp script?

  17. hpwit commented on Apr 6, 2026

    @hpwit

    If I can be of any help in that endeavour let me know.

    @hpwit What if the auto research tool was applied to your esp script?

    Why not I am currently working a new version of the compiler maybe on this new one.

  18. zackees commented on Apr 6, 2026

    @zackees
    Member

    This script will do it, run it in a cloned fastled repo:

    #!/usr/bin/env bash
    
    PROMPT="Use the auto research framework to implement esp-script for esp32s3
    on the attached device. Don't stop until it works in a unit test. Then deploy to the
    attached esp32dev device and validate that all esp script functions work. Fix all errors.
    
    Migrate this repo:
      https://github.com/hpwit/ESPLiveScript
    
    Into src/third_party/yves/esplivescript and write proper unit tests in the correct location.
    run the unit tests in debug mode to catch errors using address sanitizer.
    
    Use `bash autoresearch --script` command arg to invoke the auto research
    esp script test on the live device
    "
    
    
    
    claude --dangerously-skip-permissions -m "$PROMPT"
    
    # now get a cup of coffee and come back in an hour

    Replace the repo link with your dev branch

    Then when it's done copy the code back into your repo. Sending us a PR is optional but appreciated.

  19. zackees commented on Apr 7, 2026

    @zackees
    Member

    I'm out of AI credits but we did manage to get the lcd-spi working with multi lane support < 300 leds. I'll continue where i left off on friday.

  20. ewowi commented on Apr 10, 2026

    @ewowi
    Author

    No Linker errors on master of March 31, latest master has

    .pio/build/esp32-d0/lib657/FastLED/fl/build/platforms+.cpp.o: in function `_ZN22I2SClockBasedLedDriver7i2sStopEv':
    /Users/ewoud/Developer/GitHub/MoonModules/MoonLight/.pio/libdeps/esp32-d0/FastLED/src/third_party/yves/I2SClockBasedLedDriver/I2SClockBasedLedDriver.h:1157:(.iram1.3[_ZN22I2SClockBasedLedDriver7i2sStopEv]+0x6): dangerous relocation: l32r: literal placed after use: (.literal._ZN22I2SClockBasedLedDriver7i2sStopEv+0x4)
    /Users/ewoud/Developer/GitHub/MoonModules/MoonLight/.pio/libdeps/esp32-d0/FastLED/src/third_party/yves/I2SClockBasedLedDriver/I2SClockBasedLedDriver.h:843:(.iram1.3[_ZN22I2SClockBasedLedDriver7i2sStopEv]+0x27): dangerous relocation: l32r: literal placed after use: .literal._ZN22I2SClockBasedLedDriver7i2sStopEv
    

    proposal: remove it as we have now the (channel) engines.

    #2203 (comment) addresses the same issue and if implemented also solves this issue

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