Question regarding Core Dumping, and the ELF file used for core dump

SuperTechSaiyan3
Posts: 14
Joined: Tue Jan 01, 2019 6:59 pm

Question regarding Core Dumping, and the ELF file used for core dump

Postby SuperTechSaiyan3 » Wed Jan 09, 2019 3:32 am

Hey all,

I am having issues with my code and wanted to do some debugging, when I tell the esp32 to generate the core dump it first gives me this error at the beginning:

Code: Select all

 E (202) esp_core_dump: Failed to mmap core dump data (260)!
after my cpu panics/crashes it generates my core dump, when I try to process the core dump using:

Code: Select all

python $IDF_PATH/components/espcoredump/espcoredump.py info_corefile -t b64 -c coredump.dat ~/esp/wifi_manager/build/app-template.elf 
I get an error that app-template does not exist? how do I generate this? it is not in my build file.

I tried to get a generic app-template.elf from an online source and this is the core dump that I get

Code: Select all

==================== CURRENT THREAD STACK =====================
#-1 0x4000c3ee in ?? ()
Backtrace stopped: Cannot access memory at address 0x4000c3ee

======================== THREADS INFO =========================
  Id   Target Id         Frame 
  15   process 14        0x4008e901 in ?? ()
  14   process 13        0x4008e901 in ?? ()
  13   process 12        0x4008e901 in ?? ()
  12   process 11        0x40090d39 in ?? ()
  11   process 10        0x4008e901 in ?? ()
  10   process 9         0x4008e901 in ?? ()
  9    process 8         0x4008e901 in ?? ()
  8    process 7         0x4009083c in ?? ()
  7    process 6         0x4008e901 in ?? ()
  6    process 5         0x4008f95a in ?? ()
  5    process 4         0x4008f95a in ?? ()
  4    process 3         0x4013feda in ?? ()
  3    process 2         0x4013feda in ?? ()
  2    process 1         0x4008bd94 in ?? ()
* 1    <main task>       0x4000c3ee in ?? ()

======================= ALL MEMORY REGIONS ========================
Name   Address   Size   Attrs
.rtc.text 0x400c0000 0x0 RW  
.iram0.vectors 0x40080000 0x400 R XA
.iram0.text 0x40080400 0x83f0 R XA
.dram0.data 0x3ffb0000 0x12ec RW A
.flash.rodata 0x3f400010 0x2efc RW A
.flash.text 0x400d0018 0xdf48 R XA
.coredump.tasks.data 0x3ffc4a0c 0x164 RW 
.coredump.tasks.data 0x3ffc4440 0x5c4 RW 
.coredump.tasks.data 0x3ffc3260 0x164 RW 
.coredump.tasks.data 0x3ffc2f30 0x328 RW 
.coredump.tasks.data 0x3ffbbb4c 0x164 RW 
.coredump.tasks.data 0x3ffbb9a0 0x1a4 RW 
.coredump.tasks.data 0x3ffbc0b8 0x164 RW 
.coredump.tasks.data 0x3ffbbf10 0x1a0 RW 
.coredump.tasks.data 0x3ffcc290 0x164 RW 
.coredump.tasks.data 0x3ffcc000 0x288 RW 
.coredump.tasks.data 0x3ffcd3fc 0x164 RW 
.coredump.tasks.data 0x3ffcd250 0x1a4 RW 
.coredump.tasks.data 0x3ffc05cc 0x164 RW 
.coredump.tasks.data 0x3ffc03c0 0x204 RW 
.coredump.tasks.data 0x3ffbcb18 0x164 RW 
.coredump.tasks.data 0x3ffbc970 0x1a0 RW 
.coredump.tasks.data 0x3ffb9fb8 0x164 RW 
.coredump.tasks.data 0x3ffbd750 0x22c RW 
.coredump.tasks.data 0x3ffc2058 0x164 RW 
.coredump.tasks.data 0x3ffc1e80 0x1d0 RW 
.coredump.tasks.data 0x3ffb9c44 0x164 RW 
.coredump.tasks.data 0x3ffb9a90 0x1ac RW 
.coredump.tasks.data 0x3ffbe988 0x164 RW 
.coredump.tasks.data 0x3ffbe6b0 0x2d0 RW 
.coredump.tasks.data 0x3ffafca8 0x164 RW 
.coredump.tasks.data 0x3ffafb00 0x1a0 RW 
.coredump.tasks.data 0x3ffcf568 0x164 RW 
.coredump.tasks.data 0x3ffcf270 0x2f0 RW 
.coredump.tasks.data 0x3ffb9684 0x164 RW 
.coredump.tasks.data 0x3ffb94d0 0x1ac RW 

