Memory storage questions


What happens when a power loss occurs while the data is being written to flash memory? Do I need to maintain two copies (using CRCs maybe) and revert to the other on power up if one is curropt?

Is there a risk of corrupting more than just the application storage data if a power loss occurs during a adl_flhWrite?

Does the adl_flhWrite function return after the data is safely stored or does it return immediately - with the data queued for writing by some other task?

Basically I need to log small pieces of data and must ensure that the data is not corrupted i.e. A piece of data must be entirely written or not written at all. An external device will send the pieces of data using a application at command and I need to only “OK” the command once the data is stored.

Any advice greatly appreciated