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

Stational
Posts: 42
Joined: Sat Jul 02, 2016 10:54 pm

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

Postby Stational » Sat Dec 03, 2016 3:25 am

Hello,

if i try to build my project with the esp-open-sdk i get this error:

xtensa-lx106-elf-gcc -Teagle.app.v6.ld segmentled.o -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -lc -Wl,--end-group -lgcc -o segmentled
/home/test/Desktop/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: segmentled section `.text' will not fit in region `iram1_0_seg'
/home/test/Desktop/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: region `iram1_0_seg' overflowed by 1000 bytes
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'segmentled' failed
make: *** [segmentled] Error 1


My code isn't very long (~250 lines). Why does this happen and how can i fix it?

pratik

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

Postby pratik » Sun Dec 04, 2016 8:35 pm

Have you modified your LD files?
Also, note that mbedTLS based builds must use the LD file provided by Espressif (otherwise you have to relocate code to iCache in your LD file).
Also, please specify the SDK version and your environment setup details so that it is easier to track the issue down.

Stational
Posts: 42
Joined: Sat Jul 02, 2016 10:54 pm

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

Postby Stational » Fri Dec 09, 2016 5:17 am

Hi and thanks for your reply,

could you tell me where i find the LD-files and how i should modify them? SDK is 2.0.0_16_08_10, i use the esp-open-sdk on debian 8.6 64-bit.
I moved the libgcc.a file from:
esp-open-sdk/ESP8266_NONOS/lib/
to
esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5
This helped a bit. I am working on a bigger project right now (~200 lines of code) and i am alredy running against the bound again! I don't understand why this happens, i thought the ESP-12F has 4MB of flash (which is a lot, i think...).

Best regards

Max

pratik

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

Postby pratik » Sun Dec 11, 2016 12:15 pm

Please use ICACHE_FLASH_ATTR in all your functions. That is what will place them in flash.
Your functions are getting placed in the iRAM... it is RAM and is in a few KBs only!

Stational
Posts: 42
Joined: Sat Jul 02, 2016 10:54 pm

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

Postby Stational » Sat Dec 17, 2016 5:13 am

That didn't help, i added:

LOCAL void ICACHE_FLASH_ATTR


in front of all my functions but the message is still the same:

xtensa-lx106-elf-gcc -I. -mlongcalls -c -o sensor.o sensor.c
xtensa-lx106-elf-gcc -Teagle.app.v6.ld sensor.o -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -lc -Wl,--end-group -lgcc -o sensor
/home/test/Desktop/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: sensor section `.text' will not fit in region `iram1_0_seg'
/home/test/Desktop/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: region `iram1_0_seg' overflowed by 344 bytes
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'sensor' failed
make: *** [sensor] Error 1


Could you explain how i fix this problem and how it is caused, please?

Stational
Posts: 42
Joined: Sat Jul 02, 2016 10:54 pm

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

Postby Stational » Sun Dec 18, 2016 5:23 am

-DICACHE_FLASH
after
CFLAGS = -I.
in the Makefile did it for me.

rajkumar patel
Posts: 12
Joined: Fri Mar 03, 2017 8:20 pm

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

Postby rajkumar patel » Wed Mar 22, 2017 7:12 pm

pratik wrote:Please use ICACHE_FLASH_ATTR in all your functions. That is what will place them in flash.
Your functions are getting placed in the iRAM... it is RAM and is in a few KBs only!


Thanks a lot Pratik, your suggestion worked out!

Who is online

Users browsing this forum: No registered users and 276 guests