Page 1 of 1

Options to resolve: "IRAM0 segment data does not fit"

Posted: Tue Jul 30, 2019 8:31 pm
by avidNewb
Using Arduino IDE and ESP-IDF 1.0.2

I've got a very large project that I keep hitting the limits of IRAM for. Each time I refactor any code I can to decrease the load and end up removing the "IRAM_ATTR" attribute from one of my tasks. However, I'm running out of opportunities to do that and I'm not sure what issues may arrive when this project is in production from doing that.

I've considered switching to a board with PSRAM but I don't understand how that works in Arduino IDE. I tried compiling for an "ESP32 Dev Module" with PSRAM Enabled but this doesn't resolve the issue mentioned above. I don't currently have a board with PSRAM so I'm not sure if it is initializing the PSRAM or not.

I have a few questions:

1. Can external RAM resolve this issue? If so, how do I utilize it with an Arduino IDE project?
2. Is it advisable to remove some of the ESP-IDF items from IRAM to resolve this? Does anyone that has done this have suggestions on items to remove?
3. Is it possible to change the memory configuration to move some space from iram0_2_seg to iram0_0_seg?

If anyone has other suggestions, I am all ears.

Re: Options to resolve: "IRAM0 segment data does not fit"

Posted: Wed Jul 31, 2019 12:32 am
by WiFive
Why are you putting so much stuff in IRAM? Usually only very time sensitive stuff like interrupt callbacks should go there. Psram is only for dram not iram.

Re: Options to resolve: "IRAM0 segment data does not fit"

Posted: Wed Jul 31, 2019 4:24 am
by avidNewb
It's an aquarium light controller with some tasks in IRAM such as the dimmer task. Other than that, I'm not really. I've moved almost everything out that I can. It's not even when I'm adding to these tasks that the error occurs. For instance, I'm working on esp now communication and somehow breached the IRAM0 limit when this task is not in IRAM. It's my understanding that variables can be placed there as well. I may be wrong on that.

Re: Options to resolve: "IRAM0 segment data does not fit"

Posted: Wed Jul 31, 2019 4:40 am
by avidNewb
Update:
I now understand that the iram2 segment is actually flash so this doesn't help me.