tpircher-zz / pycrc

Free, easy to use Cyclic Redundancy Check (CRC) calculator and source code generator
https://pycrc.org
MIT License
169 stars 36 forks source link

Feature: big-endian support #27

Closed daniel-starke closed 5 years ago

daniel-starke commented 5 years ago

Please add support to generate C code for big-endian targets like Arduino.

tpircher-zz commented 5 years ago

Hi Daniel, is there any problem with the generated code? I am not aware of bugs with big endian platforms. What model and what algorithm are you using? Can you give an example of when the calculation is wrong? Thanks

daniel-starke commented 5 years ago

Hi, sorry, it seems that I misunderstood the meaning of big and little endian in here when I was searching for the origin of my error. I was struggling with the example vector test for Arduino I was running. Turns out that the input string size was miscalculated by 1 (null-termination character included for CRC calculation) which gave the wrong result. I thought is was due to the generated code but it was not.

tpircher-zz commented 5 years ago

Hi Daniel, thanks for following this up and I'm glad this is now working for you! Unless you are reading one byte at a time (using the slice-by option, e.g.) the same code should work regardless of the endianness. Please don't hesitate to contact me again if you come across other issues.