From d42c811fb9c37ce0eda811f3e47304b75e2ae691 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 29 Jun 2022 12:31:18 -0700 Subject: [PATCH] Safe mode when ESP interrupt watchdog fires This makes us enter safe mode when sleep on the S3 fails. The task watchdog is used for the user watchdog. --- locale/circuitpython.pot | 17 ++++++----------- ports/espressif/supervisor/port.c | 3 +++ supervisor/shared/safe_mode.c | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f965506d1b..5740e1e288 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -72,7 +72,7 @@ msgstr "" #: ports/mimxrt10xx/common-hal/rtc/RTC.c #: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -432,7 +432,6 @@ msgstr "" msgid "All event channels in use" msgstr "" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -518,7 +517,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "" @@ -1160,6 +1159,10 @@ msgstr "" msgid "Internal error #%d" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + #: py/argcheck.c msgid "Invalid %q" msgstr "" @@ -2244,10 +2247,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -3915,10 +3914,6 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 7ecdd140a2..75362134d8 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -214,6 +214,9 @@ safe_mode_t port_init(void) { case ESP_RST_PANIC: return HARD_CRASH; case ESP_RST_INT_WDT: + // The interrupt watchdog is used internally to make sure that latency sensitive + // interrupt code isn't blocked. User watchdog resets come through ESP_RST_WDT. + return WATCHDOG_RESET; case ESP_RST_WDT: default: break; diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 875a1a0220..aefae1e48b 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -178,7 +178,7 @@ void print_safe_mode_message(safe_mode_t reason) { message = translate("Boot device must be first device (interface #0)."); break; case WATCHDOG_RESET: - message = translate("Watchdog timer expired."); + message = translate("Internal watchdog timer expired."); break; case NO_CIRCUITPY: message = translate("CIRCUITPY drive could not be found or created.");