I'm working on a project that needs to store configuration data on the flash memory so I generated this csv file
then I tried to initialize the desired partition using a this function
- #include <stdio.h>
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "nvs_flash.h"
- void init_nvs(const char *partition_name) {
- esp_err_t ret = nvs_flash_init_partition(partition_name);
- if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
- ESP_ERROR_CHECK(nvs_flash_erase_partition(partition_name));
- ret = nvs_flash_init_partition(partition_name);
- printf("done");
- }
- ESP_ERROR_CHECK(ret);
- printf("error");
- }
- void app_main() {
- init_nvs("wifi");
- }