Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20721 Discussions

Reading and calculating image checksum directly from FPGA

jfi
Beginner
1,180 Views

Hi,

We would like to verify the programmed image of a FPGA (MAX10 in this case) by confirming its checksum in-system with e.g our Baseboard Management Controller (i.e. not with an external device or the Quartus programmer). However, we cannot find documentation about how to do this in the Intel archives.

What we have found is that we can use the Intel IP to bridge for instance I2C <-> Avalon-MM <-> CFM (i.e. access the configuration memory), but we could not find documents for the method used to calculate the checksum of the configuration loaded into the CFM (e.g. how Quartus determines the checksum of a POF)

We may be able to read out the CFM contents and just make up our own checksum/verify the image some other way, but would prefer using Intel functionality and the Quartus checksum for simplicity.

Does anyone know how to do this? Or have any suggestions for alternative ways of confirming a programmed image has not been modified?

Thank you for the support

Labels (1)
0 Kudos
1 Solution
EthanLi
Employee
1,082 Views

The checksum from programmer or map file uses only the data which will be programmed to the configuration device.

For pof and jic file, there is some information like quartus version and device information in the head and CRC data in the end, which is excluded in checksum. 

https://www.intel.com/content/www/us/en/support/programmable/articles/000078447.html 

 

I have not deeply looked into the pof file, but for the jic file, the checksum (shows in programmer) is calculated from the the data after several dot notation, end at before several dot notation. See the attached capture. I think the pof file is the same algorithm as the jic file.

EthanLi_0-1694765843874.png

EthanLi_2-1694765990396.png

 

If you want to get the checksum of the entire data of the pof, please use the tcl command.

https://www.intel.com/content/www/us/en/docs/programmable/683039/23-1/device-pin-options-dialog-box.html 

 

Thanks,

Ethan

View solution in original post

0 Kudos
4 Replies
EthanLi
Employee
1,114 Views

Hi,

 

This is Ethan from Intel AE team.

Do you generate the pof file from the CPF(Convert programming file)?

If yes, you can generate the .map file in the same time.

Please check the checksum in the map file with the sum of the data in the flash.

The checksum in the map file is the same as the one shows in programmer.

 

<< Simle Example of checksum calculation >>

[Data] 0xC0 0xA8 0xFF 0x58

[Checksum] 0xC0 + 0xA8 + 0xFF + 0x58 = 0x2BF

 

Thanks,

Ethan

 

0 Kudos
jfi
Beginner
1,097 Views

Thanks Ethan

We don't usually use the CPF, but thanks for the handy tip.

So the checksum is just a byte-wise addition? If so, we cannot calculate the same checksum value as shown in the .map/programmer for the POF when adding its bytes. It seems the (check)sum total is reached before the end of the file, and an insufficient sum is achieved if summing data in the e.g. CFM addresses only.

Are there some parts of the POF file that are excluded in the calculation?

 

Also, the hope is to be able to calculate this based only off of what is actually on the device. Would a different file format (e.g. rbf) better represent this, if indeed the POF contains additional data?

 

We are now attempting to dump the internal memory contents in order to see what file type or portion of the POF they match, and what checksum we get using your calculation method.

 

0 Kudos
EthanLi
Employee
1,083 Views

The checksum from programmer or map file uses only the data which will be programmed to the configuration device.

For pof and jic file, there is some information like quartus version and device information in the head and CRC data in the end, which is excluded in checksum. 

https://www.intel.com/content/www/us/en/support/programmable/articles/000078447.html 

 

I have not deeply looked into the pof file, but for the jic file, the checksum (shows in programmer) is calculated from the the data after several dot notation, end at before several dot notation. See the attached capture. I think the pof file is the same algorithm as the jic file.

EthanLi_0-1694765843874.png

EthanLi_2-1694765990396.png

 

If you want to get the checksum of the entire data of the pof, please use the tcl command.

https://www.intel.com/content/www/us/en/docs/programmable/683039/23-1/device-pin-options-dialog-box.html 

 

Thanks,

Ethan

0 Kudos
jfi
Beginner
1,050 Views

Thanks Ethan,

Finding similar points in the file as those you showed now gives us the same checksum as the POF.

We are still working on reading the data from the internal memory, so will have to get back to you on that side of things.

Thanks again!

0 Kudos
Reply