I'm trying to create a function that returns pass/fail (bool) while trying to accept any parameter or array, saving or reading it by name from and to the flash memory of the chip.
The SDK contains functions for managing the flash (erasing, programming) and the standard function memcpy will copy a region from flash into RAM when supplied with the appropriate addresses and length.
This is the short simple answer but the better answer is non-trivial. You will need to consider topics such a wear leveling of the flash, data integrity and age/validity and it would be very particular to a specific application as to how often you should be writing back the data.
The SDK functions and memcpy should serve you for now. A better approach - rather than implementing a per variable approach - is to place all the variable that you want to save into a linker section, and copy that section to and from flash as needed. Make the section an integral multiple of the flash page size.
Can you explain the difficultly you are having in achieving this so that we may best assist you?
The best way is to provide the shortest, minimal routine for:
Or, a short simple routine to copy an array arrayPrameter to flash memory and back. So I can store it in flesh and get it back after a power off..
Retrieving data ...