diff --git a/Hello_World/build_image b/Hello_World/build_image index efcda785f8ef3137326531e085cdccaa7baac919..5feeda9e451ec5e5449a0dd509ddc4fe597d9767 100755 --- a/Hello_World/build_image +++ b/Hello_World/build_image @@ -2,4 +2,4 @@ make clean make APP=1 make build/max32665.bin cp build/max32665.bin card10.bin -python ../bootloader/crc_patch.py card10.bin +../bootloader/crc_patch.py card10.bin diff --git a/Hello_World_FreeRTOS/build_image b/Hello_World_FreeRTOS/build_image index efcda785f8ef3137326531e085cdccaa7baac919..5feeda9e451ec5e5449a0dd509ddc4fe597d9767 100755 --- a/Hello_World_FreeRTOS/build_image +++ b/Hello_World_FreeRTOS/build_image @@ -2,4 +2,4 @@ make clean make APP=1 make build/max32665.bin cp build/max32665.bin card10.bin -python ../bootloader/crc_patch.py card10.bin +../bootloader/crc_patch.py card10.bin diff --git a/ble/build_image b/ble/build_image index efcda785f8ef3137326531e085cdccaa7baac919..5feeda9e451ec5e5449a0dd509ddc4fe597d9767 100755 --- a/ble/build_image +++ b/ble/build_image @@ -2,4 +2,4 @@ make clean make APP=1 make build/max32665.bin cp build/max32665.bin card10.bin -python ../bootloader/crc_patch.py card10.bin +../bootloader/crc_patch.py card10.bin diff --git a/bmatest/build_image b/bmatest/build_image index efcda785f8ef3137326531e085cdccaa7baac919..5feeda9e451ec5e5449a0dd509ddc4fe597d9767 100755 --- a/bmatest/build_image +++ b/bmatest/build_image @@ -2,4 +2,4 @@ make clean make APP=1 make build/max32665.bin cp build/max32665.bin card10.bin -python ../bootloader/crc_patch.py card10.bin +../bootloader/crc_patch.py card10.bin diff --git a/bmetest/build_image b/bmetest/build_image index efcda785f8ef3137326531e085cdccaa7baac919..5feeda9e451ec5e5449a0dd509ddc4fe597d9767 100755 --- a/bmetest/build_image +++ b/bmetest/build_image @@ -2,4 +2,4 @@ make clean make APP=1 make build/max32665.bin cp build/max32665.bin card10.bin -python ../bootloader/crc_patch.py card10.bin +../bootloader/crc_patch.py card10.bin diff --git a/bootloader/crc_patch.py b/bootloader/crc_patch.py old mode 100644 new mode 100755 index 16394463a86332b5ee71662f4a16e9f297fcf7d5..21eeb57a5d1894bbdb4bcfc3bb0dbb889478de61 --- a/bootloader/crc_patch.py +++ b/bootloader/crc_patch.py @@ -1,16 +1,17 @@ +#!/usr/bin/env python3 import sys import crc16 crc = 0 -data = open(sys.argv[1]).read() +data = open(sys.argv[1], 'rb').read() 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 = crc16.crc16xmodem(padded) -print crc +print(crc) -open(sys.argv[1], 'w').write(padded) +open(sys.argv[1], 'wb').write(padded) diff --git a/ecgtest/build_image b/ecgtest/build_image index efcda785f8ef3137326531e085cdccaa7baac919..5feeda9e451ec5e5449a0dd509ddc4fe597d9767 100755 --- a/ecgtest/build_image +++ b/ecgtest/build_image @@ -2,4 +2,4 @@ make clean make APP=1 make build/max32665.bin cp build/max32665.bin card10.bin -python ../bootloader/crc_patch.py card10.bin +../bootloader/crc_patch.py card10.bin diff --git a/imutest/build_image b/imutest/build_image index efcda785f8ef3137326531e085cdccaa7baac919..5feeda9e451ec5e5449a0dd509ddc4fe597d9767 100755 --- a/imutest/build_image +++ b/imutest/build_image @@ -2,4 +2,4 @@ make clean make APP=1 make build/max32665.bin cp build/max32665.bin card10.bin -python ../bootloader/crc_patch.py card10.bin +../bootloader/crc_patch.py card10.bin diff --git a/ips/build_image b/ips/build_image index efcda785f8ef3137326531e085cdccaa7baac919..5feeda9e451ec5e5449a0dd509ddc4fe597d9767 100755 --- a/ips/build_image +++ b/ips/build_image @@ -2,4 +2,4 @@ make clean make APP=1 make build/max32665.bin cp build/max32665.bin card10.bin -python ../bootloader/crc_patch.py card10.bin +../bootloader/crc_patch.py card10.bin