Embed checksum or CRC into image

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

cross mob
Not applicable
Is there a way to calculate the checksum or CRC of an image and embed the value into the image so it can be checked by a bootloader when it is downloaded and each time it is executed? I've done this previously with IAR but I cannot find any reference to doing this with DAVE 4.
0 Likes
4 Replies
lock attach
Attachments are accessible only for community members.
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Have a look at the attached project and the included instructions in the word document.

Regards,
Jesus
0 Likes
Not applicable
I hoped there was something included with the tools that would handle this, but the method you propose should work. Thanks for the information.
0 Likes
Not applicable
Hi Jesus,

I have a problem on the XMC concerning CRC calculation. I have a bootloader which is in the first 32 kByte of my XMC4500 and after that I use the EEPROM emulation so my App starts at: 0x0c020000.

The last 32 Bytes of my flash is reserved for a header which is added on compile time. The first entry is the CRC which I calculate and add on compile time via srec_cat. I use srecord to calculate the checksum from 0x0c020000 to 0x0c0fffe0.
My problem is i am not able to get the same CRC on the device. I think the problem is that the infineon uses 0x00 for empty flash and i do not know what srecord uses.

Do you have any idea what's wrong here?
0 Likes
Not applicable
I mean you use


uint32_t *end_of_flash = (uint32_t *)&eText;
uint32_t firmware_crc = *(end_of_flash);

and eText is not the end off the whole flash - so it is only the end of the use flash from the app. So but that does not work for a bootloader. Because the loader should have the possibility to use the whole flash if needed.
0 Likes