X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2Fgoodfet.spiflash;h=354d5025444ee52f790b6377600fc0ab758b4e8f;hp=a04ed19f4bbc888c2951b3e260f0c0e8d7b8f050;hb=c6e02600ef0e12eb9a7309755740a23b71a62205;hpb=d0d48d9cdb77bee064236d148002f98f3c247121 diff --git a/client/goodfet.spiflash b/client/goodfet.spiflash index a04ed19..354d502 100755 --- a/client/goodfet.spiflash +++ b/client/goodfet.spiflash @@ -28,8 +28,13 @@ if(len(sys.argv)==1): client=GoodFET(); client.serInit("/dev/ttyUSB0") + client.SPIsetup(); +#Dummy read. +#Might read as all ones if chip has a startup delay. +client.SPIjedec(); + if(sys.argv[1]=="test"): result=""; dropped=0; @@ -93,11 +98,17 @@ if(sys.argv[1]=="flash"): file = open(f, mode='rb') i=start; - bytes=file.read(); + chars=list(file.read()); + chunksize=0x80; + while i<=stop: - client.SPIpokebyte(i,ord(bytes[i])); + bytes=range(0,chunksize); + for j in range(0,chunksize): + bytes[j]=ord(chars[i+j]); + #client.SPIpokebyte(i,ord(chars[i])); + client.SPIpokebytes(i,bytes); - i+=1; + i+=chunksize; if(i%0x100==0): print "Flashed %06x."%i; file.close()