Hi,
I there any C or C++ ELF binary parser which can parse bin files. either signed or not.
Thanks,
Naeem
ELF binary parser
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: ELF binary parser
Erm, a bin-file is not an elf-file, so an elf parser can, by definition, not parse a bin file. What do you need this for?
Re: ELF binary parser
A standard elf file is also created during the build process and it can be parsed using any elf parser like 'readelf'
Code: Select all
<mydir>$ readelf -h -l MicroPython.elf
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Tensilica Xtensa Processor
Version: 0x1
Entry point address: 0x40081708
Start of program headers: 52 (bytes into file)
Start of section headers: 14056380 (bytes into file)
Flags: 0x300
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 40 (bytes)
Number of section headers: 55
Section header string table index: 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x3f3ffee0 0x3f3ffee0 0x62ba8 0x62ba8 RW 0x1
LOAD 0x062bb0 0x3ffc0000 0x3ffc0000 0x055b4 0x055b4 RW 0x1
LOAD 0x068168 0x3ffc55b8 0x3ffc55b8 0x00000 0x0c1f8 RW 0x1
LOAD 0x068164 0x40080000 0x40080000 0x00400 0x00400 R E 0x1
LOAD 0x068564 0x40080400 0x40080400 0x1f980 0x1f980 RWE 0x1
LOAD 0x087ee4 0x400c0000 0x400c0000 0x00663 0x00663 R E 0x1
LOAD 0x088548 0x400d0018 0x400d0018 0x160432 0x160432 R E 0x1
LOAD 0x1e8980 0x50000000 0x50000000 0x0098a 0x0098c RW 0x1
Section to Segment mapping:
Segment Sections...
00 .flash.rodata
01 .dram0.data
02 .dram0.bss
03 .iram0.vectors
04 .iram0.text
05 .rtc.text
06 .flash.text
07 .rtc.data .rtc_noinit
Re: ELF binary parser
readelf and objdump utilities will be helpful to parse elf and binary files.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: ELF binary parser
OK, Thanks. As I understood readelf and objdump utilities are python scripts.
Re: ELF binary parser
You can use xtensa-esp32-elf-readelf and xtensa-esp32-elf-objdump utilities which are part if ESP32 Toolchain using which you can parse elf file as per your requirement.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: ELF binary parser
If you want to parse the .bin file rather than the .elf file (which is the output of "esptool.py elf2image" and the file which is actually flashed to the ESP32), then you can use esptool.py:
This doesn't work for the .elf file, you need to use one of the other tools mentioned in the thread.
Note that esptool.py ignores any signature appended to the .bin file.
Code: Select all
esptool.py --chip esp32 image_info binfile.bin
Note that esptool.py ignores any signature appended to the .bin file.
Who is online
Users browsing this forum: Bing [Bot] and 111 guests