I'm programming an ATmega644P, as a part of a set-top box main board. After some problems with EEPROM corruption, I want to create an EEPROM checksum to be stored in the EEPROM when writing a new value to the EEPROM (that's a lot of EEPROM's in one sentence :)). And I'm pondering on how to achieve this in an easy way.
After some searching, I've opted for going for a 16-bit Fletcher's checksum. But the question is how I am to generate this.
Presently we use the ATmega's EEPROM to store various settings, and we've mapped a list of variabled and their locations in the EEPROM. As a result, the stored values are not in one continous part of the EEPROM.
I've thought about just creating a RAM stored array the same size as the total amount of EEPROM stored values, and just copying the values from the EEPROM to the RAM, one by one. And finally, calculating the checksum and storing it in the EEPROM.
Alternatively, it's possible to just create a checksum based on the whole EEPROM, from start to finish. But I'm not sure about how to do this in CodeVisionAVR, as the EEPROM is accessed through global variables defined to access set EEPROM registries.
Have anyone done this before, and have some thoughts on how this is best implemented? I'm thankfull for any and all feedback. :-)
EDIT: Added relevant code: eeprom.c