-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[c6 and likely c5 and c61 specific] esptool elf2image
generates wrongly-positioned esp_app_desc_t
(ESPTOOL-1004)
#1062
Comments
esptool elf2image
generates wrongly-positioned esp_app_desc_t
esptool elf2image
generates wrongly-positioned esp_app_desc_t
(ESPTOOL-1004)
Hi @ivmarkov, thanks for noticing this. I will take a look at it. I just quickly tried to build a project using ESP-IDF v5.3 for ESP32-C6 and found that when I run |
Didf you use the latest With that said, with this commit or not, the breakage is much more severe in that the app image does not start with the correct segment (the one containing |
Yes, thanks, the new commit actually hides the issue a bit, because app description is visible even though it is not at the beginning of the image. Thank you for deep investigation. I had a while to look at and it definitely seems to be esptool issue. |
Interesting! What command does it use then? I was hoping it is still
I prefer not to fix it myself, as my Python working knowledge is likely much much worse than yours. :) |
@ivmarkov sorry for confusion. ESP-IDF actually uses esptool I will take a look if it is a good idea to calculate the |
Thank you for this information!
Hmmm, rather than messing up with whatever was written by the app in And then the user could still override this with |
I have prepared the fix for this, it is under review now. I investigated this deeply and found that we cannot change the default MMU page size for these chips unfortunately because of ESP-IDF. It passes the But I introduced the fix that checks if app info segment is present and if so, use page size from it (available from ESP-IDF v5.4) or from its address alignment, which should be placed immediately after image header and segment header as stated in the app image format section and should be correctly aligned to set MMU page size (ensured by linker script). It is under review. |
Operating System
All
Esptool Version
4.8.1
Python Version
Whatever used in the "binary release" images (pyinstaller)
Full Esptool Command Line that Was Run
No response
Esptool Output
What is the Expected Behaviour?
I would expect the
.bin
file to start with an "IROM" (or "DROM" - seems to be the same for c6+ chips) segment, which - furthermore - has theesp_app_desc_t
structure right in the beginning of this segment, after the image header and the segment addr + len.More Information
Background is this bug reported in
esp-idf-sys
(the Rust tooling around ESP-IDF) (please look from the linked comment onwards): esp-rs/esp-idf-sys#365 (comment)I do understand that there is no distinction between DROM and IROM in newer chips, but still -
esp_app_desc_t
ends up at the wrong place in the binary image.Might very well be (if you look at the ELF dump of an esp32c6-compiled firmware in the linked bug) because the
.flash.appdesc
section in the ELF starts at addr0x421e8020
, while the executable section.flash.text
- is listed earlier and starts at an earlier addr -0x42000020
but I'm speculating about the root cause a bit. To continue the speculation - this - in turn - might also be a problem with the ESP-IDF linker script, in that both.flash.text
and.flash.appdesc
are "lumped" together in arbitrary order inirom_seg
=drom_seg
which seem to be the same now (start at the same address) without any specific order...Wondering how could it be, that this problem is not experienced with pure "C" ESP-IDF? Pure luck only? The Rust tooling is of course using the ESP-IDF linker scripts and in fact the ESP-IDF linker command line; it just appends extra
.a
files to the link line...Other Steps to Reproduce
I can provide Rust-built executables for inspection. For one, building the
esp-idf-matter
examples for the c6 always reproduces the problem, but I can also upload the binaries somewhere, or assist you in any way with diagnosing the issue. For the Rust side of things, this problem is pretty severe...The text was updated successfully, but these errors were encountered: