-->
Page 1 of 3

Error: .text will not fit in iram1_0_seg

PostPosted: Tue May 26, 2015 8:37 am
by Andrei Candale
Hi all,

I tried to upload some code on the esp but got the following error: section `.text' will not fit in region `iram1_0_seg'.
After googling it a bit I found that I could modify in what area of the memory will the code go. I added *(.literal .text .literal.* .text.*) to the .irom0.text section in eagle.app.v6.ld
Code: Select all  .irom0.text : ALIGN(4)
  {
    _irom0_text_start = ABSOLUTE(.);
    *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
    *(.literal .text .literal.* .text.*)
    _irom0_text_end = ABSOLUTE(.);
  } >irom0_0_seg :irom0_0_phdr


It now compiles just fine but the it seems that the code is't running on the esp. There should be some output on the serial interface and I should see and AP but none of that is happening.
Any idea what is happening or any suggestions?

Thank you!

Re: Error: .text will not fit in iram1_0_seg

PostPosted: Tue May 26, 2015 9:28 am
by Andrei Candale
Fixed it. I forgot one step. I found it in the Espruino-on-ESP8266 project in the Makefile https://github.com/aplikatika/Espruino- ... efile#L119

Also only *(.literal.* .text.*) needs to be added to .irom0.text and all your code goes to irom. If you want a specific function to go to iram:
Code: Select all #define ICACHE_RAM_ATTR __attribute__((section(".iram0.text")))
and prefix your function with it.

Re: Error: .text will not fit in iram1_0_seg

PostPosted: Fri Jun 19, 2015 11:03 am
by scargill
And here's me thinking that eagle.app.v6.ld change would save my life - made absolutely zero difference on recompile to the size of my .text area - currently sitting dangerously at 7c20.....

It certainly would make a lot more sense to specify which functions to put in RAM rather than the other way around as they're nearly all in FLASH.

Re: Error: .text will not fit in iram1_0_seg

PostPosted: Fri Jun 19, 2015 1:08 pm
by eriksl
Yes agree. I ended up marking nearly all of my functions with the irom attribute (which is very misleadingly called "ICACHE_FLASH_ATTR" and imho suggests the function will be cached in RAM which ultimately is NOT the case, the absence attribute does that!)