Page 1 of 1

ESP32 bin tool dump util ...

Posted: Sat Feb 24, 2018 3:12 pm
by kolban
I'm studying the file structure that is generated by esptool when it converts a compile ELF formatted executable into the format required for flashing to the ESP32. To that end, I needed a simple program to "examine" what was there.

Here is a link to my effort. ... derExamine

It is a Linux C source file that can be compiled with

gcc main.cpp

When run and supplied the name of an ESP32 bin file, it dumps the content ... here is an example:

Code: Select all

Dump of ESP32 binary file: app-template.bin
magic: 0xe9, segment_count: 7, entry_addr: 0x40080cc4 - Internal SRAM 0 (128K)

Seg | Start      | End        | Length            | Area
  0 | 0x3f400020 | 0x3f403c14 |  15348 (0x003bf4) | External Memory (Data)
  1 | 0x3ffb0000 | 0x3ffb1714 |   5908 (0x001714) | Internal SRAM 2 (200K)
  2 | 0x40080000 | 0x40080400 |   1024 (0x000400) | Internal SRAM 0 (128K)
  3 | 0x40080400 | 0x40087dec |  31212 (0x0079ec) | Internal SRAM 0 (128K)
  4 | 0x400c0000 | 0x400c0000 |      0 (0x000000) | RTC FAST Memory (8K)
  5 | 0x00000000 | 0x00002ed4 |  11988 (0x002ed4) | Un-described
  6 | 0x400d0018 | 0x400e1128 |  69904 (0x011110) | External Memory (Instruction)
Sharing in case it might be useful to others.

Re: ESP32 bin tool dump util ...

Posted: Sun Feb 25, 2018 7:17 am
by ESP_igrr
By the way, has image_info command which does the same job. If you're missing something in the output of that command, please open an issue in esptool repo.

Re: ESP32 bin tool dump util ...

Posted: Sun Feb 25, 2018 3:53 pm
by kolban
Thank you sir. I did not know that feature was present. Unfortunately when I tried to run it this morning, it failed with the story described in this Github issue:

Re: ESP32 bin tool dump util ...

Posted: Mon Feb 26, 2018 12:21 am
by ESP_Angus
Sorry Neil, I forgot to mention the workaround in that issue - which is to run " --chip esp32 image_info blah.bin".

You can also use xtensa-esp32-elf-objdump to look around at the contents/layout of the ELF file itself. This is very similar information to the .bin layout (as the ELF sections are converted to segments in the .bin file). Although ELF supports some additional features which are not used on the ESP32.

objdump has a lot of options. Running "objdump -h project.elf" to dump section headers is a good place to start.

Docs: ... jdump.html

The linker .map file (in the build directory) is also a goldmine of information, although it's a bit of an information firehose as well...

Re: ESP32 bin tool dump util ...

Posted: Mon Feb 26, 2018 3:50 am
by kolban
Thank you both. For part of the project I am working on, I need to be able to work with ESP32 Image "bin" files ... i.e. the output generated by esptool elf2image. My goal wasn't to decompose the ELF image but the bin file. However, as you both have said, it would have been just as useful to use the "image_info" feature of esptool which continues to shine in its applicability.