Page 1 of 1

Remedy for overflow of iram0_0_seg?

Posted: Wed Feb 05, 2020 2:40 am
by jsam589
I have an application that was working nicely until I added a call to enter deep sleep. I then got the overflow and failure from linker shown below. I have tried changing from Debug to Release compiler option, and this eliminates the error (for now). However, I will soon be activating Bluetooth and I have seen other posts suggesting that may again overflow this segment. I am using IDF release/v4.0 commit b0d6c01b0.

One forum post mentioned editing components/esp32/ld/esp32.ld in the IDF, which I have also tried and that seems to work. I changed 0x20000 to 0x28000 and it built okay.
  • What is the limit, and any caveats, on increasing this value?
    Is there a way to have a local *.ld file in my project to override this value without editing the actual IDF file?

Code: Select all

[100%] Linking CXX executable knt.elf
/home/se/Esp_Idf_Versions/4_0rel_b0d6c01b0/tools/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: knt.elf section `.iram0.text' will not fit in region `iram0_0_seg'
/home/se/Esp_Idf_Versions/4_0rel_b0d6c01b0/tools/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: IRAM0 segment data does not fit.
/home/se/Esp_Idf_Versions/4_0rel_b0d6c01b0/tools/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: region `iram0_0_seg' overflowed by 205 bytes
collect2: error: ld returned 1 exit status
Original line in components/esp32/ld/esp32.ld:

Code: Select all

/* IRAM for PRO cpu. Not sure if happy with this, this is MMU area... */
  iram0_0_seg (RX) :                 org = 0x40080000, len = 0x20000

Re: Remedy for overflow of iram0_0_seg?

Posted: Wed Feb 05, 2020 4:09 am
by WiFive
You are extending into iram1 which is also used as heap memory and apptrace memory

Re: Remedy for overflow of iram0_0_seg?

Posted: Wed Feb 05, 2020 2:00 pm
by jsam589
WiFive wrote: "You are extending into iram1 which is also used as heap memory and apptrace memory"

Is it okay to do this? Will the iram1 allocation be adjusted automatically?

What is the usual solution to the error of not fitting into iram0_0_seg? It seems to happen to quite a few people.

A colleague on my same project has seen this when she activated Bluetooth. In my case, it showed up when I pulled in deep sleep.

How can we address this safely and still get the functionality working that we need?

Thanks!

Re: Remedy for overflow of iram0_0_seg?

Posted: Wed Feb 05, 2020 7:31 pm
by WiFive
No it is not adjusted automatically.

Re: Remedy for overflow of iram0_0_seg?

Posted: Sun May 22, 2022 1:04 pm
by emp32_32
Hello jsam589,

Did you ever receive an answer to your question "How can we address this safely and still get the functionality working that we need?" ?