In section 7.3.2 of the Boot Tools User Guide (ug-1137 | 2018.09.24) is the following description:
"The header checksum for both versions of the mkpimage header is the CRC checksum of the byte value from offset 0x0 to (n*4)-4 bytes where n is the program length."
Surely, this is the image CRC and not the header checksum ? .....also the description of n seems to apply to version 0 of the header and not version 1.
Is the program length in version 1 of the header guaranteed to be a multiple of 4 bytes ?
Currently I am reviewing the forum for any open questions and found this thread. I apologize that no one seems to answer this question that you posted. Since it has been a while you posted this question, I'm wondering if you have found the answer? If not, please let me know, I will try to assign/find someone to assist you. Thank you.
Hi Nooraini -
I've moved beyond this now assuming that the description was for the image CRC and not the header CRC and that (n*4)-4 should be used for version 0 header, and (n-4) should be used for version 1 - it would be good to get confirmation that the documentation is indeed incorrect though, and that the program length is guaranteed to be a multiple of 4 bytes.
Hi Ahmed -
I confirmed this by adding a validation routine for new bootloader images that had version 1 of the header - the checksum was correct when done over (n-4) bytes - it also makes sense that the length (n) in version 0 headers are in 32-bit words compared with bytes in the version 1 header and therefore needs the x4 factor in the calculation only for version 0 headers.
The text "header checksum" is just incorrect - the header checksum is just the checksum of the header portion of the image - the image checksum is what is described.