Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By 6sn7
#28785 I would like guidance on how to read crash data and debug exceptions.
Is there a method of correlating memory addresses reported in the crash with lines of code in the sketch? Is there a way of obtaining a memory load/link symbol map?

Example of a recent crash:

Exception (0):
epc1=0x90001adf epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys
sp: 3ffffde0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3fffff80: 3fffdcb0 3ffeb828 3ffebd50 60000600
3fffff90: 40210cea 3fffdab0 3fffdab0 00000000
3fffffa0: 40000f49 40000f49 3fffdab0 40000f49
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1264, room 16

Pointers to documentation will be appreciated.

Thanks.
User avatar
By igrr
#29016 (I suppose this topic belongs more to the Arduino forum since such output is specific to ESP8266 Arduino core)


Let me explain the components of this crash output.

Code: Select allException (0): epc1=0x90001adf epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

This is the information about the exception which has happened. You can find exception codes in Xtensa Reference Manual. In this case the exception cause (0) is 'Illegal instruction'. epc1 is the value of PC at which the exception happened.

If this exception info line is absent, it means that the program was interrupted by software watchdog timer.

Code: Select allctx: sys
sp: 3ffffde0 end: 3fffffb0 offset: 01a0

ESP8266 Arduino core uses two stacks: one for the SDK, and one for the sketch. ctx: sys means that exception happened while running on the SDK (system) stack, and ctx: cont is for the sketch stack.
sp is the stack pointer at the exception handler (not at the point of fault).
end: is the topmost address in the stack which will be presented in the following output. It is not exactly the top of the stack because there is usually nothing interesting there, so we display stack dump only up to end:.
offset: is the amount of stack used by exception handler (or interrupt handler in case of soft WDT) and the functions which it calls. This is subtracted from the value of sp: to get the value of SP where the fault has likely happened. Note that offset might be incorrect in some cases — if you find one, let me know.

Code: Select all>>>stack>>>
3fffff80: 3fffdcb0 3ffeb828 3ffebd50 60000600
3fffff90: 40210cea 3fffdab0 3fffdab0 00000000
3fffffa0: 40000f49 40000f49 3fffdab0 40000f49
<<<stack<<<

This is the dump of stack between sp - offset and end.