Undefined reference to `nvs_flash_secure_init_partition` and to `nvs_flash_read_security_c` when executing flash command
Posted: Fri Aug 14, 2020 1:34 pm
As mentioned in the title I'm getting an error when running
the snippet that causing the problem is the following:
I added this snippet to the hello world project inside the hello_world_main.c file and under the app_main function.
My goal is to initialize an encrypted custom nvs partition and read its content. Before doing that I managed to create a custom partition without encryption and I successfully read its content.
The error seems like I'm missing an include, but I checked the two functions in question inside my sdk source code and they're both there in the nvs_flash.h file.
Any information is much appreciated
Code: Select all
idf.py flash monitor
the snippet that causing the problem is the following:
Code: Select all
#include 'nvs.h'
#include 'nvs_flash.h'
// find partition with nvs_keys
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
ESP_PARTITION_SUBTYPE_DATA_NVS_KEYS,
KEYS_PARTITION_LABEL);
// read nvs_keys from key partition
nvs_sec_cfg_t cfg;
esp_err_t error = nvs_flash_read_security_cfg(partition, &cfg);
if (error != ESP_OK)
{
printf("Failed to read nvs keys (rc=0x%x)", error);
}
// initialize the custom nvs partition
error = nvs_flash_secure_init_partition(PARTITION_LABEL, &cfg);
if (error != ESP_OK)
{
printf("failed to initialize nvs partition (err=0x%x). Aborting.", error);
};
My goal is to initialize an encrypted custom nvs partition and read its content. Before doing that I managed to create a custom partition without encryption and I successfully read its content.
The error seems like I'm missing an include, but I checked the two functions in question inside my sdk source code and they're both there in the nvs_flash.h file.
Any information is much appreciated