Using partition label instead of using NULL for .partition_table in esp_vfs_spiffs_conf_t

Zeni241
Posts: 86
Joined: Tue Nov 20, 2018 4:28 am

Using partition label instead of using NULL for .partition_table in esp_vfs_spiffs_conf_t

Postby Zeni241 » Sat Aug 08, 2020 6:20 am

I am trying SPIFFS example with “partition label” instead of using NULL for .partition_table in esp_vfs_spiffs_conf_t
My spiffs partion is as below in my partition table:
storage, data, spiffs, , 0x6000,

This is my code:

Code: Select all

const char *part_label="storage";
void files(void)
{
    ESP_LOGI(TAG, "Initializing SPIFFS");
    
    esp_vfs_spiffs_conf_t conf = {
      .base_path = "/spiffs",
      .partition_label =part_label,
      .max_files = 5,
      .format_if_mount_failed = true
    };
    
ret = esp_spiffs_info(NULL, &total, &used);
    if (ret != ESP_OK) {
        ESP_LOGE(TAG, "Failed to get SPIFFS partition information (%s)", esp_err_to_name(ret));
    } else {
        ESP_LOGI(TAG, "Partition Label= %s Partition size: total: %d, used: %d", part_label, total, used);
    }
Though spiffs works OK but I get following:
E (581) example: Failed to get SPIFFS partition information (ESP_ERR_INVALID_STATE)
I (581) example: Opening file
I (601) example: File written
I (601) example: Renaming file
I (611) example: Reading file
I (611) example: Read from file: 'Hello World!'
I (611) example: SPIFFS unmounted


Wonder what I am doing wrong.


Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 188 guests