Calling HAL functions directly?
Posted: Mon May 10, 2021 6:17 pm
I am working on the ESP32 support in FastLED, and I'm trying to figure out how to make sure that our interrupt handler code is all in IRAM. We are using the RMT peripheral to generate the signal for clockless LED chips, and the problem is that we call RMT functions in ESP-IDF that are not marked with the IRAM attribute. So, users are occasionally seeing runtime failures when they use flash (e.g., SPIFFs).
One option is to hand inline the implementations of the RMT functions. But that will be a problem for long-term maintainability (especially with the new ESP32 variants coming out). It seems like a better solution is to call the HAL functions directly. For example, instead of calling rmt_tx_start, I would call rmt_ll_tx_start, which is already marked as "inline" in the header file, so presumably it would end up in IRAM if the calling function is.
Is that a viable strategy? How do I set up the #includes so it works?
(PS: I never got a response on my previous question about this issue from December)
One option is to hand inline the implementations of the RMT functions. But that will be a problem for long-term maintainability (especially with the new ESP32 variants coming out). It seems like a better solution is to call the HAL functions directly. For example, instead of calling rmt_tx_start, I would call rmt_ll_tx_start, which is already marked as "inline" in the header file, so presumably it would end up in IRAM if the calling function is.
Is that a viable strategy? How do I set up the #includes so it works?
(PS: I never got a response on my previous question about this issue from December)