1
0
mirror of https://github.com/rene-dev/stmbl.git synced 2024-12-20 07:32:10 +00:00
stmbl/shared/crc.sh
2018-02-08 18:09:48 +01:00

16 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
CRC="python ../Tools/pycrc-0.8.3/pycrc.py"
rm -rf crc8.h crc8.c crc16.h crc16.c crc32.h crc32.c
#1wire crc, for smartserial and hv packets
$CRC --model dallas-1-wire --algorithm table-driven --table-idx-width 8 --symbol-prefix crc8_ --generate c -o crc8.c
$CRC --model dallas-1-wire --algorithm table-driven --table-idx-width 8 --symbol-prefix crc8_ --generate h -o crc8.h
#16bit crc, for config in flash
$CRC --model crc-16 --algorithm table-driven --table-idx-width 8 --symbol-prefix crc16_ --generate c -o crc16.c
$CRC --model crc-16 --algorithm table-driven --table-idx-width 8 --symbol-prefix crc16_ --generate h -o crc16.h
#32bit crc for firmware
$CRC --model crc-32 --algorithm table-driven --table-idx-width 8 --symbol-prefix crc32_ --generate c -o crc32.c
$CRC --model crc-32 --algorithm table-driven --table-idx-width 8 --symbol-prefix crc32_ --generate h -o crc32.h
#yaskawa
$CRC --algorithm table-driven --table-idx-width 8 --symbol-prefix yaskawa_crc16_ --width 16 --poly 0x1021 --reflect-in false --reflect-out false --xor-in 0xffff --xor-out 0xffff --generate c -o yaskawa_crc16.c
$CRC --algorithm table-driven --table-idx-width 8 --symbol-prefix yaskawa_crc16_ --width 16 --poly 0x1021 --reflect-in false --reflect-out false --xor-in 0xffff --xor-out 0xffff --generate h -o yaskawa_crc16.h