This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 46bbde02b1e esp32/esp32_spiflash.c: during the SPI Flash erasure operation, task scheduling (yield) is added to prevent the Watchdog Timer from triggering a reset due to timeout 46bbde02b1e is described below commit 46bbde02b1e28ab9f493da4c77a51f3225dc0db9 Author: nuttxs <zhaoqing.zh...@sony.com> AuthorDate: Thu Aug 21 18:01:03 2025 +0800 esp32/esp32_spiflash.c: during the SPI Flash erasure operation, task scheduling (yield) is added to prevent the Watchdog Timer from triggering a reset due to timeout Signed-off-by: nuttxs <zhaoqing.zh...@sony.com> --- arch/xtensa/src/esp32/esp32_spiflash.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/xtensa/src/esp32/esp32_spiflash.c b/arch/xtensa/src/esp32/esp32_spiflash.c index a1d5f062841..f2763202c72 100644 --- a/arch/xtensa/src/esp32/esp32_spiflash.c +++ b/arch/xtensa/src/esp32/esp32_spiflash.c @@ -40,6 +40,7 @@ #include <nuttx/kthread.h> #include <nuttx/mutex.h> #include <nuttx/mtd/mtd.h> +#include <nuttx/signal.h> #include "sched/sched.h" @@ -225,6 +226,8 @@ inline void IRAM_ATTR esp32_spiflash_opstart(void); inline void IRAM_ATTR esp32_spiflash_opdone(void); +static inline void IRAM_ATTR +esp32_spiflash_oposyield(void); static bool IRAM_ATTR spiflash_pagecached(uint32_t phypage); static void IRAM_ATTR spiflash_flushmapped(size_t start, size_t size); @@ -661,6 +664,28 @@ static void IRAM_ATTR spiflash_flushmapped(size_t start, size_t size) } } +/**************************************************************************** + * Name: esp32_spiflash_oposyield + * + * Description: + * Yield to other tasks, called during erase operations. + * + * Input Parameters: + * None + * + * Returned Value: + * None. + * + ****************************************************************************/ + +static inline void IRAM_ATTR esp32_spiflash_oposyield(void) +{ + /* Delay 1 tick */ + + useconds_t us = TICK2USEC(1); + nxsig_usleep(us); +} + /**************************************************************************** * Name: esp32_set_read_opt * @@ -967,6 +992,11 @@ static int IRAM_ATTR esp32_erasesector(struct esp32_spiflash_s *priv, for (offset = 0; offset < size; offset += MTD_ERASESIZE(priv)) { + if (offset > 0) + { + esp32_spiflash_oposyield(); + } + esp32_spiflash_opstart(); if (esp32_enable_write(priv) != OK)