Monitor stop working upon esp32c3 panics

ukrsms
Posts: 24
Joined: Tue Aug 20, 2019 11:30 am

Monitor stop working upon esp32c3 panics

Postby ukrsms » Mon Sep 20, 2021 9:36 am

Earlier I used esp32 and I often used idf.py monitor to define the cause of crashes.
However, with esp32c3 it seems impossible as the Monitor crashed itself upon register dump printing.
For example, when my esp32c3 crashes it prints the following to serial port:

Code: Select all

abort() was called at PC 0x42125df9 on core 0
Core  0 register dump:
MEPC    : 0x42024d3e  RA      : 0x40389740  SP      : 0x3fca5200  GP      : 0x3fc92400  
TP      : 0x3fc3f8d8  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130  
S0/FP   : 0x00000004  S1      : 0x3fca5264  A0      : 0x3fca522c  A1      : 0x3fca5262  
A2      : 0x00000000  A3      : 0x3fca5259  A4      : 0x00000001  A5      : 0x3fc9d000  
A6      : 0x7a797877  A7      : 0x76757473  S2      : 0x00002000  S3      : 0x3fcd46e0  
S4      : 0x3fca4134  S5      : 0x3fcc06e0  S6      : 0x000640fa  S7      : 0x00000078  
S8      : 0x00014000  S9      : 0x00000258  S10     : 0x6ccc958d  S11     : 0x6ccc958d  
T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938  
MSTATUS : 0x00001881  MTVEC   : 0x40380001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000  
MHARTID : 0x00000000  

Stack memory:
3fca5200: 0x00000000 0x00000000 0x3fca5260 0x4039052e 0x00000000 0x00000000 0x3fca078c 0x3fc975c8
3fca5220: 0x3fca5264 0x3fc975e4 0x3fca5260 0x726f6261 0x20292874 0x20736177 0x6c6c6163 0x61206465
3fca5240: 0x43502074 0x34783020 0x35323132 0x20396664 0x63206e6f 0x2065726f 0x00000030 0x40380000
And if watching via the Monitor it would looks this way (followed by riscv32-esp-elf-gdb.exe system error causing the monitor to stop):

Code: Select all

abort() was called at PC 0x42125df9 on core 0
0x42125df9: __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47

Stack dump detected
Core  0 register dump:
MEPC    : 0x42024d3e  RA      : 0x40389740  SP      : 0x3fca52c0  GP      : 0x3fc92400
0x42024d3e: panic_abort at C:/esp-idf/components/esp_system/panic.c:390

0x40389740: __ubsan_include at C:/esp-idf/components/esp_system/ubsan.c:294

TP      : 0x3fc3f998  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130
S0/FP   : 0x00000004  S1      : 0x3fca5324  A0      : 0x3fca52ec  A1      : 0x3fca5322
A2      : 0x00000000  A3      : 0x3fca5319  A4      : 0x00000001  A5      : 0x3fc9d000
A6      : 0x7a797877  A7      : 0x76757473  S2      : 0x00002000  S3      : 0x3fcd46e0
S4      : 0x3fca41f8  S5      : 0x3fcc06e0  S6      : 0x0005c4f1  S7      : 0x00000033
S8      : 0x00014000  S9      : 0x00000258  S10     : 0x1087c176  S11     : 0x1087c176
T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938
MSTATUS : 0x00001881  MTVEC   : 0x40380001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000
0x40380001: _vector_table at ??:?

MHARTID : 0x00000000
Does anybody faced the same problem or know any solution for the problem?
Last edited by ukrsms on Mon Sep 20, 2021 10:55 am, edited 1 time in total.

ukrsms
Posts: 24
Joined: Tue Aug 20, 2019 11:30 am

Re: Monitor panics upon esp32c3

Postby ukrsms » Mon Sep 20, 2021 10:54 am

After some investigations, I managed to workaround the problem.
First, I found that the monitor stops working within the function self.process_panic_output(self._panic_buffer) (idf_monitor.py), so I just commented it as I do not need gdb_panic_server to start.

Code: Select all

#self.process_panic_output(self._panic_buffer)
Second, I found that after detecting the panic information, the monitor stops printing addr2line information, so I additionally added a comment to lines:

Code: Select all

        if self._reading_panic == PANIC_READING and PANIC_STACK_DUMP in line:
            #self._output_enabled = False
Sure, this is not the solution, but it allows me now use the Monitor for esp32c3 as welll

Who is online

Users browsing this forum: Bing [Bot] and 127 guests