29.8.1.1.3 Workflow

  1. 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();
    
  2. 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.
    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();
    }
    
    Config BOD to give an early warning to prevent data loss.
    configure_bod();