I did not write that the KVStore do it, I wrote it is possible to achive it via the KVStore.
The KVStore let you store a value in the on-chip flashmemory and thank to this you will able to read the value in the next start up, after power down.
So it can works as…
Board start -> init KVS -> read KEY -> print the value -> increment the value -> re-write KEY -> rest of program
Simplest examples than official is
- NUCLEO L496ZG - Needing to retain a few variables on reset - Mbed OS - Arm Mbed OS support forum
- Proper way to keep values after reset - Mbed OS / Best practice - Arm Mbed OS support forum
BR, Jan