From fab76f3b9dba759f163c3692383791618c042b7b Mon Sep 17 00:00:00 2001 From: Dan White Date: Sat, 2 Jun 2012 21:13:20 -0500 Subject: [PATCH] bugfix flash read/write for off-by-one errors --- python-lib/mpsse-test.py | 2 +- python-lib/usbio.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python-lib/mpsse-test.py b/python-lib/mpsse-test.py index d449506..69934ce 100755 --- a/python-lib/mpsse-test.py +++ b/python-lib/mpsse-test.py @@ -292,7 +292,7 @@ if 0: #code space in RAM, only get/send used block of bytes a = [a for a in h.addresses() if (a >= 0x4000 and a < 0xff00)] - alen = max(a) - min(a) + alen = max(a) - min(a) + 1 code = h.gets(0x4000, alen) flash.write(min(a), code) diff --git a/python-lib/usbio.py b/python-lib/usbio.py index f39af29..03c56d9 100644 --- a/python-lib/usbio.py +++ b/python-lib/usbio.py @@ -1168,7 +1168,7 @@ class M25PExx(object): nPages = (n // 256) + 1 for i in range(nPages): s = i * 256 - e = min(s+256, len(data)-1) + e = min(s+256, len(data)) a = addr + s while not self.isReady(): print hex(self.status()) -- 2.25.1