Haven't been here for a while, but have searched and can't find much....
So I'm updating an EEPROM variable in my Codevision CV-AVR code eg.
eeprom uint32_t x; ... ... x++;
CV-AVR is clever in that it does read-before-write on EEPROM updates to avoid re-writing EEPROM locations with the same value and improve speed.
...but when say x is 65535, the increment gives 63536 and the low 3 bytes of the uint32_t change so 3 EEPROM bytes are updated.
My device has a on/off switch, so some day someone will turn it off and when the brownout eventually kicks in and puts the AVR in reset, the code will be somewhere in the middle of the EEPROM updates and the EEPROM will end up in an inconsistent state.
Is there a way of protecting from this?