fix a bug of dfuse.py
authorNIIBE Yutaka <gniibe@fsij.org>
Sun, 10 Apr 2011 12:28:03 +0000 (21:28 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Sun, 10 Apr 2011 12:28:03 +0000 (21:28 +0900)
ChangeLog
tool/dfuse.py

index 9280bb2..ad88dad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-10  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * tool/dfuse.py (DFU_STM32.verify): data can be less than 1KiB.
+
 2011-02-24  NIIBE Yutaka  <gniibe@fsij.org>
 
        * src/usb_prop.c (gnuk_device_SetInterface): Fix argument to
index e826af4..3fc1fc2 100755 (executable)
@@ -282,8 +282,8 @@ class DFU_STM32:
             while addr < end_addr:
                 block = self.dfuse_read_memory()
                 j = 0
-                for d in block:
-                    if d != (ord(data[i*1024+j])&0xff):
+                for c in data[i*1024:i*1024+1024]
+                    if (ord(c)&0xff) != block[j]:
                         raise ValueError, "verify failed at %08x" % (addr + i*1024+j)
                     j += 1
                 if i & 0x03 == 0x03: