bugfix flash read/write for off-by-one errors
authorDan White <dan@whiteaudio.com>
Sun, 3 Jun 2012 02:13:20 +0000 (21:13 -0500)
committerDan White <dan@whiteaudio.com>
Sun, 3 Jun 2012 02:13:20 +0000 (21:13 -0500)
python-lib/mpsse-test.py
python-lib/usbio.py

index d44950640b755c17c537050a9ce6910ad0971a7e..69934ce74df0536404d13474f793ddf219fdfdc1 100755 (executable)
@@ -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)
 
index f39af29c4600a946fceac489f9c1614e5f459e06..03c56d9cc45b1d9b6d6f6fd02351fb829f147dd1 100644 (file)
@@ -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())