Commit 3ae54c3c authored by schneider's avatar schneider
Browse files

fix(crc_patch.py): Update for Python3 compatibility

parent ff648393
...@@ -2,4 +2,4 @@ make clean ...@@ -2,4 +2,4 @@ make clean
make APP=1 make APP=1
make build/max32665.bin make build/max32665.bin
cp build/max32665.bin card10.bin cp build/max32665.bin card10.bin
python ../bootloader/crc_patch.py card10.bin ../bootloader/crc_patch.py card10.bin
...@@ -2,4 +2,4 @@ make clean ...@@ -2,4 +2,4 @@ make clean
make APP=1 make APP=1
make build/max32665.bin make build/max32665.bin
cp build/max32665.bin card10.bin cp build/max32665.bin card10.bin
python ../bootloader/crc_patch.py card10.bin ../bootloader/crc_patch.py card10.bin
...@@ -2,4 +2,4 @@ make clean ...@@ -2,4 +2,4 @@ make clean
make APP=1 make APP=1
make build/max32665.bin make build/max32665.bin
cp build/max32665.bin card10.bin cp build/max32665.bin card10.bin
python ../bootloader/crc_patch.py card10.bin ../bootloader/crc_patch.py card10.bin
...@@ -2,4 +2,4 @@ make clean ...@@ -2,4 +2,4 @@ make clean
make APP=1 make APP=1
make build/max32665.bin make build/max32665.bin
cp build/max32665.bin card10.bin cp build/max32665.bin card10.bin
python ../bootloader/crc_patch.py card10.bin ../bootloader/crc_patch.py card10.bin
...@@ -2,4 +2,4 @@ make clean ...@@ -2,4 +2,4 @@ make clean
make APP=1 make APP=1
make build/max32665.bin make build/max32665.bin
cp build/max32665.bin card10.bin cp build/max32665.bin card10.bin
python ../bootloader/crc_patch.py card10.bin ../bootloader/crc_patch.py card10.bin
#!/usr/bin/env python3
import sys import sys
import crc16 import crc16
crc = 0 crc = 0
data = open(sys.argv[1]).read() data = open(sys.argv[1], 'rb').read()
crc = crc16.crc16xmodem(data) crc = crc16.crc16xmodem(data)
print crc print(crc)
padded = data + chr(crc >> 8) + chr(crc & 0xFF) padded = data + bytes([crc >> 8, crc & 0xFF])
crc = 0 crc = 0
crc = crc16.crc16xmodem(padded) crc = crc16.crc16xmodem(padded)
print crc print(crc)
open(sys.argv[1], 'w').write(padded) open(sys.argv[1], 'wb').write(padded)
...@@ -2,4 +2,4 @@ make clean ...@@ -2,4 +2,4 @@ make clean
make APP=1 make APP=1
make build/max32665.bin make build/max32665.bin
cp build/max32665.bin card10.bin cp build/max32665.bin card10.bin
python ../bootloader/crc_patch.py card10.bin ../bootloader/crc_patch.py card10.bin
...@@ -2,4 +2,4 @@ make clean ...@@ -2,4 +2,4 @@ make clean
make APP=1 make APP=1
make build/max32665.bin make build/max32665.bin
cp build/max32665.bin card10.bin cp build/max32665.bin card10.bin
python ../bootloader/crc_patch.py card10.bin ../bootloader/crc_patch.py card10.bin
...@@ -2,4 +2,4 @@ make clean ...@@ -2,4 +2,4 @@ make clean
make APP=1 make APP=1
make build/max32665.bin make build/max32665.bin
cp build/max32665.bin card10.bin cp build/max32665.bin card10.bin
python ../bootloader/crc_patch.py card10.bin ../bootloader/crc_patch.py card10.bin
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment