[SOLVED] Save core dump to flash and read it after reboot as file.

leschge
Posts: 37
Joined: Fri May 06, 2022 1:38 pm

[SOLVED] Save core dump to flash and read it after reboot as file.

Postby leschge » Fri Aug 26, 2022 6:31 am

Hello,
I am trying to achieve the following goal:
When a crash happens, it should save a core dump to flash. After a reboot, I want this core dump to be sent to my server (there saved as file) to analyze it further.

For now, I only want to print the core dump from flash after a reboot to UART, so that I can copy it into a file and run the command

Code: Select all

espcoredump.py --chip esp32 info_corefile -t raw -c C:\core_raw.txt C:\project\project.elf
Is it possible to use the binary output (hex format) in combination with the command above? Is the format raw correct?

I created a simple example for this to try out. https://github.com/ddomnik/coredump_example

This is the output after a core dump:

Code: Select all

a413000002000000060000005801000001000000d073fb3fd070fb3fc873fb3f8070fb3f6073fb3fc1c014129c35fb3f9c35fb3fd073fb3f9435fb3f18000000f020fb3ff020fb3fd073fb3f0000000001000000cc63fb3f6d61696e00a7343888627f6fda0a850000000000c873fb3f0100000000000000000000000000000000000000cceffa3f34f0fa3f9cf0fa3f000000000000000001000000000000000000000000000000481d004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003fefbeadde311a0840300b06009c5908809071fb3fdb71fb3f020000000a0000000c35403f020000007071fb3f0000000001000000a372fb3fa372fb3f00000000d86f403f78000000000000ff100000001d000000000000008cc2004096c200400000000000000000d86f403fcd22084014f7fa3f000000000000000000000000ffff3fb30000000000000000000000000000000000000000000000000000000001000000010000000a0000007071fb3f0caa0880b071fb3fdb71fb3ff124fb3f01000000230b06007835403f00f000002c630d80d071fb3f00000000a2000000010000000072fb3f29000000000000ff075d0e80f072fb3f00000000ec83fb3f0000000000000000000000617373657274206661696c65643a206170705f6d61696e206d61696e2e633a353220283029008c05803072fb3f3074fb3f34f0fa3f54090e804072fb3fc8f1fa3f0a00000040090e805072fb3f3074fb3f0a00000090860d807072fb3f0a00000089280000c8f1fa3f7072fb3f3074fb3f0a00000034f0fa3fd86f403f78000000000000ffc1620d80a072fb3f0a0000003074fb3fa072fb3f8072fb3f040000000000000034f0fa3f0c35403f020000007071fb3f16630d80c072fb3f0010000000f00000e434403532000000d82dfb3f6c35403fbc2dfb3f6435403fe82dfb3fa372fb3fec2dfb3f1820403ff024fb3f00000000080000000072fb3fdb71fb3f00000000608308801073fb3f000000000000000000000000000000006013fb3f230f0600000000004073fb3fd05c0e40000000008813000003000000000000000000000000000000000000000100000001000000000000006073fb3f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006c73fb3f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000307bfb3fc079fb3f287bfb3fc079fb3fc07afb3fa6f64dc59882fb3f8835fb3f307bfb3f8035fb3f1900000012de7e168eeba1cf307bfb3f00000000000000002c75fb3f49444c4500996a8aca171926aa6b420000000000287bfb3f0000000000000000000000000000000000000000cceffa3f34f0fa3f9cf0fa3f000000000000000001000000000000000000000000000000481d004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002003f2c2308402e6d08403000060060830880807afb3f0000000000000000000000000000000001000000000000002e6d0880607afb3f0000000000000000230006000100000003000000230c060000000000c07afb3f000000000000000000000000000000003025084001000000c859084074fefa3f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a07afb3f286d0840000000000000000000000000000000000000000000000000c07afb3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cc7afb3f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009082fb3f0081fb3f8882fb3f0081fb3f2082fb3f30cad2288835fb3f387bfb3f9082fb3f8035fb3f190000002f2d3796e52756a09082fb3f00000000000000008c7cfb3f49444c45005fd8c4a125a19735fdda00010000008882fb3f0000000000000000000000000000000000000000cceffa3f34f0fa3f9cf0fa3f000000000000000001000000000000000000000000000000481d004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002003f2c2308403a1a0d4030050600316d0880c081fb3f080000000100000001000000010000009834fb3f9834fb3f2833fb3fec32fb3f00000000100000001186088020fcfa3f0300000023040600000000002c1a0d80a081fb3f0000000000000000000000003025084020fcfa3fc85908400005fb3f000000000000000000000000ffff3fb3000000000000000000000000000000000000000000000000000000001186088020fcfa3f030000002304060060830880e081fb3f000000000000000001000000010000009834fb3f9834fb3f000000000082fb3f286d08400000000001000000000000000100000000000000000000002082fb3f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c82fb3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018f8fa3f50f6fa3f10f8fa3f50f6fa3fb0f7fa3f92c15a477862fb3f0435fb3f18f8fa3ffc34fb3f010000004421fb3f4421fb3f18f8fa3f3c21fb3f1800000014f4fa3f697063300033f2385188e41a7a07ca000000000010f8fa3f1800000000000000000000000000000000000000cceffa3f34f0fa3f9cf0fa3f000000000000000001000000000000000000000000000000481d004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003f2c230840e4480840300c0600c066088010f7fa3f00000000ffffffff6421fb3f103bfe3f9834fb3f58010000e4480880f0f6fa3fdc00f03f010000005813fb3f2300060003000000230f060004000000a5a5a5a5a5a5a5a50000000000000000000000003025084023000600c8590840647bfa3f000000000000000000000000ffff3fb3000000000000000000000000000000000000000000000000000000002c2308405883084030000500000000002749088030f7fa3f1821fb3f6421fb3f00000000f848084000000000000000006083088070f7fa3f000000000000000000000000000000000000000000000000ffffffff000000000000000000000000010000000100000000000000230f06000000000090f7fa3ff8480840000000000000000000000000010000000100000000000000b0f7fa3f000000000000000000000000000000000000000000000000875c0e80b03bfe3ff434fb3f000000000000000000000000bcf7fa3f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007062fb3fb060fb3f6862fb3fb060fb3f0062fb3f80feb9be80fdfa3f20f8fa3f7062fb3ffc34fb3f030000007d7124953cdf0a8b7062fb3f00000000160000006c52fb3f6573705f74696d65720050dddf091d00000000006862fb3f1600000000000000000000000000000000000000cceffa3f34f0fa3f9cf0fa3f000000000000000001000000000000000000000000000000481d004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100003f2c230840f0bf004030000600118608807061fb3f00000000230006002000060023000600f848084000000000bd4808804061fb3fa034fb3fa034fb3f90f7fa3f70f7fa3f000000000000000000000000a5a5a5a5a5a5a5a50000000000000000000000003025084070f7fa3fc8590840b4e5fa3f000000000000000000000000ffff3fb3000000000000000000000000000000000000000000000000000000000062fb3f000000000000000000000000957f08808061fb3f9834fb3f00000000cb370d80a061fb3f0000000001000000000000005d0100002001403f903bfe3f60830880c061fb3f0000000000000000980cfb3f0100000003000000230c060000000000e061fb3fbc370d400000000000000000000000000100000001000000000000000062fb3f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c62fb3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078fdfa3fb0fbfa3f70fdfa3fb0fbfa3f10fdfa3f41906b5c0435fb3f7862fb3f78fdfa3ffc34fb3f010000009821fb3f9821fb3f78fdfa3f9021fb3f1800000074f9fa3f6970633100d69ada8fc8f366f0b200000100000070fdfa3f1800000000000000000000000000000000000000cceffa3f34f0fa3f9cf0fa3f000000000000000001000000000000000000000000000000481d004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003f2c230840e448084030030600c066088070fcfa3f01000000ffffffffb821fb3fd873fb3f010000001c00f43fe448088050fcfa3fe000f03f010000005813fb3f2303060003000000230006000400000000000000302508400000000000000000000000003025084023030600c8590840c480fa3f000000000000000000000000ffff3fb3000000000000000000000000000000000000000000000000000000004a7c088070fcfa3f9834fb3f9834fb3f2749088090fcfa3f6c21fb3fb821fb3f11860880a0fbfa3f030000002300060060830880d0fcfa3f01000000b03308400000000044040000010000001c00f43fffffffffd0fcfa3f01000000b03308400100000001000000000000000100000000000000f0fcfa3ff848084001000000010000000000000001000000010000000000000010fdfa3f0000000000000000000000000000000000000000000000005b150880607dfe3f803e00008bb33a0100000000000000001cfdfa3f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009a22fb3f040000001900727400000000000000003f08994800000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

