diff --git a/firmware/system.c b/firmware/system.c index 3de7ada..f4a9e2e 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -10,4 +10,14 @@ #include #include -#include \ No newline at end of file +#include + +void system_clear_config(){ + vPortEnterCritical(); + uint32_t num_sectors = 5 + DEFAULT_SYSPARAM_SECTORS; + uint32_t start = sdk_flashchip.chip_size - num_sectors * sdk_flashchip.sector_size; + for (uint32_t i = 0; i < num_sectors; i++) { + spiflash_erase_sector(start + i * sdk_flashchip.sector_size); + } + sdk_system_restart(); +} \ No newline at end of file diff --git a/firmware/system.h b/firmware/system.h index 42ec187..1046f49 100644 --- a/firmware/system.h +++ b/firmware/system.h @@ -9,6 +9,8 @@ extern "C" { #endif +void system_clear_config(); + #ifdef __cplusplus } #endif