Page 1 of 1

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

Posted: Thu Nov 07, 2019 2:24 am
by greengnu
I'm trying to use a static library that I compiled for the ESP32. Some parts of the library work, but if I add a call into another module of this library the esp32 doesn't even boot up and keeps rebooting with

Code: Select all

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6364
entry 0x400806b8
abort() was called at PC 0x401a610f on core 0

Backtrace: 0x40092334:0x3ffe34f0 0x40092565:0x3ffe3510 0x401a610f:0x3ffe3530 0x401a6156:0x3ffe3550 0x401a6e0b:0x3ffe3570 0x400e83e6:0x3ffe3590 0x400e8cb1:0x3ffe35c0 0x401d07f9:0x3ffe3690 0x401d76e7:0x3ffe36d0 0x401d8f5f:0x3ffe3bb0 0x4013a993:0x3ffe3bd0 0x40083ef9:0x3ffe3bf0 0x40084108:0x3ffe3c20 0x4007906f:0x3ffe3c40 0x400790d5:0x3ffe3c70 0x400790e0:0x3ffe3ca0 0x400792a9:0x3ffe3cc0 0x400806ea:0x3ffe3df0 0x40007c31:0x3ffe3eb0 0x4000073d:0x3ffe3f20

Rebooting...

Code: Select all

Decoding stack results
0x40092334: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 155
0x40092565: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 170
0x401a610f: __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc line 47
0x401a6156: std::terminate() at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc line 57
0x401a6e0b: __cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*)) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_throw.cc line 87
0x4013a993: do_global_ctors at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c line 456
0x40083ef9: start_cpu0_default at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c line 367
0x40084108: call_start_cpu0 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c line 238
What steps can I take to figure out what exactly is causing the esp32 not being able to startup?

Re: rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

Posted: Thu Nov 07, 2019 2:53 am
by ESP_Angus
By default, ESP-IDF does not enable C++ exceptions in the compiler. So if C++ code throws an exception, libstdc++ will immediately call abort(). That's what the stack trace is showing.

In ESP-IDF you can enable C++ exceptions in the project config and recompile the ESP-IDF project (you may need to also recompile your static library with -fexceptions, although it looks like this might already have happened):
https://docs.espressif.com/projects/esp ... exceptions

However, from the stack trace it looks like you might be using Arduino? Arduino IDE doesn't support enabling C++ exceptions.

Re: rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

Posted: Mon Jan 30, 2023 3:55 am
by nicosandller
Hey ! Another Arduino user here. Is there a link we can use to understand how to use ESP-IDF to enable C++ exceptions to keep using Arduino after?

Thanks!
ESP_Angus wrote:
Thu Nov 07, 2019 2:53 am
By default, ESP-IDF does not enable C++ exceptions in the compiler. So if C++ code throws an exception, libstdc++ will immediately call abort(). That's what the stack trace is showing.

In ESP-IDF you can enable C++ exceptions in the project config and recompile the ESP-IDF project (you may need to also recompile your static library with -fexceptions, although it looks like this might already have happened):
https://docs.espressif.com/projects/esp ... exceptions

However, from the stack trace it looks like you might be using Arduino? Arduino IDE doesn't support enabling C++ exceptions.