App Image Format Documentation

Graggi
Posts: 7
Joined: Thu Jun 29, 2023 7:49 pm

App Image Format Documentation

Postby Graggi » Tue Jul 18, 2023 7:42 pm

Hi,

I'm trying to analyse some ESP32 binaries, and could not find any documentation about the image format besides the explanation of the header fields in the ESP-IDF Programming Guide [1], not even the name of the format (it's a modified version of .elf). Or formats, as reading Esptool's code [2] shows it's actually more than one.

Regards

[1] https://docs.espressif.com/projects/esp ... ormat.html
[2] https://github.com/espressif/esptool/bl ... n_image.py

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: App Image Format Documentation

Postby ESP_Sprite » Wed Jul 19, 2023 12:36 am

That description is terse, but accurate. What information specifically are you missing? (And note that aside from having segments, the format has very little to do with ELF and is not derived from it, it's a custom format.)

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: App Image Format Documentation

Postby ESP_igrr » Wed Jul 19, 2023 5:55 am


Graggi
Posts: 7
Joined: Thu Jun 29, 2023 7:49 pm

Re: App Image Format Documentation

Postby Graggi » Wed Jul 19, 2023 7:04 pm

ESP_Sprite wrote: That description is terse, but accurate. What information specifically are you missing? (And note that aside from having segments, the format has very little to do with ELF and is not derived from it, it's a custom format.)

For example, segment placement. There's a talk about "Extracting an ELF From an ESP32" [1] on Youtube, that claims on the slide shown from 24:25 to 24:51, that multiple flash segments must not be placed within the same 64kB flash mapping region. I couldn't find any information that confirms or denies this behaviour. Now I'm wondering what other information might be missing in the above linked documentation.

[1] https://www.youtube.com/watch?v=w4_3vwN_2dI

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: App Image Format Documentation

Postby ESP_Sprite » Thu Jul 20, 2023 1:37 am

That's more a practical limit of the ESP32 MMU rather than the flash format. The logic there is that the MMU can map flash blocks to memory space, but those blocks are 64K in size with the physical address also aligned to 64K. That means mapping multiple segments to the same 64K block only works if the virtual addresses they're mapped to also are consecutive, and in that case it makes more sense to merge the segments. So in practice, multiple segments in a 64K mapping is an error.

Who is online

Users browsing this forum: No registered users and 10 guests