espressif / esp-idf

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

Finding out the firmware version from a coredump elf (IDFGH-13255) #14189

Open 0xFEEDC0DE64 opened 4 months ago

0xFEEDC0DE64 commented 4 months ago

Answers checklist.

General issue report

We have collected hundrets of millions of coredump elf files from our ESP32 products around the globe and every time we receive another crash report, we have a hard time finding out which firmware this resulted from (we do some heuristics on the database on what the device reported earlier using websockets).

Is there some easy way to find out the exact project_name and version of the firmware from inside the coredump elf?

Or can we somehow embed custom information like customer name, serial number, firmware project_name and version directly into the elf?

erhankur commented 4 months ago

Core dump ELF files contain the SHA-256 sum of the IDF applications. You can get it using the esp_core_dump_get_summary API. Does this work for you?

igrr commented 4 months ago

Or can we somehow embed custom information like customer name, serial number, firmware project_name and version directly into the elf?

You can also define a variable with COREDUMP_DRAM_ATTR, then this variable will be available from the coredump. (You would still need to run GDB to extract it.)

For example, something like this might work:

static COREDUMP_DRAM_ATTR esp_app_desc_t app_desc;

void app_main() {
   app_desc = *esp_app_get_description();
}

This would store an app_desc variable in the core dump, and initialize it to the actual app description on startup.