Showing results for 
Search instead for 
Did you mean: 

Enquiry on generating CRC of a downloaded binary file for FOTA.


Hi Community,
I am using the controller , STM32L072CZT6. I am currently working on Fota functionality .I am downloading a binary file from ftp server and I need a crc verfication for the downloaded data. I am using the default CRC settings in the .ioc file.
The polynoimial is 0x04c11db7
Init value is default
I couldn't find a tool that could generate the crc with this polynomial. Please let me know if there is any tool available like JFlash (which uses a diffrent polynomial 0xebd88320). I am currently trying to generate the crc for using it with Jflash:
The document states that:
a. Everything that is not covered by the data file (gaps in the data file, unused sectors
etc.) which is opened, is assumed as 0xFF during the CRC calculation. (Is this the init value ?)
b. The polynomial which is used for the CRC calculation is 0xEDB88320.

These are the .ioc configurations wrt Jflash Please let me know if the init value provided is correct or not. I am downloading the files as chunks of 1024 bytes and is using HAL_Accumulate for each chunks and final crc is returned from hcrc.Instance->DR; It would be helpful if you could help me any info in configuring advanced parameters.
Thank you.  image.png

Chloe Meunier
ST Employee


You could have a look to this article : How to calculate and generate post-build CRC - STMicroelectronics Community


Best regards


Use a signing tool on the host PC that uses the STM32 HW CRC32 if that's what you're using. I've posted example of code to do this to the forum several times in the last decade or more.

If you're a C programmer, perhaps write something that reads and processes the file with STDIO IO File functions.

You might also want to think of ways of packaging the firmware securely.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..