XIAO nrf52840 Persistant Storage (EEPROM emulation)

Is there any form of Persistent Storage or EEPROM emulation for the nrf52840? Need to store around 256 bytes of configuration data, that can survive a power cycle.

I don’t know either, but I’d like to have some NV memory in a XIAO and I found No EEPROM or NVR in XIAO? which suggests that FLASH memory is available, survives power down, but not new code upload. I’ve been using “setup” to hold permanent data but when I need that configuration data to change then I’m hoping I can write to flash. I haven’t yet followed the links in that thread…

I have been successful with using this one with my XIAO BLE SENSE.

Because of another bug I’m looking into with the BLE SENSE I have been saving my Pedometer steps using the above library before putting the SENSE to sleep.

#include <NanoBLEFlashPrefs.h>
struct stepData
    uint32_t steps; // 4 bytes
stepData mySteps = {};
NanoBLEFlashPrefs myFlashPrefs;

In my setup I have this:

    // begin initialization
    Serial.println("Read record...");
    int rc = myFlashPrefs.readPrefs(&mySteps, sizeof(mySteps));
    if (rc == FDS_SUCCESS)
        Serial.println("Preferences found: ");
        Serial.print("No preferences found. Return code: ");
        Serial.print(", ");

and before I put the SENSE to sleep I have this:

            Serial.println("Write Steps...");
            myFlashPrefs.writePrefs(&mySteps, sizeof(mySteps));

Please note I do get this warning when I compile but everything seems to work as expected.

WARNING: library NanoBLEFlashPrefs claims to run on mbed_nano architecture(s) and may be incompatible with your current board which runs on mbed architecture(s).