How to extract coredump from partition and read it?

vonnieda
Posts: 145
Joined: Tue Nov 07, 2017 3:42 pm

How to extract coredump from partition and read it?

Postby vonnieda » Fri Mar 09, 2018 6:59 pm

Hi all, I've enabled coredumps in menuconfig and added a coredump partition. I can cause a coredump and then use espcoredump.py -p info_corefile to read it and it works fine. But if I extract that same coredump from the partition using esptool to read the flash I get:

espcoredump.py v0.1-dev
Growing up stacks are not supported for now!
Failed to create corefile!

Here's the commands I'm using:

Show Partitions
make partition_table
Partition table binary generated. Contents:
*******************************************************************************
# Espressif ESP32 Partition Table
# Name, Type, SubType, Offset, Size, Flags
ota_0,app,ota_0,0x10000,1900K,
ota_1,app,ota_1,0x1f0000,1900K,
nvs,data,nvs,0x3cb000,16K,
otadata,data,ota,0x3cf000,8K,
phy_init,data,phy,0x3d1000,8K,
coredump,data,coredump,0x3d3000,64K,
*******************************************************************************

Core Dump With Serial (Works Fine)
~/esp/esp-idf/components/espcoredump/espcoredump.py -p /dev/cu.usbserial-A50285BI info_corefile -o 4009984 build/main.elf
espcoredump.py v0.1-dev
esptool.py v2.2.1
Connecting....
Chip is ESP32D0WDQ6 (revision 1)
Uploading stub...
Running stub...
Stub running...
16 (100 %)
16 (100 %)
Read 16 bytes at 0x3d3000 in 0.0 seconds (4.0 kbit/s)...
Hard resetting...

esptool.py v2.2.1
Connecting....
Chip is ESP32D0WDQ6 (revision 1)
Uploading stub...
Running stub...
Stub running...
24048 (100 %)
24048 (100 %)
Read 24048 bytes at 0x3d3000 in 2.3 seconds (85.3 kbit/s)...
Hard resetting...

===============================================================
==================== ESP32 CORE DUMP START ====================

Download Core Dump Partition (Works Fine)
python $IDF_PATH/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/cu.usbserial-A50285BI --baud 115200 read_flash 4009984 65536 coredump.bin

Core Dump With Downloaded Partition (Fails)
~/esp/esp-idf/components/espcoredump/espcoredump.py info_corefile -t raw -c coredump.bin build/main.elf
espcoredump.py v0.1-dev
Growing up stacks are not supported for now!
Failed to create corefile!




Ultimately, I'm not trying to download from flash to read core dumps. I want to be able to upload them to my server after a reboot. The process is basically the same, and I get the same error.

Thanks,
Jason

vonnieda
Posts: 145
Joined: Tue Nov 07, 2017 3:42 pm

Re: How to extract coredump from partition and read it?

Postby vonnieda » Fri Mar 09, 2018 7:57 pm

Replying to myself:

Got this figured out. If I remove the first four bytes (the magic number) it all works fine! Looks like the flash loader removes these automatically and the raw loader doesn't expect them.

himanshu_y
Posts: 1
Joined: Mon Jul 29, 2019 12:39 pm

Re: How to extract coredump from partition and read it?

Postby himanshu_y » Mon Jul 29, 2019 1:19 pm

Hi vonnieda,
I am trying to read the coredump partition and convert the coredump.bin into error log.

partition.csv file
# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x009000, 0x004000
otadata, data, ota, 0x00d000, 0x002000
phy_init, data, phy, 0x00f000, 0x001000
ota_0, app, ota_0, 0x010000, 0x180000
ota_1, app, ota_1, 0x190000, 0x180000
storage, data, spiffs, 0x310000, 0x080000
coredump, data, coredump,0x390000, 80K


i have read the coredump file with this command.
$ python $IDF_PATH/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 115200 read_flash 3735552 81920 coredump.bin

I am getting the same error as your last,How can i resolve this.
$python $IDF_PATH/components/espcoredump/espcoredump.py info_corefile -t raw -c build/hello-world.elf coredump.bin
espcoredump.py v0.1-dev
Growing up stacks are not supported for now!
Failed to create corefile!


Thanks in advance.


Sorry for the bad english.

benpeoples
Posts: 10
Joined: Wed May 31, 2017 4:21 pm

Re: How to extract coredump from partition and read it?

Postby benpeoples » Thu May 21, 2020 2:39 pm

vonnieda, I just wanted to drop in and thank you for your post! This solved a problem I was having (literally implementing the same post coredump to server).

I want to note that the newer IDF version with the file in the ELF format does not need the first four bytes stripped. But the otherwise not really documented -t and -c flags were helpful.

Who is online

Users browsing this forum: No registered users and 193 guests