fix task wdt to handle PANIC situations and spiffs formatting
This commit is contained in:
parent
cc34ac0844
commit
8d843e5beb
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "esp_image_format.h"
|
#include "esp_image_format.h"
|
||||||
#include "esp_flash_data_types.h"
|
#include "esp_flash_data_types.h"
|
||||||
|
#include "esp_task_wdt.h"
|
||||||
|
|
||||||
#define FLASH_HDR_ADDR 0x1000
|
#define FLASH_HDR_ADDR 0x1000
|
||||||
|
|
||||||
|
@ -171,3 +172,17 @@ uint32_t flash_rom_get_speed(void)
|
||||||
}
|
}
|
||||||
return 0;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ uint32_t flash_rom_get_speed(void);
|
||||||
#define FLASH_SIZE_16MBYTE (16 * 1024 * 1024)
|
#define FLASH_SIZE_16MBYTE (16 * 1024 * 1024)
|
||||||
|
|
||||||
#define flash_write spi_flash_write
|
#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
|
#define flash_read spi_flash_read
|
||||||
|
|
||||||
#endif // __FLASH_API_H__
|
#endif // __FLASH_API_H__
|
||||||
|
|
|
@ -18,3 +18,6 @@ CONFIG_TCP_MSL=5000
|
||||||
# No filesystem partition found, attempting to create it...
|
# No filesystem partition found, attempting to create it...
|
||||||
# abort() was called at PC 0x400ecddd on core 0
|
# abort() was called at PC 0x400ecddd on core 0
|
||||||
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED=y
|
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
|
||||||
|
|
Loading…
Reference in New Issue