add function to clear config in flash
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ae31a02a86
commit
0edf0e80c2
2 changed files with 13 additions and 1 deletions
|
@ -10,4 +10,14 @@
|
||||||
#include <spiflash.h>
|
#include <spiflash.h>
|
||||||
|
|
||||||
#include <espressif/esp_common.h>
|
#include <espressif/esp_common.h>
|
||||||
#include <espressif/user_interface.h>
|
#include <espressif/user_interface.h>
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
|
@ -9,6 +9,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void system_clear_config();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue