AnsweredAssumed Answered

Generating CRC32 from .srec files

Question asked by Robert Poor on Oct 18, 2017
Latest reply on Feb 19, 2018 by gearhead1107

I'm using the flash-resident Kinetis 2.x bootloader, and now my goal is to enable CRC checking in the Boot Configuration Area. 

 

I've read Erich Styger's excellent blog entry on CRC Checksum Generation with ‘SRecord’ Tools for GNU and Eclipse, that has gotten me 80% of the way toward my goal.

 

The challenge is that the CRC32 algorithm required by the Kinetis 2.0 bootloader is not supported by the SRecord tool suite.  In particular, the bootloader is expecting a CRC32 computed with the following parameters:

 

     crcUserConfigPtr.crcBits = kCrcBits32;
     crcUserConfigPtr.seed = 0xffffffff;
     crcUserConfigPtr.polynomial = 0x04c11db7U;
     crcUserConfigPtr.complementChecksum = false;
     crcUserConfigPtr.reflectIn = false;
     crcUserConfigPtr.reflectOut = false;

... and neither of the CRC32 algorithms provided with SRecord (CRC32 and STM32) supports this particular combination of parameters (notably reflectIn = false and reflectOut = false).

 

So: what's the shortest path to generating the CRC32 from a .srec file using those parameters?  Yes, I could write a parser for .srec files, compute the proper CRC and insert it into the Boot Configuration Area using SRecord, but it would seem like someone must have been down this path.  (It would be super if there was an add-on utility for KDS 3.x, but that might be asking too much!  )

 

- Robert Poor

 

P.S. For some more information and context, you may look at this stack overflow entry.

Outcomes