Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hardware WDT Stack Dump Tool (#7010)
* Hardware WDT Stack Dump 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. * Corrected Style. Improved HWDT reset detectionat boot. * Style and typos * Update comments. * Improvements to reset reason determination. 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. * Style plus 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;}` * Moved all configuration options to the top. Adjusted configuration option order for most likely to be used to the top. Tried to improve comments. Replace numbers with enum values. * Removed clutter of having an alternate printing method. Regular global strings have worked reliably. Tweaked reset reason detection. Reordered elements in global structure. Improve #if test for debug option Always improving comments. * Added delays around uart_div_modify. This appeara to resolve the lost data problem that occurs when printing after a flash upload using esptool. Curiously, esptool stub also uses similar delays. Word choices and description improvements. * Finished TODO looked at assembly of app_entry_redefinable to confirm 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`. * Comment changes. Added a few newlines to printing. Decreased the settling delay after the uart_div_modify call. * Improved comments. Print caution message when stack integrity checks failed. * Several corrections to set_uart_speed Comment improvements Added missing ";" * Removed unused include. Code cleanup. Comments. * Now runs from flash before SDK is started. Cache_Read_Enable working. Free 1K of IRAM and 200 bytes of DRAM. * Changed ICACHE size from 32K to 16K to avoid conflict with SDK or core selecting smaller 16K ICACHE. The Issue: Cache_Read_Enable does not clear the bit field when mapping IRAM to ICACHE on register 0x3FF00024. Thus, no problem upgrading from 16K to 32K; however, you cannot downgrade from 32K to 16K. These bits are cleared at boot. Improved uart data rate change handling. Update comments. * Added support to print ThunkStack. Adjustments to inline asm. Added "memory" when callx0 is used. * comment cleanup. added missing additional #if defined() Made structure name unique. Changed HWDT_INFO to HWDR_INFO_S. * Update style used for structure and typedef to match that used in core when snake case is used. Moved a constexpr block up a scope so that some #ifdef debug code compiles again. * Updated comments * Corrected new errors from upgrade to GCC 10.1 toolchain related to constexpr and casting integers to pointers. Cleared warning for asm. * Work around divide by 0 HWDT event under toolchain 10.1. * Changes to move feature into core. Making ready for selection via tools menu, updated defines to DEBUG_ESP_,,, format. Added HWDT and HWDT_NO4KEXTRA options to boards.txt.py. These options are selectable from Arduino IDE 'Tools->Debug Level' Converted macro names that use to be constexprs to uppercase. Update comments. Added comments to maintainers anotated by '//C' Revised example. * Fix stack character buffer length. * Updated comment to reflect support via Arduino IDE Tools menu. * Improve meshing of HWDT and NOEXTRA4K * Made compatible with `disable_extra4k_at_link_time()` usage. Changed to strings containing "no4kextra" to "noextra4k" to be consistant with original usage. Updated example to provide indications of which build options were used or resulted. Some comment cleanup. * CI style * Adjusted down the ROM Stack space for the extra 4K Heap option. If too large, a really bad crashes occurs. Updated the example to start WiFi. This helps double check ROM Stack space size is not too small at start. Removed stale comment. Changed cont stack check functions to make globally available. * Add replacement aes_unwrap for the debug HWDT option. 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(). * Update umm_info_safe_printf_P to support default of unaligned PROGMEM strings. * Improve cont stack trace for yielding case. 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. * Added missed update to heap.cpp for change to use PSTR instead of PSTR4 * Updated comments and #if in aes_unwrap. * Update boards.txt
- Loading branch information