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

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
devbis
Posts: 6
Joined: Sun Feb 17, 2019 11:03 am

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

Post by devbis » Wed Apr 10, 2019 6:56 pm

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

User avatar
Roberthh
Posts: 1469
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

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

Post by Roberthh » Wed Apr 10, 2019 7:27 pm

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

devbis
Posts: 6
Joined: Sun Feb 17, 2019 11:03 am

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

Post by devbis » Thu Apr 11, 2019 7:00 am

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.

User avatar
Roberthh
Posts: 1469
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

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

Post by Roberthh » Thu Apr 11, 2019 7:25 am

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.

User avatar
pythoncoder
Posts: 3455
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

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

Post by pythoncoder » Thu Apr 11, 2019 7:26 am

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.
Peter Hinch

devbis
Posts: 6
Joined: Sun Feb 17, 2019 11:03 am

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

Post by devbis » Thu Apr 11, 2019 7:50 am

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?

User avatar
Roberthh
Posts: 1469
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

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

Post by Roberthh » Thu Apr 11, 2019 9:30 am

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.

Post Reply