NUCLEO L496ZG - Needing to retain a few variables on reset

Hi there,

ye, the NVS was replaced by the KVS

Simple example below works on Nucleo F446RE.

#include "mbed.h"
#include "KVStore.h"
#include "kvstore_global_api.h"

int main(){
    printf("Simple KVStore test!\n");
    ThisThread::sleep_for(2s);
    int res = MBED_ERROR_NOT_READY;
    char kv_key[] = {"/kv/key"};
    char kv_value[10];
    char str[10];
    kv_info_t info;

    kv_get_info(kv_key, &info);
    printf("kv_get_info key: %s\n", kv_key);
    printf("kv_get_info info - size: %u, flags: %lu\n", info.size, info.flags);

    res = kv_get(kv_key, kv_value, info.size, 0);
    if(res == MBED_SUCCESS) printf("Stored value [%s]!\n", kv_value);
    else printf("No value\n");
    
    printf("Place a new value to terminal!\n");
    scanf("%10s",str); 
    printf("Your value is %s!\n", str);
    kv_set(kv_key, str, strlen(str), 0);
    printf("Now restart your board - Program end!\n");
}

BR, Jan