Mystery abort() M5Stack Core2 - How to debug?

Dear all,
I am trying to port a data logging / IoT application from ESP32 to M5Stack Core2. The application is C++ under the Arduino framework with VSCode and PlatformIO. I’m replacing the low level hardware dependent stuff but keeping the high level stuff mostly the same.
I am running into a consistent abort() and reboot and I would love to know which lines of source code correspond to the PC address and the backtrace. As described in the Boards section, Core2 does not support debugging under PlatformIO, mostly because M5Stack used one of the JTAG bits for the LCD chip select. There exists a cut-and-wire hack but I’d like to try something less invasive first.
This is typical of what I get. I have tons of these printf and println but that’s not getting me very far.
Something else puzzling me is that the abort() is on core 1. Is that where my code is running? Or is my code running on core 0, leaving core 1 to attempt to execute whatever junk is leftover in program memory?

millis=631 In Context::set_state, State* is 3ffbb8d4 and calling entry_action().
millis=638, In InitReadingState::entry_action(), entered state InitReadingState 3ffbb8d4.   
millis=646 In Context::set_state, State* is 3ffbb8d4 and returning from entry_action().     

abort() was called at PC 0x401f81cf on core 1

Backtrace: 0x4008390d:0x3ffd0f60 0x40095ee1:0x3ffd0f80 0x4009b979:0x3ffd0fa0 0x401f81cf:0x3ffd1020 0x401f8216:0x3ffd1040 0x401f8177:0x3ffd1060 0x401f954b:0x3ffd1080 0x400d62ea:0x3ffd10a0 0x400d6310:0x3ffd10c0 0x40214cbe:0x3ffd10e0 0x400d38fd:0x3ffd1100 0x400d64b7:0x3ffd1130 0fd1020 0x401f8216:0x3ffd1040 0x401f8177:0x3ffd1060 0x401f954b:0x3ffdx400d703a:0x3ffd1150 0x400ed671:0x3ffd1170      

Just build the firmware in debug mode and activate backtrace (“exception”) decoding. Documented in


1 Like

Super helpful! Thanks
This is what I added to my platformio.ini:

build_type = debug
monitor_filters =
  default  ; Remove typical terminal control codes from input
  esp32_exception_decoder  ; Decode the backtrace

I’m not sure if I need the default filter but it doesn’t seem to get in the way.