Linker/ESPTOOL issue--can't generate bin from elf

defidesign
Posts: 3
Joined: Mon Jun 14, 2021 5:37 pm

Linker/ESPTOOL issue--can't generate bin from elf

Postby defidesign » Mon Jun 14, 2021 5:53 pm

Hi,

Background:

Up until about a week ago, I've been building and uploading code to a Saola board via VSCode and Platformio. Last week I suddenly had trouble with build paths pointing to non-existent directories. This morning, I was able to get past that by essentially deleting Platformio and reinstalling it.

Now I am seeing the following issue:

My code now builds again, however, after linking, esptool.py throws the following error while trying to generate a .bin from the .elf file:

"A fatal error occurred: Segment loaded at 0x3f000120 lands in same 64KB flash mapping as segment loaded at 0x3f000020. Can't generate binary. Suggest changing linker script or ELF to merge sections."

Looking at the latest (I think) esptool.py code on GitHub, the explanation of this error shown in comments within the code is:

" # check for multiple ELF sections that are mapped in the same flash mapping region.
# this is usually a sign of a broken linker script, but if you have a legitimate
# use case then let us know (we can merge segments here, but as a rule you probably
# want to merge them in your linker script.)"

Can someone please suggest a way for me to fix this issue?

Thanks!

defidesign
Posts: 3
Joined: Mon Jun 14, 2021 5:37 pm

Re: Linker/ESPTOOL issue--can't generate bin from elf

Postby defidesign » Tue Jun 15, 2021 4:26 am

Since posting the original question, I have found linker scripts in the toolchain-xtensa32s2/lib/ldscripts/ directory. I went through each of these scripts and built against them all. Most of them failed with the following message: ld:257 cannot move location counter backwards (from 000000003ffbaca8 to 000000003ffba54c)

I am nowhere near out of memory with the current project, so that commonly documented cause for this error is not the case.

If anyone has a suggestion, I would definitely appreciate it.

Thanks!

lbernstone
Posts: 635
Joined: Mon Jul 22, 2019 3:20 pm

Re: Linker/ESPTOOL issue--can't generate bin from elf

Postby lbernstone » Tue Jun 15, 2021 2:53 pm

You need a newer version of esptool (3.1-dev). Either run get.py again, or download it from https://github.com/espressif/esptool.

defidesign
Posts: 3
Joined: Mon Jun 14, 2021 5:37 pm

Re: Linker/ESPTOOL issue--can't generate bin from elf

Postby defidesign » Tue Jun 15, 2021 3:56 pm

Thank you!

This, indeed, fixed my problem.

Who is online

Users browsing this forum: Bing [Bot] and 79 guests