Skip to content

Commit eb7aa17

Browse files
committed
Update comments and example
1 parent feb8a99 commit eb7aa17

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

bootloaders/eboot/eboot.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,34 @@
2222
disabled. Key WDT hardware registers are zero.
2323
2424
After "ESP.restart()" and other soft restarts, at "main()" in eboot, WDT is enabled.
25+
26+
References for the under-documented ets_wdt_* API
27+
https://mongoose-os.com/blog/esp8266-watchdog-timer/
28+
http://cholla.mmto.org/esp8266/bootrom/boot.txt
29+
30+
After looking at esp8266-watchdog-timer some more, `ets_wdt_enable(4, 12, 12)`
31+
is good for eboot's needs. From a ".map" the NON-OS SDK does not use the
32+
ets_wdt_* APIs, so our choices are not too critical.
33+
The SDK will set up the WDT as it wants it.
34+
35+
A rationale for keeping the ets_wdt_enable() line. If the system is not stable
36+
during a "soft restart." The HWDT would provide a recovery reboot.
2537
*/
2638
extern void ets_wdt_enable(uint32_t mode, uint32_t arg1, uint32_t arg2);
27-
extern void ets_wdt_disable(void);
39+
/*
40+
"ets_wdt_disable"
41+
42+
Diables WDT, then feeds the dog.
43+
For current modes other than 1 or 2, returns the current mode.
44+
For current mode 1, calls ets_timer_disarm, then return the current mode.
45+
For current mode 2, calls ets_isr_mask, then return the current mode.
46+
47+
I always see a value of 0xFFFFFFFF.
48+
49+
The value would normally be used with ets_wdt_restore; however, that is not an
50+
option since a valid prior call to ets_wdt_enable() may not have been done.
51+
*/
52+
extern uint32_t ets_wdt_disable(void);
2853

2954
int print_version(const uint32_t flash_addr)
3055
{

bootloaders/eboot/eboot.elf

0 Bytes
Binary file not shown.

cores/esp8266/hardware_reset.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,15 @@ extern "C" {
8888
[[noreturn]] void hardware_reset(void) {
8989
volatile uint32_t* const rtc_mem = (volatile uint32_t *)0x60001100u;
9090

91-
// Block NMI WDT from disturbing out restart reason
91+
// Block NMI or Software WDT from disturbing out restart reason
9292
xt_rsil(15);
9393

94-
// SDK restart reason location
94+
// An HWDT reason would imply a fault or bug, but this reset was requested.
95+
// Set hint reason to EXT_RST. From empirical evidence, an HWDT looks a lot
96+
// like an EXT_RST. The WDT registers are reset to zero like an EXT_RST;
97+
// however, the PLL initialization is still set. We can still read the Boot
98+
// ROM serial output messages.
99+
// SDK restart reason/hint location
95100
rtc_mem[0] = REASON_EXT_SYS_RST;
96101

97102
// Disable WDT

libraries/ArduinoOTA/examples/OTAEraseConfig/OTAEraseConfig.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const char* password = STAPSK;
2020
void setup() {
2121
Serial.begin(115200);
2222
Serial.println("Booting");
23+
Serial.println(String("Reset Reason: ") + ESP.getResetReason());
2324

2425
WiFi.mode(WIFI_STA);
2526
WiFi.begin(ssid, password);

0 commit comments

Comments
 (0)