From de633a9731ff7181ba4ef8afa288e57b5456598d Mon Sep 17 00:00:00 2001 From: travisutk Date: Sat, 3 Oct 2009 01:05:20 +0000 Subject: [PATCH] Silent support, corrected spiflash docco. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@164 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFET.py | 23 +++++++++++++++++++++-- client/goodfet.spiflash | 9 ++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/client/GoodFET.py b/client/GoodFET.py index abfc16e..43c0ca6 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -47,6 +47,9 @@ class GoodFET: if(self.verb!=0x7F): print "Verb %02x is wrong. Incorrect firmware?" % self.verb; #print "Connected." + def getbuffer(self,size=0x1c00): + writecmd(0,0xC2,[size&0xFF,(size>>16)&&0xFF]); + print "Got %02x%02x buffer size." % (self.data[1],self.data[0]); def writecmd(self, app, verb, count=0, data=[], blocks=1): """Write a command and some data to the GoodFET.""" self.serialport.write(chr(app)); @@ -57,7 +60,17 @@ class GoodFET: for d in data: self.serialport.write(chr(d)); - self.readcmd(blocks); #Uncomment this later, to ensure a response. + if not self.besilent: + #print "Reading reply to %02x/%02x." % (app,verb); + self.readcmd(blocks); + #print "Read reply." + + besilent=0; + app=0; + verb=0; + count=0; + data=""; + def readcmd(self,blocks=1): """Read a reply from the GoodFET.""" while 1: @@ -72,8 +85,14 @@ class GoodFET: print "DEBUG %s" % self.data; else: return self.data; - + #Monitor stuff + def silent(self,s=0): + """Transmissions halted when 1.""" + self.besilent=s; + print "besilent is %i" % self.besilent; + self.writecmd(0,0xB0,1,[s]); + def out(self,byte): """Write a byte to P5OUT.""" self.writecmd(0,0xA1,1,[byte]); diff --git a/client/goodfet.spiflash b/client/goodfet.spiflash index 1005617..88635b0 100755 --- a/client/goodfet.spiflash +++ b/client/goodfet.spiflash @@ -16,10 +16,10 @@ from intelhex import IntelHex; if(len(sys.argv)==1): print "Usage: %s verb [objects]\n" % sys.argv[0]; print "%s info" % sys.argv[0]; - print "%s dump $foo.hex [0x$start 0x$stop]" % sys.argv[0]; + print "%s dump $foo.rom [0x$start 0x$stop]" % sys.argv[0]; print "%s erase" % sys.argv[0]; - print "%s flash $foo.hex [0x$start 0x$stop]" % sys.argv[0]; - print "%s verify $foo.hex [0x$start 0x$stop]" % sys.argv[0]; + print "%s flash $foo.rom [0x$start 0x$stop]" % sys.argv[0]; + print "%s verify $foo.rom [0x$start 0x$stop]" % sys.argv[0]; print "%s peek 0x$start [0x$stop]" % sys.argv[0]; print "%s poke 0x$adr 0x$val" % sys.argv[0]; sys.exit(); @@ -130,6 +130,7 @@ if(sys.argv[1]=="flash"): #N.B., chunksize must be an even fraction of 0x100. chunksize=0x80; + #client.silent(1); while i<=stop: bytes=range(0,chunksize); for j in range(0,chunksize): @@ -139,6 +140,8 @@ if(sys.argv[1]=="flash"): i+=chunksize; if(i%0x1000==0): print "Flashed %06x."%i; + print "Done, ending silence."; + #client.silent(0); file.close() -- 2.20.1