More one try and... Sucess.
Steps:
1. Get core dump partition size
2. Read X bytes
3. Print Byte-Byte in 0x00 format (whitout '0x')
....
4. After all print occur, I drag this in hex -> b64 converter, save in file and use: espcoredump.py info_corefile -c
COREDUMP PATH -t b64 -rom-elf
PROJECT .ELF PATH
Code bellow is specific of my project, but can help someone... Basically, read 256B of partition and print (0x00 format).
Code: Select all
size_t size = 0;
size_t address = 0;
if (esp_core_dump_image_get(&address, &size) == ESP_OK)
{
const esp_partition_t *pt = NULL;
pt = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump");
if (pt != NULL)
{
uint8_t bf[256];
char str_dst[640];
int16_t toRead;
for (int16_t i = 0; i < (size/256)+1; i++)
{
strcpy(str_dst, "");
toRead = (size - i*256) > 256 ? 256 : (size - i*256);
esp_err_t er = esp_partition_read(pt, i*256, bf, toRead);
if (er != ESP_OK)
{ESP_LOGE("ESP32", "FAIL [%x]", er); break;}
for (int16_t j = 0; j < 256; j++)
{
char str_tmp[2];
if (bf[j] <= 0x0F)
{sprintf(str_tmp, "0%x", bf[j]);}
else
{sprintf(str_tmp, "%x", bf[j]);}
strcat(str_dst, str_tmp);
}
printf("%s", str_dst);
}
}
else
{
ESP_LOGE("ESP32", "Partition NULL");
}
}
else
{
ESP_LOGE("ESP32", "esp_core_dump_image_get() FAIL");
}