espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.47k stars 7.25k forks source link

[TW#27558] esptool error during "make" when processing ELF file #2727

Closed pilnikov closed 5 years ago

pilnikov commented 5 years ago

when I try to build a project with version 3.2.1Beta when processing .elf file, I get a struct.error: ubyte format requires 0 <= number <= 255 in esptool.py esptool image

pilnikov commented 5 years ago

Note! if i use idf ver 3.1.1 - All OK with the same project.

projectgus commented 5 years ago

Hi @pilnikov ,

Is this an open source project? If so, are you able to attach the sdkconfig and the KaRadio32.elf file from the build directory? If you can't share them it's OK, can figure out another approach.

igrr commented 5 years ago

backlink https://github.com/karawin/Ka-Radio32/issues/65

pilnikov commented 5 years ago

Yes of course. Its karadio from https://github.com/karawin/Ka-Radio32 1.ZIP

projectgus commented 5 years ago

Thanks for posting those.

Something seems to have gone wrong in the linker script for both v3.1.1 and v3.2-beta1.

The ELF files both have hundreds of loadable sections when they should have about 5 (you can look at the output with xtensa-esp32-elf-objdump -h ELFFILE).

KaRadio32_311.elf has exactly 254 loadable sections so the .bin file is generated - however the generated .bin file won't boot as the bootloader can only handle up to 16 loadable sections.

KaRadio32_321.elf has more than 255 loadable sections so the esptool error appears when this value is packed into a single byte.

I'll fix the error message to be more informative, but the problem is with the ELF file not the elf2binary step.

I can't reproduce the ELF problem with ESP-IDF examples or by building the Ka-Radio32 project locally. Is it possible you've edited some of the linker script files in the IDF repository itself which is causing a bad link?

projectgus commented 5 years ago

Is it possible you've edited some of the linker script files in the IDF repository itself which is causing a bad link?

One other question, can you please post the output of git describe --tags --dirty when run in the IDF directory? Thanks.

pilnikov commented 5 years ago

image

pilnikov commented 5 years ago

I can't reproduce the ELF problem with ESP-IDF examples or by building the Ka-Radio32 project locally. Is it possible you've edited some of the linker script files in the IDF repository itself which is causing a bad link?

Tru make without paremeter e.g. make -j4

pilnikov commented 5 years ago

image

pilnikov commented 5 years ago

after git pull & git submodule update image

pilnikov commented 5 years ago

2.zip Files after make all with updated 3.2 beta1 Size .elf = 6m

projectgus commented 5 years ago

The binary seems to be building correctly now, so it appears some change on master branch has fixed this.

One thing I noticed in your screenshots is you are running MSYS2 via "msys.exe", not "mingw32.exe". This is not supported - if you look in the build output you'll see a warning about it. The root cause may be something to do with that, and using an MSYS rather than a MINGW32 Python. But I'm just guessing.

(BTW, I can't explain why your copy of git describes commit 4c881708d as being based on v3.2-beta1-182-g4c881708d. This commit is actually v3.3-dev-180-g4c881708d, and if I clone from github on Windows and then check it out then it's described correctly. Strange! Maybe a git fetch will correct this.)

pilnikov commented 5 years ago

image

pilnikov commented 5 years ago

3.zip

projectgus commented 5 years ago

Everything looks 100% correct now (both binary and version)! Are you experiencing any more issues with ESP-IDF?