Try with the "NVS" functions which stands for "non volatile storage" to write your values into the flash memory.