sierrafoxtrot/srecord

CRC16 calculation options

Opened this issue · 0 comments

The CRC16 calculation options are insufficient and hard to understand:

  • There is no explicit option to control the initial value. There is an implicit way to control it by selecting the named option -CCITT or -XMODEM and then override the polynomial with -POLY.
  • The implementation comments in crc16.cc refer to the CRC16 algorithm descriptions as proposed in the famous painless giude to CRC: Name, Width, Poly, Init, RefIn, RefOut, XOrOut, Check. But apparently, you can't control all of them, and/or the naming is inconsistent.
    • In fact, it seems you can't find a combination that creates MODBUS-style CRCs. I tried all 12 combinations of the Parameters {-CCITT|-XMODEM|-BROKEN}, {-AUGment|-No-AUGment}, {-Most_To_Least|-Least_To_Most} with -POLY ibm as indicated in srec_input.1.html, but none of the combinations got the correct result.

Proposal: Add options that control the parameters as named in the painless guide.

Useful resources: