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

Add ESP32 task watchdog reset to flash routines #2562

Merged
merged 1 commit into from
Oct 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Sming/Arch/Esp32/Components/spi_flash/flashmem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
#include <soc/mmu.h>
#include <esp_flash_partitions.h>
#include <esp_flash.h>
#include <esp_task_wdt.h>
#include <rom/cache.h>
#include <esp_systemapi.h>

uint32_t flashmem_write(const void* from, uint32_t toaddr, uint32_t size)
{
esp_task_wdt_reset();

esp_err_t r = spi_flash_write(toaddr, from, size);
if(r != ESP_OK) {
SYSTEM_ERROR("ERROR in flash_write: r=%d at %08X\n", r, toaddr);
Expand All @@ -28,6 +31,8 @@ uint32_t flashmem_write(const void* from, uint32_t toaddr, uint32_t size)

uint32_t flashmem_read(void* to, uint32_t fromaddr, uint32_t size)
{
esp_task_wdt_reset();

esp_err_t r = spi_flash_read(fromaddr, to, size);
if(r != ESP_OK) {
SYSTEM_ERROR("ERROR in flash_read: r=%d at %08X\n", r, fromaddr);
Expand All @@ -39,6 +44,8 @@ uint32_t flashmem_read(void* to, uint32_t fromaddr, uint32_t size)

bool flashmem_erase_sector(uint32_t sector_id)
{
esp_task_wdt_reset();

debug_d("flashmem_erase_sector(0x%08x)", sector_id);

return spi_flash_erase_sector(sector_id) == SPI_FLASH_RESULT_OK;
Expand Down