Page 1 of 1

`.text' will not fit in region `iram1_0_seg'

Posted: Wed Apr 10, 2019 6:56 pm
by devbis
Hi everyone,

I'm writing a driver for esp8266 that one can use from micropython and after I extend class method with one more I've got the probem:

LINK build/firmware.elf
xtensa-lx106-elf-ld: build/firmware.elf section `.text' will not fit in region `iram1_0_seg'
xtensa-lx106-elf-ld: region `iram1_0_seg' overflowed by 292 bytes
Makefile:192: recipe for target 'build/firmware.elf' failed


Is it possible to enlarge iram1_0_seg or somehow make my module linked into final firmware?
Current values in esp8266.ld are:

iram1_0_seg : org = 0x40100000, len = 0x8000

Thanks

Re: `.text' will not fit in region `iram1_0_seg'

Posted: Wed Apr 10, 2019 7:27 pm
by Roberthh
You can change the map. Another option is to drop modules which you do not need. A good candidate the the btree module, which occupies 20k of code space. It is enabled (or disabled) by line 10 in Makefile. Just set MICROPY_PY_BTREE = 0

Re: `.text' will not fit in region `iram1_0_seg'

Posted: Thu Apr 11, 2019 7:00 am
by devbis
I tried to disable the btree module, but it doesn't help.
And it is strange that the number of overflowed bytes is the same.

You've mentioned that I can change the map. Could you please share a link or information about the values that I can change?
Just increasing the length of the segment cause garbage on the serial port after flashing.

Re: `.text' will not fit in region `iram1_0_seg'

Posted: Thu Apr 11, 2019 7:25 am
by Roberthh
Yes, after sending the msg I thought that I may have mixed that up with the rom segment.
The file to change would be esp8266.ld, as you pointed out. Just try to change the size.

Re: `.text' will not fit in region `iram1_0_seg'

Posted: Thu Apr 11, 2019 7:26 am
by pythoncoder
I'm not sure if this is the same problem but I've used

Code: Select all

irom0_0_seg :  org = 0x40209000, len = 0xa7000
to overcome linker problems caused by too large or too many frozen modules. You need to erase flash before installing the new build.

Re: `.text' will not fit in region `iram1_0_seg'

Posted: Thu Apr 11, 2019 7:50 am
by devbis
When I increase iram1_0_seg by 0x200 bytes, it compiles and links normally.
But after flashing of the firmware I have a boot loop with this text at UART:


load 0x40100000, len 33060, room 16
tail 4
chksum 0x20
load 0x3ffe8000, len 1080, room 4
tail 4
chksum 0xef
load 0x3ffe8440, len 824, room 4
tail 4
chksum 0x46
csum 0x46
Fatal exception 0(IllegalInstructionCause):
�pc1=0x401080c0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
ets Jan 8 2013,rst cause:2, boot mode:(3,6)

Can I put my C module somewhere in another section, like frozen modules?

Re: `.text' will not fit in region `iram1_0_seg'

Posted: Thu Apr 11, 2019 9:30 am
by Roberthh
That is whart I was concerned about, that the start of heap/stacxk is not automatically calculated an dhas to ba manually set. Maybe some of the authors can shed some light on it.
Edit: According to the data sheet, iram1 has the fixed size of 0x8000 bytes.