Flash Checksum

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DaPi_1514011
Level 3
Level 3
First like received

Hi,

   

When the ProC4 is flashed, is the flash image CRC stored anywhere in flash/sflash etc. by default?

   

I have the programming specification for this which shows it is in the hex file and how to calculate if programming, but I'm not seeing that it's stored on the device anywhere at programming. Is this correct?

   

I guess I could add the checksum to sflash or similar, but if it's readable somewhere, that would be great.

   

Thanks, Dave

0 Likes
1 Solution
Anonymous
Not applicable

Hi David,
Yes, Checksum as such is not stored in memory. It is a part of Hex File. In the Hex file, 0x9030 0000  is used for storing checksum.

   

For e.g., :0200000490303A
:020000000C3FB3

   

0C3F being the checkusm.

   

Alternatively, in your code you can sum up all flash elements to compute the checksum.

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

Hi David,
Yes, Checksum as such is not stored in memory. It is a part of Hex File. In the Hex file, 0x9030 0000  is used for storing checksum.

   

For e.g., :0200000490303A
:020000000C3FB3

   

0C3F being the checkusm.

   

Alternatively, in your code you can sum up all flash elements to compute the checksum.

0 Likes

To check program memory means you want to confirm whether the CRC of program Flash in hex file is same as CRC of p-flash after downloading/ flashing hex into controller.

In this way you are checking the physical memory is damaged or not.

Things you need to do is.

Write down your own routine to calculate CRC of p flash with an algorithm (CRC-16 or CRC-32).

Calculate CRC of hex file using srec tool using same algorithm (CRC-16 or CRC-32).

Append CRC at particular address in hex file. (You can place calculated CRC at unused p flash area )

Now at run time your own routine will calculate CRC of p flash. You should have added a logic to compare calcilated CRC with stored CRC.

Refer below link for reference.

Hex file CRC calculation using Srecord tool :
https://embdsysbasics.blogspot.com/2018/12/hex-file-checksum-calculator-using.html?m=1

0 Likes