Bootloop with custom code, how to decode trace

I am not necessarily looking for answers WHY my code crashes, I am only looking for advice how to decode the trace. I see many logs where it shows some form of decoded trace. I am not getting that!
I have the ‘debug:’ option in the yaml file. Do I need anything else?
Like I said, happy to debug it but with that trace it is hard.

ELF file SHA256: 0000000000000000

Rebooting...
ets Jul 29 2019 12:21:46

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:0x3fff0030,len:1184
load:0x40078000,len:13132
load:0x40080400,len:3036
entry 0x400805e4
[I][logger:268]: Log initialized
[C][ota:473]: There have been 9 suspected unsuccessful boot attempts.
[D][esp32.preferences:114]: Saving 1 preferences to flash...
[D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[W][app:022]: Component <unknown> already registered! (0x3ffce0c4)
[W][app:022]: Component custom_component already registered! (0x3ffce0c4)
[I][app:029]: Running through setup()...
[D][binary_sensor:034]: 'Status': Sending initial state OFF
[D][text_sensor:064]: 'ESPHome Version': Sending state '2023.9.1 Sep 29 2023, 13:54:47'
[C][esp32_ble:027]: Setting up BLE...
[D][esp32_ble:043]: BLE setup complete
[D][esp32_ble_tracker:246]: Starting scan...
[C][wifi:038]: Setting up WiFi...
[C][wifi:051]: Starting WiFi...
[C][wifi:052]:   Local MAC: xx:xx:xx:xx:xx:xx
[I][wifi:277]: WiFi Connecting to 'ssid'...
Guru Meditation Error: Core  1 panic'ed (LoadStoreError). Exception was unhandled.

Core  1 register dump:
PC      : 0x400e7233  PS      : 0x00060130  A0      : 0x801fd880  A1      : 0x3ffcd780  
A2      : 0x3ffce0c4  A3      : 0x3ffcd7e4  A4      : 0x00000000  A5      : 0x00000000  
A6      : 0x3ffb7fe0  A7      : 0x00000000  A8      : 0x40092e1c  A9      : 0x3ffcd760  
A10     : 0x00000362  A11     : 0x3f4042ff  A12     : 0x00000362  A13     : 0x00005580  
A14     : 0x00060120  A15     : 0x00000001  SAR     : 0x0000000a  EXCCAUSE: 0x00000003  
EXCVADDR: 0x40092e8c  LBEG    : 0x400845ad  LEND    : 0x400845b5  LCOUNT  : 0x00000027  


Backtrace:0x400e7230:0x3ffcd7800x401fd87d:0x3ffcd7a0 0x400e541f:0x3ffcd7c0 0x400e4002:0x3ffcd810 0x400e6cd0:0x3ffcd840 0x400f135a:0x3ffcd970 




ELF file SHA256: 0000000000000000

Rebooting...
ets Jul 29 2019 12:21:46

I have the same question (rather than starting another thread!).

Basically I have written some code for a custom sensor that, when running form within VSCode works well, but when connected to the ESPHome code is causing an abort.

I can see the backtrace in the ESPHome log (via the UART on the ESP device) but it simply gives the binary backtrace. If my code crashes in the VSCode environment, the backtrace is decoded with the function names and line numbers etc so that I can work out the problem.

What incantation do I need to make were (presumably in the yaml somewhere) to have this information included in the image that is downloaded to the ESP device; and is somethign else needed to have the backtrace decoded?

Susan

My reading of the available information is there is no easy way to do this.

I find esphome makes some things easy and some things that should be not too hard very difficult because its abstractions hide things.

This might help, but not easy

Thanks for the reply @neel-m.
That pointed me the way, and for others this is what I did:
In the ‘Terminal’ I used the ‘docker’ command to get into the ESPHome area. There I found at "/data/cache/platformio/packages/toolchain-riscv32-esp/bin’ the ‘riscv32-esp-elf-addr2line’ executable. (I actually aded the directory to the PATH temporarily to save typing it out each time.)
I also looked for the “.elf” file for my component, ‘cd’ to that folder and then executed

riscv32-esp-elf-addr2line -e <the .elf filename> <the list of backtrack addresses>

and that printed the required decode.
That then led me to where the code was going wrong.
Thanks again.
Susan

1 Like