fix task wdt to handle PANIC situations and spiffs formatting

This commit is contained in:
devsaurus 2018-04-02 21:17:18 +02:00
parent cc34ac0844
commit 8d843e5beb
3 changed files with 19 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#include "esp_image_format.h"
#include "esp_flash_data_types.h"
#include "esp_task_wdt.h"
#define FLASH_HDR_ADDR 0x1000
@ -171,3 +172,17 @@ uint32_t flash_rom_get_speed(void)
}
return 0;
}
esp_err_t flash_erase(size_t sector)
{
#ifdef CONFIG_TASK_WDT
// re-init the task WDT, simulates feeding for the IDLE task
# ifdef CONFIG_TASK_WDT_PANIC
esp_task_wdt_init(CONFIG_TASK_WDT_TIMEOUT_S, true);
# else
esp_task_wdt_init(CONFIG_TASK_WDT_TIMEOUT_S, false);
# endif
#endif
return spi_flash_erase_sector(sector);
}

View File

@ -19,7 +19,7 @@ uint32_t flash_rom_get_speed(void);
#define FLASH_SIZE_16MBYTE (16 * 1024 * 1024)
#define flash_write spi_flash_write
#define flash_erase spi_flash_erase_sector
esp_err_t flash_erase(size_t sector);
#define flash_read spi_flash_read
#endif // __FLASH_API_H__

View File

@ -18,3 +18,6 @@ CONFIG_TCP_MSL=5000
# No filesystem partition found, attempting to create it...
# abort() was called at PC 0x400ecddd on core 0
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED=y
# Enable panic handler for task wdt to reset the firmware upon wdt timeout
CONFIG_TASK_WDT_PANIC=y