Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32: Fix watchdog timeout handling #1249

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE="8MB"

# CONFIG_ESP_DEBUG_STUBS_ENABLE=n
CONFIG_ESP_TASK_WDT_PANIC=y
CONFIG_ESP_TASK_WDT=y
CONFIG_ESP_TASK_WDT_EN=y
CONFIG_ESP_TASK_WDT_INIT=y
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

# CONFIG_ESP_DEBUG_STUBS_ENABLE=n
CONFIG_ESP_TASK_WDT_PANIC=y
CONFIG_ESP_TASK_WDT=y
CONFIG_ESP_TASK_WDT_EN=y
CONFIG_ESP_TASK_WDT_INIT=y
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10

# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y
Expand Down
2 changes: 1 addition & 1 deletion build/devices/esp32/xsProj-esp32/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void debug_task(void *pvParameter)

void loop_task(void *pvParameter)
{
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
esp_task_wdt_add(NULL);
#endif

Expand Down
2 changes: 1 addition & 1 deletion build/devices/esp32/xsProj-esp32c3/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static void debug_task(void *pvParameter)

void loop_task(void *pvParameter)
{
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
esp_task_wdt_add(NULL);
#endif

Expand Down
2 changes: 1 addition & 1 deletion build/devices/esp32/xsProj-esp32c6/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static void debug_task(void *pvParameter)

void loop_task(void *pvParameter)
{
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
esp_task_wdt_add(NULL);
#endif

Expand Down
2 changes: 1 addition & 1 deletion build/devices/esp32/xsProj-esp32h2/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static void debug_task(void *pvParameter)

void loop_task(void *pvParameter)
{
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
esp_task_wdt_add(NULL);
#endif

Expand Down
2 changes: 1 addition & 1 deletion build/devices/esp32/xsProj-esp32s2/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void setup(void)

void loop_task(void *pvParameter)
{
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
esp_task_wdt_add(NULL);
#endif

Expand Down
2 changes: 1 addition & 1 deletion build/devices/esp32/xsProj-esp32s3/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static void debug_task(void *pvParameter)

void loop_task(void *pvParameter)
{
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
esp_task_wdt_add(NULL);
#endif

Expand Down
2 changes: 1 addition & 1 deletion modules/base/worker/modWorker.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ void workerLoop(void *pvParameter)
{
modWorker worker = (modWorker)pvParameter;

#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
esp_task_wdt_add(NULL);
#endif

Expand Down
9 changes: 8 additions & 1 deletion xs/platforms/esp/xsHost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,15 @@ void modMessageService(xsMachine *the, int maxDelayMS)
{
modMessageRecord msg;

#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
modWatchDogReset();
#ifndef CONFIG_ESP_TASK_WDT_TIMEOUT_S
// The default timeout is 5s, but it can be changed using this CONFIG decl as well as
// dynamically via esp_task_wdt_reconfigure, we assume "worst case" 1s here if it's not
// defined (could actually be set lower dynamically). There is no way to extract the
// current timeout value from esp-idf.
#define CONFIG_ESP_TASK_WDT_TIMEOUT_S (1)
#endif
if (maxDelayMS >= (CONFIG_ESP_TASK_WDT_TIMEOUT_S * 1000)) {
#if CONFIG_ESP_TASK_WDT_TIMEOUT_S <= 1
maxDelayMS = 500;
Expand Down
2 changes: 1 addition & 1 deletion xs/platforms/esp/xsHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ double __ieee754_fmod_patch(double x, double y);
#if !ESP32
#define modWatchDogReset() system_soft_wdt_feed()
#else
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
#define modWatchDogReset() esp_task_wdt_reset()
#else
#define modWatchDogReset()
Expand Down