spi_flash: No CPU release time for an erase operation when OS is not running

During the early start, the virtual eFuse mode can call erase operations when OS is not yet running.

Possible workaround: CONFIG_SPI_FLASH_YIELD_DURING_ERASE=n

Fixed for the legacy flash driver as well.
This commit is contained in:
KonstantinKondrashov
2021-10-29 17:32:28 +08:00
committed by Cao Sen Miao
parent 173f7e87aa
commit b0c1ceca06
3 changed files with 18 additions and 27 deletions

View File

@@ -50,6 +50,7 @@
#include "esp_flash.h"
#include "esp_attr.h"
#include "bootloader_flash.h"
#include "esp_compiler.h"
esp_rom_spiflash_result_t IRAM_ATTR spi_flash_write_encrypted_chip(size_t dest_addr, const void *src, size_t size);
@@ -230,7 +231,9 @@ static inline void IRAM_ATTR spi_flash_guard_op_unlock(void)
static void IRAM_ATTR spi_flash_os_yield(void)
{
#ifdef CONFIG_SPI_FLASH_YIELD_DURING_ERASE
vTaskDelay(CONFIG_SPI_FLASH_ERASE_YIELD_TICKS);
if (likely(xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)) {
vTaskDelay(CONFIG_SPI_FLASH_ERASE_YIELD_TICKS);
}
#endif
}