Add lpcrc tool
[rapper.git] / tools / lpcrc / lpcrc.sh
diff --git a/tools/lpcrc/lpcrc.sh b/tools/lpcrc/lpcrc.sh
new file mode 100755 (executable)
index 0000000..ee36dd5
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+binary=$1
+source=$2
+
+lpcrc=$(dirname $(readlink -f $0))/lpcrc
+
+crcoutput=$($lpcrc $1)
+
+echo "$crcoutput" | grep -q differs
+if [ $? -eq 0 ] ; then
+       crc=$(echo "$crcoutput" | grep new_crc | cut -d' ' -f2)
+       sed -i -e \
+         's/^\(\s\+0x\)[a-f0-9]\{8\}\(,\s\+\/\/\ Interrupt CRC\)/\1'$crc'\2/g' \
+         $source
+       make crc
+fi