Don't understand what a checksum does

1.1k Views Asked by At

My book tells me that a checksum byte in rom is performed to insure the integrity of ROM contents. It will detect any corruption of the contents of ROM. I don't understand this. I thought memory stored in ROM is read only so how can it be manipulated? What does it mean corrupted? It says corruption can be caused during start up due to current surge. If memory is lost or corrupted then what does the checksum do to correct it, in other words does it restore it or delete it or what?

I am performing this instruction on a HCS12 microcontroller from freescale using code warrior. The language i'm using to do the checksum is written in C.

1

There are 1 best solutions below

0
On

The ROM is actually EEPROM (Electrically Erasable Programmable Read-Only Memory), which can be programmed and reset. It is not true ROM. So the checksum would be used to determine if there was a problem when the EEPROM was programmed. Programming devices for EEPROMs will also commonly read back what they have written to confirm it all went ok.

During normal operation, your microcontroller isn't updating this and it's called "ROM" because the data is stable when it's powered down. It would be programmed:

  1. using a programming tool on your workbench / when your hardware project is built.
  2. re-programmed by the microcontroller itself - a "firmware update". different microcotrollers have different strategies to do this (if they support it at all)