+
+if(sys.argv[1]=="verify"):
+ f = sys.argv[2];
+ start=0x0000;
+ stop=client.JEDECsize;
+ if(len(sys.argv)>3):
+ start=int(sys.argv[3],16);
+ if(len(sys.argv)>4):
+ stop=int(sys.argv[4],16);
+
+ print "Verifying code from %06x to %06x as %s." % (start,stop,f);
+ file = open(f, mode='rb')
+
+ i=start;
+ bytes=0;
+ while i<=stop:
+ data=client.SPIpeekblock(i);
+ print "Verified %06x." % i;
+ for j in data:
+ if i<stop:
+ #bits|=ord(file.read(1))^ord(j);
+ a=ord(file.read(1));
+ b=ord(j);
+ if a!=b:
+ print "%06x: %02x/%02x" % (i,a,b);
+ bytes+=1;
+ i+=1;
+ if bytes!=0:
+ print "%i bytes don't match." % bytes
+
+ file.close()
+