===================== ESP32 CORE DUMP END =====================
===============================================================
why can the core dump not access the memory? I feel like this is due to the elf file but am not sure..


Thanks in advance!

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby ESP_igrr » Wed Jan 09, 2019 3:48 am

The ELF file should be your application ELF file, it has the same name as your project (PROJECT_NAME set in Makefiile).

Regarding the first error, could you please post the partition table you are using?

SuperTechSaiyan3
Posts: 14
Joined: Tue Jan 01, 2019 6:59 pm

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby SuperTechSaiyan3 » Wed Jan 09, 2019 4:01 am

thanks for the fast response!

the partition table I am using is Single factory app, no OTA, 0x8000 offset. I am not using a custom partition table should I be?

about the elf, where do I find this from what I read about it should be in my esp/PROJECT/build folder, but it is not there. I am using linux and I tried to do a grep and did not find it at all.

sorry if these are basic questions I have only been developing with the esp32 for the past month..

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby ESP_igrr » Wed Jan 09, 2019 12:26 pm

The elf file will be there once you have built your project. If you run "make" (or "make -j4" to speed things up) in your project directory, then one of the last few lines of the output will look like:

LD build/blink.elf

This means that the elf file was generated.

The name of the .elf file may be different — it will be the name which is set in your project Makefile. If you check the Makefile, there will be a line similar to

PROJECT_NAME := blink

SuperTechSaiyan3
Posts: 14
Joined: Tue Jan 01, 2019 6:59 pm

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby SuperTechSaiyan3 » Wed Jan 09, 2019 12:57 pm

okay I fixed the elf issue I can now find it..

regarding the core dump still not working when it does dump it gives me same "cannot access memory at 0x4...."

any thing on the partition?
I switched core dump from flash to UART and get the follow error

Code: Select all

I (190) esp_core_dump: Init core dump to UART
E (194) esp_core_dump: No core dump partition found!
I (200) cpu_start: Starting scheduler on PRO CPU.
it sometimes works but most of the time it will not dump and it will display the following:

Code: Select all



Re-entered core dump! Exception happened during core dump!
CPU halted.
what am I doing wrong? would it be my code

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby ESP_igrr » Wed Jan 09, 2019 1:07 pm

If the error is "Exception happened during core dump!" then the issue might be in the core dump code itself. Would you be able to reduce your code to some minimal example which exhibits the issue, and share that here?

SuperTechSaiyan3
Posts: 14
Joined: Tue Jan 01, 2019 6:59 pm

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby SuperTechSaiyan3 » Wed Jan 09, 2019 3:26 pm

so my code is very large and I have about 4 different c files so it would be hard.

my application is a wifi manager + updates sensor data + sends wifi data to my online website.


the code was working fine, so was core dump was working fine, it started giving me trouble when I tried to send wifi data using my sensor data, when I send hard coded data it worked fine, as soon as I used variables it gave me issues..

I am not sure how minimal I can make my code, but your saying the issue is not with core dump, but with my code correct?

SuperTechSaiyan3
Posts: 14
Joined: Tue Jan 01, 2019 6:59 pm

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby SuperTechSaiyan3 » Thu Jan 10, 2019 2:09 am

so I was able to fix the core dump issue, can you tell what it means when I get the backtrace stopped error?

Code: Select all

==================== CURRENT THREAD STACK =====================
#-1 0x4000c3f5 in ?? ()
Backtrace stopped: Cannot access memory at address 0x4000c3f5

======================== THREADS INFO =========================
I feel this is something to do with heap memory

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby ESP_igrr » Thu Jan 10, 2019 3:26 am

See "ROM Functions in backtraces" https://docs.espressif.com/projects/esp ... backtraces

You need to download the ROM elf file and pass it to the core dump tool using --rom-elf argument.

SuperTechSaiyan3
Posts: 14
Joined: Tue Jan 01, 2019 6:59 pm

Re: Question regarding Core Dumping, and the ELF file used for core dump

Postby SuperTechSaiyan3 » Thu Jan 10, 2019 3:58 am

ahh! works perfectly now! thank you for your help Igrr. I actually read that page but skipped over it for some reason...

for everybody who comes across this issue, this is what my python command looked like to get it working:

Code: Select all

python $IDF_PATH/components/espcoredump/espcoredump.py info_corefile -t b64 -c core.dat build/PROJECT.elf -r esp32_rom.elf 
you must send both .elf files in order to get it to work, at least for me. both your project file.elf and the esp32_rom.elf

Who is online

Users browsing this forum: No registered users and 112 guests