Hardware WDT Stack Dump Tool by mhightower83 · Pull Request #7010 · esp8266/Arduino

added 10 commits

January 10, 2020 19:48
This Sketch demonstrates the use of a tool to print a stack dump
at reboot after a Hardware WDT event.

The module hwdt_app_entry.cpp writes a stack dump to the serial interface
after a Hardware Watchdog Timer has struck and a new boot cycle has begun.
The sketch must properly initialized the Serial port before the crash.

hwdt_app_entry.cpp is the core file that does the work.
Improved comments.
Added option to match the UART speed used by the sketch.
Added option to print greeting at the start to indicate the HWDT stack dump code is active.
Isolated logic for handling strings: one assuming they are not inited at
the time the code is running and one that does. The later appears to be the case.
Fix issue with HWDT reason detection when sketch crashes too fast.
Added sample sketch menu option for crashing with a function defined
with a weak attribute via prototype, but never actually defined in
full function form. eg. `void trouble(void){return;}`
Adjusted configuration option order for most likely to be used to the top.
Tried to improve comments.
Replace numbers with enum values.
Regular global strings have worked reliably.
Tweaked reset reason detection.
Reordered elements in global structure.
Improve #if test for debug option
Always improving comments.

@mhightower83 mhightower83 changed the title Hardware WDT Stack Dump Hardware WDT Stack Dump Tool

Jan 15, 2020
data problem that occurs when printing after a flash upload using esptool.
Curiously, esptool stub also uses similar delays.
Word choices and description improvements.

@mhightower83

@mhightower83

no mixed up stack frame was created. Also removed no longer needed
extra level of function calling.
Use existing macros from uart_register,h to handle getting current
UART speed. Added some missing `const`.
Added a few newlines to printing.
Decreased the settling delay after the uart_div_modify call.

@mhightower83

Print caution message when stack integrity checks failed.

@mhightower83

Comment improvements
Added missing ";"

@mhightower83

@mhightower83

Cache_Read_Enable working. Free 1K of IRAM and 200 bytes of DRAM.

@mhightower83

@mhightower83

@mhightower83

@mhightower83

@mhightower83

Improves the SYS stack space available when using the extra 4K Heap
option in conjunction with HWDT. Replaces the ROM AES buffer at
0x3FFFEA80 with one provided by malloc().

@mhightower83

@mhightower83

Check if cont stack is yielding to SYS, use g_pcont->sp_yield to limit the
amount of the cont stack dumped.

Generalized dev logic path to create a generalized debug function hwdt_pre_sdk_init_icache.

@mhightower83

@mhightower83

@mhightower83

@mhightower83

earlephilhower

@d-a-v