From: Robin Krens Date: Sun, 11 Feb 2024 14:17:01 +0000 (+0100) Subject: RAFlasher.py: continuos loop sending chunks X-Git-Tag: v0.0.1~42 X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=c072efbf71180e056352c4b42a6249fa9601bde8;p=renesas-ra-flasher RAFlasher.py: continuos loop sending chunks --- diff --git a/src/RAFlasher.py b/src/RAFlasher.py index b1a3f6a..83e0989 100644 --- a/src/RAFlasher.py +++ b/src/RAFlasher.py @@ -33,17 +33,17 @@ def write_img(dev, img, start_addr, end_addr, verify=False): raise ValueError("end address value error") with open(img, 'rb') as f: chunk = f.read(chunk_size) - #while chunk: - # chunk = f.read(chunk_size) - packed = pack_pkt(WRI_CMD, chunk) - print(f'Sending {len(chunk)} bytes') - dev.send_data(packed) - reply_len = 7 - reply = dev.recv_data(reply_len) - reply = b'\x81\x00\x02\x00\x00\xFE\x03' - if not reply == False: - msg = unpack_pkt(reply) - print(msg) + while chunk: + packed = pack_pkt(WRI_CMD, chunk) + print(f'Sending {len(chunk)} bytes') + dev.send_data(packed) + reply_len = 7 + reply = dev.recv_data(reply_len) + #reply = b'\x81\x00\x02\x00\x00\xFE\x03' # test reply + if not reply == False: + msg = unpack_pkt(reply) + print(msg) + chunk = f.read(chunk_size) dev = RAConnect(vendor_id=0x1a86, product_id=0x7523)