Without the fff end this are 10112 bytes. However esp_core_dump_image_get() return 5028 bytes?
And what also seems to be strange, the core dumps first 4 bytes are of size a413. However 5028 to hex results in 13A4, so they are rotated?





The other problem problem currently is, that espcoredump.py does not print anything and closes directly.

Even when I try to set the core dump output mode to UART with decoding directly, the python script gives me the following error (with both, binary and elf format):

Code: Select all

Initiating core dump!
I (370) esp_core_dump_uart: Press Enter to print core dump to UART...
I (377) esp_core_dump_uart: Print core dump to uart...
I (383) esp_core_dump_binary: Found tasks: good 6, bad 0, mem segs 0
Core dump started (further output muted)
Received   6 kB...
Core dump finished!
espcoredump.py v1.2

Traceback (most recent call last):
  File "C:\Espressif\frameworks\esp-idf-master\tools/idf_monitor.py", line 374, in <module>
    main()
  File "C:\Espressif\frameworks\esp-idf-master\tools/idf_monitor.py", line 365, in main
    monitor.main_loop()
  File "C:\Espressif\frameworks\esp-idf-master\tools/idf_monitor.py", line 162, in main_loop
    self._main_loop()
  File "C:\Espressif\frameworks\esp-idf-master\tools/idf_monitor.py", line 267, in _main_loop
    super()._main_loop()
  File "C:\Espressif\frameworks\esp-idf-master\tools/idf_monitor.py", line 207, in _main_loop
    self.serial_handler.handle_serial_input(data, self.console_parser, self.coredump,
  File "C:\Espressif\frameworks\esp-idf-master\tools\idf_monitor_base\serial_handler.py", line 102, in handle_serial_input
    with coredump.check(line):
  File "contextlib.py", line 113, in __enter__
  File "C:\Espressif\frameworks\esp-idf-master\tools\idf_monitor_base\coredump.py", line 128, in check
    self._check_coredump_trigger_before_print(line)
  File "C:\Espressif\frameworks\esp-idf-master\tools\idf_monitor_base\coredump.py", line 106, in _check_coredump_trigger_before_print
    self._process_coredump()
  File "C:\Espressif\frameworks\esp-idf-master\tools\idf_monitor_base\coredump.py", line 79, in _process_coredump
    coredump.info_corefile()
  File "C:\Espressif\python_env\idf5.0_py3.8_env\lib\site-packages\esp_coredump\coredump.py", line 358, in info_corefile
    self.print_threads_info(task_info)
  File "C:\Espressif\python_env\idf5.0_py3.8_env\lib\site-packages\esp_coredump\coredump.py", line 208, in print_threads_info
    threads, _ = self.gdb_esp.get_thread_info()
  File "C:\Espressif\python_env\idf5.0_py3.8_env\lib\site-packages\esp_coredump\corefile\gdb.py", line 100, in get_thread_info
    current_thread_id = result['current-thread-id']
TypeError: 'NoneType' object is not subscriptable
idf_monitor failed with exit code 3221225786

Without decoding, I receive the following output:

Code: Select all

I (370) esp_core_dump_uart: Press Enter to print core dump to UART...
I (377) esp_core_dump_uart: Print core dump to uart...
I (383) esp_core_dump_binary: Found tasks: good 6, bad 0, mem segs 0
================= CORE DUMP START =================
PBMAAAIAAAAGAAAAWAEAAAEAAAA=
cHD7P3Bt+z9ocPs/
gGn7PwBw+z+XAn18jDL7P4wy+z9wcPs/hDL7PxgAAADYHPs/2Bz7P3Bw+z8AAAAA
AQAAAGxg+z9tYWluAI8XJW790NW8sk4AAAAAAGhw+z8BAAAAAAAAAAAAAAAAAAAA
AAAAAMzv+j808Po/nPD6PwAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAEgdAEAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAD8=
776t3gUaCEAwCAYAoFMIgDBu+z97bvs/AgAAAAoAAABAb/s/IG/7PwwAAAAAAAAA
AQAAAENv+z9Db/s/AAAAAAwAAAAAAAAA7P///xAAAAAdAAAAAAAAAIzCAECWwgBA
AAAAAAAAAAAMAAAAoSIIQHz0+j8AAAAAAAAAAAAAAAD//z+zAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAEBv+z8gb/s/FAAAAAIAAAAQpAiAUG77P3tu+z/hIfs/
0HD7PwMAAAAAAAAAAwAAAChfDYBwbvs/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AAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAD8=
ACMIQMRgCEAwAwYAK0MIgJD8+j9UHfs/oB37PwEAAAABAAAAAAAAAAEAAADEYAiA
cPz6PwEAAAD/////oB37P3hw+z8BAAAAHAD0PwQAAAClpaWlpaWlpQAAAAAAAAAA
AAAAAAQlCEB4cPs/zFMIQIyB+j8AAAAAAAAAAAAAAAD//z+zAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAD8QghAAQAAAAAAAABkfQiA0Pz6PwEAAACEMwhA
AAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAPD8+j/8QghAAQAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAEP36PwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAC8VCIBgff4/gD4AAG3TBAEAAAAAAAAAABz9+j8AAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
iB/7PwQAAAA=
GQAAAA==
nHzqKw==
================= CORE DUMP END =================
Last edited by leschge on Mon Aug 29, 2022 2:45 pm, edited 1 time in total.

leschge
Posts: 37
Joined: Fri May 06, 2022 1:38 pm

Re: Save core dump to flash and read it after reboot as file.

Postby leschge » Mon Aug 29, 2022 1:58 pm

So I switched to Ubuntu for further testing. Decoding the coredump automatically and manually (via copying it to file) from UART works here without the "object is not subscriptable" error from above.

Also reading from flash directly works now.

However I am still not able to decode a coredump from the flash that I copied to a file. When running:

Code: Select all

python3 espcoredump.py info_corefile -t b64 -c /home/dom/dump /home/dom/esp/coredump_example/build/coredump_example.elf
Also, -t raw and -t elf does not work. Is there some special formatting done before decoding from flash inside the espcoredump.py ?
Or do I have to base 64 encode that binary data?


Code: Select all

python3 espcoredump.py info_corefile -t b64 -c /home/dom/dump /home/dom/esp/coredump_example/build/coredump_example.elf
espcoredump.py v1.2
Traceback (most recent call last):
  File "/home/dom/esp/esp-idf/components/espcoredump/espcoredump.py", line 76, in <module>
    main()
  File "/home/dom/esp/esp-idf/components/espcoredump/espcoredump.py", line 61, in main
    temp_core_files = espcoredump.info_corefile()
  File "/home/dom/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esp_coredump/coredump.py", line 330, in info_corefile
    core_elf_path, target, temp_files = self.get_core_dump_elf(e_machine=self.exe_elf.e_machine)
  File "/home/dom/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esp_coredump/coredump.py", line 104, in get_core_dump_elf
    loader = ESPCoreDumpFileLoader(self.core, self.core_format == 'b64')
  File "/home/dom/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esp_coredump/corefile/loader.py", line 554, in __init__
    self.target = self._load_core_src()
  File "/home/dom/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esp_coredump/corefile/loader.py", line 165, in _load_core_src
    raise ESPCoreDumpLoaderError('Core dump version "0x%x" is not supported!' % self.dump_ver)
esp_coredump.corefile.ESPCoreDumpLoaderError: Core dump version "0x344d" is not supported!
Thanks

leschge
Posts: 37
Joined: Fri May 06, 2022 1:38 pm

Re: Save core dump to flash and read it after reboot as file.

Postby leschge » Mon Aug 29, 2022 2:37 pm

I forgot to convert the hex file to binary.

Using

Code: Select all

xxd -r -p <input_file> <output_file>
and then running

Code: Select all

python3 espcoredump.py info_corefile -t raw -c /home/dom/dump.bin /home/dom/esp/coredump_example/build/coredump_example.elf
on Ubuntu did the trick! Notice -t raw

dizcza
Posts: 56
Joined: Tue Sep 07, 2021 6:59 pm

Re: [SOLVED] Save core dump to flash and read it after reboot as file.

Postby dizcza » Tue Apr 25, 2023 11:24 am

Thank you @leschge for providing the snippet code, it works for me.

I'd like to go further: I want to print the traceback directly from the hardware. Most of the time I'm interested only in the current thread stack:

Code: Select all

==================== CURRENT THREAD STACK =====================
#0  0x40082720 in panic_abort (details=0x3ffbe890 \"assert failed: app_main main.c:231 (0)\") at /home/dizcza/tools/esp-idf/components/esp_system/panic.c:423
#1  0x40092684 in esp_system_abort (details=0x3ffbe890 \"assert failed: app_main main.c:231 (0)\") at /home/dizcza/tools/esp-idf/components/esp_system/esp_system.c:153
#2  0x40099aa0 in __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, expr=<optimized out>) at /home/dizcza/tools/esp-idf/components/newlib/assert.c:78
#3  0x400d6d6d in start_wifi_sta () at /home/dizcza/Projects/Embedded/eclipse-workspace/esp32-sdpsensor/main/main.c:135
#4  app_main () at /home/dizcza/Projects/Embedded/eclipse-workspace/esp32-sdpsensor/main/main.c:184
#5  0x4017e760 in esp_register_freertos_tick_hook_for_cpu (cpuid=1074355968, new_tick_cb=0x3ffafe5c) at /home/dizcza/tools/esp-idf/components/esp_system/freertos_hooks.c:94
#6  esp_register_freertos_tick_hook_for_cpu (new_tick_cb=0x3ffafe5c, cpuid=1074355968) at /home/dizcza/tools/esp-idf/components/esp_system/freertos_hooks.c:87
#7  0x40095bd5 in vPortTaskWrapper (pxCode=0x4017e6ac <esp_get_free_heap_size+12>, pvParameters=0x0) at /home/dizcza/tools/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:154
How can I log this info directly from my ESP32 board without downloading a coredump and using external tools?

leschge
Posts: 37
Joined: Fri May 06, 2022 1:38 pm

Re: [SOLVED] Save core dump to flash and read it after reboot as file.

Postby leschge » Fri Sep 01, 2023 1:36 pm

dizcza wrote:
Tue Apr 25, 2023 11:24 am
Thank you @leschge for providing the snippet code, it works for me.

I'd like to go further: I want to print the traceback directly from the hardware. Most of the time I'm interested only in the current thread stack:

Code: Select all

==================== CURRENT THREAD STACK =====================
#0  0x40082720 in panic_abort (details=0x3ffbe890 \"assert failed: app_main main.c:231 (0)\") at /home/dizcza/tools/esp-idf/components/esp_system/panic.c:423
#1  0x40092684 in esp_system_abort (details=0x3ffbe890 \"assert failed: app_main main.c:231 (0)\") at /home/dizcza/tools/esp-idf/components/esp_system/esp_system.c:153
#2  0x40099aa0 in __assert_func (file=<optimized out>, line=<optimized out>, func=<optimized out>, expr=<optimized out>) at /home/dizcza/tools/esp-idf/components/newlib/assert.c:78
#3  0x400d6d6d in start_wifi_sta () at /home/dizcza/Projects/Embedded/eclipse-workspace/esp32-sdpsensor/main/main.c:135
#4  app_main () at /home/dizcza/Projects/Embedded/eclipse-workspace/esp32-sdpsensor/main/main.c:184
#5  0x4017e760 in esp_register_freertos_tick_hook_for_cpu (cpuid=1074355968, new_tick_cb=0x3ffafe5c) at /home/dizcza/tools/esp-idf/components/esp_system/freertos_hooks.c:94
#6  esp_register_freertos_tick_hook_for_cpu (new_tick_cb=0x3ffafe5c, cpuid=1074355968) at /home/dizcza/tools/esp-idf/components/esp_system/freertos_hooks.c:87
#7  0x40095bd5 in vPortTaskWrapper (pxCode=0x4017e6ac <esp_get_free_heap_size+12>, pvParameters=0x0) at /home/dizcza/tools/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:154
How can I log this info directly from my ESP32 board without downloading a coredump and using external tools?
Sorry for the late response, I don't think that's possible. The decoding is handled by the idf monitor (python), not by the idf itself. At least that's what I found searching for decoding in the git repos. So you always need to read the coredump partition on the next boot and send it to a server for example.
If you want another way to catch errors you may want to take a look at this: https://github.com/espressif/esp-idf/issues/7681
igrr commented on Sep 14, 2022
@AAJAY5 i don't think it's possible. Using fwrite requires multiple system components to be working: C library, VFS, filesystem implementation, RTOS, SPI flash driver. Most of these things will not work in the panic handler, as it is similar to the interrupt handler.
You can store the log buffer in RTC memory instead. This memory will persist after reboot and then you can append it to the file, once the system is running normally.

Who is online

Users browsing this forum: Google [Bot] and 130 guests