EasyManua.ls Logo

Espressif ESP32-S2 - Page 725

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
ESP_OK on success
ESP_ERR_NOT_FOUND if there is no partition with the specied parameters in the partition table
ESP_ERR_INVALID_ARG in case partition is NULL
one of the error codes from the underlying flash storage driver
Parameters
[in] partition: pointer to a partition obtained by the ESP partition API.
esp_err_t nvs_flash_secure_init(nvs_sec_cfg_t *cfg)
Initialize the default NVS partition.
This API initialises the default NVS partition. The default NVS partition is the one that is labeled nvsin
the partition table.
Return
ESP_OK if storage has been initialized successfully.
ESP_ERR_NVS_NO_FREE_PAGES if the NVS storage contains no empty pages (which may hap-
pen if NVS partition was truncated)
ESP_ERR_NOT_FOUND if no partition with label nvsis found in the partition table
ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures
one of the error codes from the underlying flash storage driver
Parameters
[in] cfg: Security configuration (keys) to be used for NVS encryption/decryption. If cfg is
NULL, no encryption is used.
esp_err_t nvs_flash_secure_init_partition(const char *partition_label, nvs_sec_cfg_t *cfg)
Initialize NVS flash storage for the specified partition.
Return
ESP_OK if storage has been initialized successfully.
ESP_ERR_NVS_NO_FREE_PAGES if the NVS storage contains no empty pages (which may hap-
pen if NVS partition was truncated)
ESP_ERR_NOT_FOUND if specied partition is not found in the partition table
ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures
one of the error codes from the underlying flash storage driver
Parameters
[in] partition_label: Label of the partition. Note that internally, a reference to passed
value is kept and it should be accessible for future operations
[in] cfg: Security configuration (keys) to be used for NVS encryption/decryption. If cfg is null,
no encryption/decryption is used.
esp_err_t nvs_flash_generate_keys(const esp_partition_t *partition, nvs_sec_cfg_t *cfg)
Generate and store NVS keys in the provided esp partition.
Return -ESP_OK, if cfg was read successfully; -ESP_INVALID_ARG, if partition or cfg; -or error codes
from esp_partition_write/erase APIs.
Parameters
[in] partition: Pointer to partition structure obtained using esp_partition_find_first or
esp_partition_get. Must be non-NULL.
[out] cfg: Pointer to nvs security configuration structure. Pointer must be non-NULL. Gener-
ated keys will be populated in this structure.
esp_err_t nvs_flash_read_security_cfg(const esp_partition_t *partition, nvs_sec_cfg_t *cfg)
Read NVS security configuration from a partition.
Note Provided partition is assumed to be marked encrypted.
Return -ESP_OK, if cfg was read successfully; -ESP_INVALID_ARG, if partition or cfg; -
ESP_ERR_NVS_KEYS_NOT_INITIALIZED, if the partition is not yet written with keys. -
ESP_ERR_NVS_CORRUPT_KEY_PART, if the partition containing keys is found to be corrupt -or
error codes from esp_partition_read API.
Parameters
[in] partition: Pointer to partition structure obtained using esp_partition_find_first or
esp_partition_get. Must be non-NULL.
[out] cfg: Pointer to nvs security configuration structure. Pointer must be non-NULL.
Espressif Systems 714
Submit Document Feedback
Release v4.4

Table of Contents