Skip to content

Commit

Permalink
[ESP32] Initialize the KVS partition when nvs encryption is enabled (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamdp authored Sep 18, 2023
1 parent 42a24d7 commit 8bf4bdd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/platform/ESP32/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ CHIP_ERROR ConfigurationManagerImpl::Init()
err = MapConfigError(esp_err);
SuccessOrExit(err);
}

esp_err = nvs_flash_secure_init_partition(CHIP_DEVICE_CONFIG_CHIP_KVS_NAMESPACE_PARTITION, &cfg);
if (esp_err == ESP_ERR_NVS_NO_FREE_PAGES || esp_err == ESP_ERR_NVS_NEW_VERSION_FOUND)
{
ChipLogError(DeviceLayer, "Failed to initialize NVS partition %s err:0x%02x",
CHIP_DEVICE_CONFIG_CHIP_KVS_NAMESPACE_PARTITION, esp_err);
err = MapConfigError(esp_err);
SuccessOrExit(err);
}
#else
// Initialize the nvs partitions,
// nvs_flash_init_partition() will initialize the partition only if it is not already initialized.
Expand Down

0 comments on commit 8bf4bdd

Please sign in to comment.