Skip to content

Commit

Permalink
Programmer: show file CRC
Browse files Browse the repository at this point in the history
  • Loading branch information
adumont committed Nov 9, 2021
1 parent 8a1ff91 commit 025a0ef
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion programmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import os.path
from time import sleep
import math
import zlib


from glob import glob

Expand All @@ -31,6 +33,8 @@ def get_response(show=False):
def cmd_send(args):
l = os.stat(args.file).st_size

crc32 = 0

addr = int(args.addr, 16)

addr_start = addr
Expand All @@ -49,6 +53,7 @@ def cmd_send(args):

chkA=1
chkB=0
crc32 = zlib.crc32(data, crc32)

for c in data:
print("%02X " % c, end="")
Expand Down Expand Up @@ -84,7 +89,7 @@ def cmd_send(args):

if count >= l: break

print("%d bytes written from %04X to %04X" % (addr-addr_start, addr_start, addr-1) )
print("%d bytes written from %04X to %04X, CRC32: %04X.%04X" % (addr-addr_start, addr_start, addr-1, crc32>>16, crc32 & 0xFFFF) )


def cmd_run(args):
Expand Down

0 comments on commit 025a0ef

Please sign in to comment.