For testing purposes, this will be fine. I’ll probably do what you’ve just suggested though and do just restore on powerup in this testing code. I think that saving and loading actually takes a few milliseconds or longer, so if I pressed the button too fast by accident then it may corrupt the memory again because it tries to write while reading. Granted I get it working again.
I was reading here:
Storing of QSPI buffer causing data corruption and hard faults
that it’s possible that the MCU is trying to prefetch the code and do work prior to it actually being executed which might result in writing to the QSPI while saving and vice versa. Also the poster erases an aligned section of QSPI prior to writing to avoid bus faults. I may try that too if all else fails.
Also, to KnightHill, the other person that was having problems with Versio said that using separate scopes and using pointers worked for him, just as what I see in your code. I’ve taken the time to structure my code in object oriented land like you have and now all that’s left is to test it when I;m home. Fingers crossed!