STM32 CUBE STM32 PGR  Post Compile CRC  Help - Page 1
Forum section: electronics / general

author: LaserSteve
author_rank: Super Contributor
timestamp: January 20, 2025, 07:34:07 pm
content: My company needs to have Future Electronics program a large batch of STM32-F-07. Programmer of the Code is overseas, works on a Linux platform, sends us a finished, compiled, ASM in HEX. Problem is his CRC he sends us does not match the CRC I get if I open it in the Cube tools running on Win 11 in the states. When we send it to Future, their web page asks for a CRC. Of course, Future uses a service to program that I cannot easily reach. When the processors are programmed, they go right to the SMD line when received here. Of course, our contract is for minor corrections to long agoi finished code, and I can't have the raw source.So Future is asking for a CRC (Which One?) and a vector or offset if one exists, my retired predecessor once knew the answer to this, when the boards were last spun five years ago, but he cannot remember.It seems there is more than one way to calc the CRC, and a query to the STM corporate forum yielded bad news, seems we would need a NDA with ST to find out how to write a script to have the IDE do the calc.Anyone send out their programming? We need many, many, trays of this part. Anyone been through this sort of mess before? The rep will be here tomorrow, but I'm not sure even he can get us an answer.Help a newbie to production please!Thanks,SteveAnyone have an idea of what to do ?

author: Siwastaja
author_rank: Super Contributor
timestamp: January 20, 2025, 07:46:05 pm
content: CRC is just the name of the concept. There are nearly infinite number of different CRCs - even the number of very commonly used ones for file integrity checking is probably more than 10.Only Future Electronics can know and specify what kind of CRC they want to have. This information should be easily available and not guesswork - it's pretty weird if they don't specify it openly (they must havesomeinstructions about the ordering process, right?). If this crucial piece of information is missing, then they should be easily able to answer to your inquiry about it. If not, it sounds like you need another contractor to do the programming, IMHO.Once you know what the correct CRC is, I'm sure your programmer (who wrote the code) is well able to calculate the CRC - which in itself is just a few lines of code, with a lot of resources available online.

author: LaserSteve
author_rank: Super Contributor
timestamp: January 20, 2025, 09:11:19 pm
content: One would think Future would have a .PDF somewhere. So far I haven't found it.Steve

author: peter-h
author_rank: Super Contributor
timestamp: January 23, 2025, 06:03:54 pm
content: It is very easy to set up a post build step (a .bat file if under windows) to append a CRC to a file.As per above, there is a huge number of different CRCs but once you find the algorithm, you can find somebody on freelancer.com who will write you a win32 command line utility which will calculate and append the CRC to your fileYou can also generate a .hex file straight out of Cube, but then you have extra work to append a CRC to that because you have to go hex to binary, append the CRC, and back to hex.The binary or hex output is done with arm-none-eabi-objcopy.exe