1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-02 14:22:55 +03:00

Call umm_init just before starting SDK (#8207)

* Recover the BearSSL crash stack before the Heap is initialized and zeros it.
* Added comments for hwdt_pre_sdk_init()
* Keep Basic ASM version of app_entry_redefinable and removed alternate "C"/Extended ASM version. Update comments.
* Improved example HwdtStackDump to use StackThunk
This commit is contained in:
M Hightower
2021-07-19 07:58:37 -07:00
committed by GitHub
parent 69f8cd6934
commit 8a42163a50
4 changed files with 65 additions and 76 deletions

View File

@ -10,7 +10,7 @@
speed defaults to 115200 bps. The HWDT stack dump will always print on port
'Serial'.
To demonstrates this tool, this Sketch offers a few options for crashing the
To demonstrate this tool, this Sketch offers a few options for crashing the
ESP8266 with and without a HWDT reset.
*/
@ -20,6 +20,7 @@
#include <Esp.h>
#include <user_interface.h>
#include <coredecls.h> // g_pcont - only needed for this debug demo
#include <StackThunk.h>
#ifndef STASSID
#define STASSID "your-ssid"
@ -29,6 +30,22 @@
const char* ssid = STASSID;
const char* password = STAPSK;
////////////////////////////////////////////////////////////////////
// This block is just for putting something on the BearSSL stack
// to show that it has not been zeroed out before HWDT stack dump
// gets to runs.
extern "C" {
#if CORE_MOCK
#define thunk_ets_uart_printf ets_uart_printf
#else
int thunk_ets_uart_printf(const char *format, ...) __attribute__((format(printf, 1, 2)));
// Second stack thunked helper - this macro creates the global function thunk_ets_uart_printf
make_stack_thunk(ets_uart_printf);
#endif
};
////////////////////////////////////////////////////////////////////
void setup(void) {
WiFi.persistent(false); // w/o this a flash write occurs at every boot
WiFi.mode(WIFI_OFF);
@ -39,6 +56,10 @@ void setup(void) {
Serial.println(F("The Hardware Watchdog Timer Demo is starting ..."));
Serial.println();
// This allows us to test dumping a BearSSL stack after HWDT.
stack_thunk_add_ref();
thunk_ets_uart_printf("Using Thunk Stack to print this line.\n\n");
// We don't need this for this example; however, starting WiFi uses a little
// more of the SYS stack.
WiFi.mode(WIFI_STA);