Checksums of ROM

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am developing an application with reliablilty specifications requiring the target device (an ATmega8) to periodically verify that the entire contents of its Flash ROM (both constant data AND code), and its EEPROM data, are valid.

If, over the life of the system, the EEPROM data becomes corrupt, it would prompt the user to reset all calibration info. If the Flash ROM becomes corrupt, it would lock the system and raise an alarm that reliability had been compromised.

I figure that the best way to achieve this would be to compute some sort of checksum or CRC. One for the flash, and one for the EEPROM.

I have two concerns:

Firstly, how can I automatically generate the value that this checksum / CRC should evaluate to? Ideally, any user should just be able to 'make all' and the resulting hex files for downloading should already contain a correct checksum for the Flash, and an initial valid checksum for the EEPROM. (Of course, as the user modifies the EEPROM calibration, the EEPROM checksum would be modified on-the-fly. I can manage that part of it.)

Secondly, how can I make sure that the Flash checksum value gets placed in a well-known location in Flash so that software knows how to find it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

See the SRecord utilities (and the SRecord user manual) that comes with WinAVR for more info on all this.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's great! Apply two filters, any presto! There's a checksum at the bottom of a 0xFF-filled hex file. I really feared that I'd have to write my own hex file parser in order to do this -- I had no idea how powerful SRecord was. A preliminary skim of the WinAVR package descriptions led me to believe it was only used for converting one file format to another.

(btw, how can I configure the man page viewer to work with my system (Windows 98)? I always get the error '/usr/local/lib/man.config: No such file or directory' (No surprise there, given that I don't have a /usr directory on my system), and it doesn't recognize any of the man pages I see in the /winavr/man/... directories.)

Thanks,
Luke

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lfmorrison wrote:
That's great! Apply two filters, any presto! There's a checksum at the bottom of a 0xFF-filled hex file. I really feared that I'd have to write my own hex file parser in order to do this -- I had no idea how powerful SRecord was. A preliminary skim of the WinAVR package descriptions led me to believe it was only used for converting one file format to another.

Yeah, it's a pretty good tool. Unfortunately there are problems in building the SRecord software, so they will probably not be included in the next WinAVR release, until the problem can get resolved. :(

lfmorrison wrote:

(btw, how can I configure the man page viewer to work with my system (Windows 98)? I always get the error '/usr/local/lib/man.config: No such file or directory' (No surprise there, given that I don't have a /usr directory on my system), and it doesn't recognize any of the man pages I see in the /winavr/man/... directories.)

The man command in WinAVR doesn't work, and never has. I don't fully know why. Joerg and I have talked about this, and about possible workarounds, but IIRC, they have always seemed like a bit of a hassle. The documentation has been provided in other formats, so it's generally ok if man doesn't work. After all, WinAVR is not supposed to be a complete Unix system anyway. :)

Eric