29.8.1.1.3 Workflow
- Attempt to initialize the RWW EEPROM emulator service, storing the error code from the initialization function into a temporary variable.
enum
status_code error_code = rww_eeprom_emulator_init();
- Check if the emulator service failed to initialize for any other reason; if so, assume the emulator physical memory is unformatted or corrupt and erase/re-try initialization.
Config BOD to give an early warning to prevent data loss.else
if
(error_code != STATUS_OK) {
/* Erase the emulated EEPROM memory (assume it is unformatted or
* irrecoverably corrupt) */
rww_eeprom_emulator_erase_memory();
rww_eeprom_emulator_init();
}
configure_bod();