I am trying to calculate a CRC and insert in into the file at a fixed location using the following. I want to calculate the CRC over the entire file and then insert it at 0x1EC (1EC will be 0x00000000 in the image before the CRC is inserted):
srec_cat .\STM32F107RCT7-application.bin -binary -STM32_Big_Endian 0x1EC .\STM32F107RCT7-application.bin -binary -o outfile.bin -binary
But I keep getting the following error:
srec_cat: .\STM32F107RCT7-application.bin: 0x156BC: multiple 0x000001EC values (previous = 0x5A, this one = 0x00)
I think I somehow need to tell it to use the CRC value for this location but not sure how?
The normal way to do this is to calculate the CRC as normal, then cycle the CRC backwards by ((file length) - 0x1EC). An optional way to cycle the CRC backwards would be to multiply it by a negative power of 2 modulo the CRC polynomial using carryless multiply.
The only example of mine that I could find uses a carryless multiply intrinsic:
https://stackoverflow.com/a/70729922/3282056