projects
/
goodfet
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
I2C master app and client. Impressively ugly. Might work occasionally.
[goodfet]
/
client
/
goodfet.spiflash
diff --git
a/client/goodfet.spiflash
b/client/goodfet.spiflash
index
55a7b12
..
dcdc68b
100755
(executable)
--- a/
client/goodfet.spiflash
+++ b/
client/goodfet.spiflash
@@
-111,16
+111,21
@@
if(sys.argv[1]=="verify"):
file = open(f, mode='rb')
i=start;
file = open(f, mode='rb')
i=start;
- b
it
s=0;
+ b
yte
s=0;
while i<=stop:
while i<=stop:
- data=client.SPIpeekblock(i
,255
);
+ data=client.SPIpeekblock(i);
print "Verified %06x." % i;
for j in data:
if i<stop:
print "Verified %06x." % i;
for j in data:
if i<stop:
- bits|=ord(file.read(1))^ord(j);
+ #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;
i+=1;
- if b
it
s!=0:
- print "
Bits don't match."
+ if b
yte
s!=0:
+ print "
%i bytes don't match." % bytes
file.close()
file.close()
@@
-135,15
+140,13
@@
if(sys.argv[1]=="flash"):
stop=int(sys.argv[4],16);
print "Flashing code from %06x to %06x with %s." % (start,stop,f);
stop=int(sys.argv[4],16);
print "Flashing code from %06x to %06x with %s." % (start,stop,f);
+ print "FIXME This might fail if the file is of an odd size.";
file = open(f, mode='rb')
i=start;
chars=list(file.read());
file = open(f, mode='rb')
i=start;
chars=list(file.read());
-
- #N.B., chunksize must be an even fraction of 0x100.
chunksize=0x100;
chunksize=0x100;
- #client.silent(1);
while i<=stop:
bytes=range(0,chunksize);
for j in range(0,chunksize):
while i<=stop:
bytes=range(0,chunksize);
for j in range(0,chunksize):
@@
-153,8
+156,8
@@
if(sys.argv[1]=="flash"):
i+=chunksize;
if(i%0x1000==0):
print "Flashed %06x."%i;
i+=chunksize;
if(i%0x1000==0):
print "Flashed %06x."%i;
- print "Done, ending silence.";
- #client.silent(0);
+
+
file.close()
file.close()