Coredump
-
- Posts: 9727
- Joined: Thu Nov 26, 2015 4:08 am
Re: Coredump
The coredump is written to a partition; you could read out that partition on the ESP32 and e.g. send its contents off to a server.
Re: Coredump
Which functions do I use for this? I read what range of partition address?ESP_Sprite wrote: ↑Tue Mar 19, 2019 12:40 pmThe coredump is written to a partition; you could read out that partition on the ESP32 and e.g. send its contents off to a server.
-
- Posts: 9727
- Joined: Thu Nov 26, 2015 4:08 am
Re: Coredump
ESP-IDF has a bunch of functions to find partitions and read/write them.
Re: Coredump
Hi,
You can also use SPIFFS file system to store crash logs into flash.
Also, There are support into ESP32 IDF using menuconfig to store crash dumps into SPI Flash directly so that you can read it on next reboot based on your requirements.
You can also use SPIFFS file system to store crash logs into flash.
Also, There are support into ESP32 IDF using menuconfig to store crash dumps into SPI Flash directly so that you can read it on next reboot based on your requirements.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Coredump
Tried with esp_partition() functions and getting some issues....
See printf() output: When I print(%s), notting usefull appears, but print(%c) or %x works and show some infos, I only can see task names between all >=127d chars.
https://i.imgur.com/lnzNdj3.png
1. What addresses (start/end) I will use to get correct coredump info? Now, I reading all partition to test.
2. How can I print this to "CTRL+C" and put in terminal+script_debug? Like coredump->uart...
part of output (in image):
See printf() output: When I print(%s), notting usefull appears, but print(%c) or %x works and show some infos, I only can see task names between all >=127d chars.
https://i.imgur.com/lnzNdj3.png
1. What addresses (start/end) I will use to get correct coredump info? Now, I reading all partition to test.
2. How can I print this to "CTRL+C" and put in terminal+script_debug? Like coredump->uart...
Code: Select all
const esp_partition_t *pt = NULL;
pt = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump");
uint8_t bf[pt->size];
if (pt != NULL)
{
esp_err_t er = esp_partition_read(pt, 0, bf, pt->size);
printf("\nCOREDUMP (%x %u %u): %s\n\n", er, pt->address, pt->size, bf);
for (int32_t i = 0; i < pt->size; i++)
{
printf("%c ", bf[i]);
}
printf("\n\n\n");
}
Code: Select all
COREDUMP (0 3452928 65536): �Q
� Q d ` � � ? � � ? X � � ? � � � ? � � � ? 2 J � 5 � ? � 5 � ? ` � � ? � 5 � ? � � � q p � � | ` � � ? L � � ? l p _ B L I N K ( � W F y � � � X � � ? ` � � ? � � � ? 0 � � ? = � @ ? H @ � � � � ? � ? ' " @ ? � � � ? � D � ? � 7 � ? � @ � @ � � � � ' " @ ? � � � ? Y @ �
� ? � � ? � ' " @ ? � � � ? � D � ? � 7 � ? � � � ? � � � ? � � � ? P � � ? � � � ? P � � ? � � � ? � F � t 5 � ? � � � ? � � � ? l 5 � ? � N & t � � � � � ? � � � ? I D L E 1 � H � � � � Z � % � � � ? ! ` � � ? � � � ? 0 � � ? = � @ ? H @
Re: Coredump
Ok, I found in cpu_start.h the function "esp_core_dump_image_get()" and getting size with this. In header of this fuction, explain about core dump header in Flash, but ...
I priting coredump data in hex format to put in some file, but using espcoredump.py to debug no works. Whats wrong?
Command:
Output:
Beggining of file.bin (printted with \x to use in ubuntu):
I priting coredump data in hex format to put in some file, but using espcoredump.py to debug no works. Whats wrong?
Command:
Code: Select all
python espcoredump.py info_corefile -t raw -c file.bin /home/ze/esp/LOGSIS/build/LOGSIS.elf
Code: Select all
A fatal error occurred: Core dump version '256' is not supported! Should be up to '1'.
Code: Select all
\xbc\x51\x0\x0\x1\x0\x0\x0\x19\x0\x0\x0\x64\x1\x0\x0\x60\xf4\xfc\x3f\x10\xf3\xfc\x3f\x58\xf4\xfc\x3f\xb0\xf2\xfc\x3f\xf0\xf3\xfc\x3f\x32\x4a\x0\x0\x9c\x35\xfb\x3f\x9c\x35\xfb\x3f\x60\xf4\xfc\x3f\x94\x35\xfb\x3f\x17\x0\x0\x0\xd4\xbc\xdd\x71\x70\xba\
Re: Coredump
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).
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");
}
Re: Coredump
hi urbanze,
I have gone through this forum,I want to store crash code into esp32 flash.i am using arduino ide..esp idf master.Can you help me to write core dump to flash?How are the steps and how to config in sdkconfig at windows level.Can you share piece of code for writing core dump to flash?
Thanks you.
I have gone through this forum,I want to store crash code into esp32 flash.i am using arduino ide..esp idf master.Can you help me to write core dump to flash?How are the steps and how to config in sdkconfig at windows level.Can you share piece of code for writing core dump to flash?
Thanks you.
Who is online
Users browsing this forum: No registered users and 122 guests