FlashStorage causes error in Uno wifi rev2

I am trying to save the ssid and password for a wifi in flash, and I tried to use FlashStorage class.
I am facing error while compiling the example programs;

WARNING: library FlashStorage claims to run on samd architecture(s) and may be incompatible with your current board which runs on megaavr architecture(s).
C:\Users\Lenovo\Documents\Arduino\libraries\FlashStorage\src\FlashStorage.cpp: In constructor 'FlashClass::FlashClass(const void*, uint32_t)':
C:\Users\Lenovo\Documents\Arduino\libraries\FlashStorage\src\FlashStorage.cpp:25:30: error: base operand of '->' has non-pointer type 'NVMCTRL_t {aka NVMCTRL_struct}'
PAGE_SIZE(pageSizes[NVMCTRL->PARAM.bit.PSZ]),

Doesn't flashstorage work with uno wifi rev2?
If so, what is the alternative?

The Arduino Uno Wifi Rev2 uses the ATmega4809 microcontroller. That is the AVR family of microcontrollers.
Arduino calls these boards the "megaavr" boards.
You can not use the FlashStorage library with it.

It has EEPROM, but only 256 bytes.
https://www.arduino.cc/en/Reference/EEPROM

I think that I see a possibility to store data in Flash via a special bootloader that can runtime store data in a reserved part of the Flash. It is not impossible to make the FlashStorage compatible with this board.

@Koepel , the new AVRs allow application to write to flash

1 Like