From: travisutk Date: Sun, 28 Feb 2010 02:35:52 +0000 (+0000) Subject: Dump to archive now a standard command. X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=139279cae9d6f011896550e265d4d676e460f47d;ds=sidebyside Dump to archive now a standard command. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@368 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/GoodFET.py b/client/GoodFET.py index 302e307..0f73e0f 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -282,10 +282,8 @@ class GoodFET: def erase(self): print "Erasure Unsupported."; def setup(self): - print "Unimplemented."; return; def start(self): - print "Unimplemented."; return; def test(self): print "Unimplemented."; @@ -305,6 +303,10 @@ class GoodFET: def flash(self,file): """Flash an intel hex file to code memory.""" print "Flash not implemented."; + def dump(self,file,start=0,stop=0xffff): + """Dump an intel hex file from code memory.""" + print "Dump not implemented."; + def peek32(self,address, memory="vn"): return (self.peek16(address,memory)+ (self.peek16(address+2,memory)<<16)); diff --git a/client/GoodFETCC.py b/client/GoodFETCC.py index f937ac9..6001a59 100644 --- a/client/GoodFETCC.py +++ b/client/GoodFETCC.py @@ -295,6 +295,18 @@ class GoodFETCC(GoodFET): (adr>>24)&0xFF]; print "Flashing buffer to 0x%06x" % adr; self.writecmd(self.APP,0x95,4,data); + def dump(self,file,start=0,stop=0xffff): + """Dump an intel hex file from code memory.""" + print "Dumping code from %04x to %04x as %s." % (start,stop,file); + h = IntelHex(None); + i=start; + while i<=stop: + h[i]=self.CCpeekcodebyte(i); + if(i%0x100==0): + print "Dumped %04x."%i; + h.write_hex_file(file); #buffer to disk. + i+=1; + h.write_hex_file(file); def flash(self,file): """Flash an intel hex file to code memory.""" diff --git a/client/GoodFETConsole.py b/client/GoodFETConsole.py index 751f580..ca23bb9 100644 --- a/client/GoodFETConsole.py +++ b/client/GoodFETConsole.py @@ -82,6 +82,9 @@ class GoodFETConsole(): def CMDflash(self,args): file=args[1]; self.client.flash(self.expandfilename(file)); + def CMDdump(self,args): + file=args[1]; + self.client.dump(self.expandfilename(file)); def CMDwhere(self,args): pc=self.client.getpc(); print "PC=0x%04X" % pc; diff --git a/client/goodfet.cc b/client/goodfet.cc index e0b0d12..7a07aac 100755 --- a/client/goodfet.cc +++ b/client/goodfet.cc @@ -10,7 +10,7 @@ import binascii; from GoodFETCC import GoodFETCC; from GoodFETConsole import GoodFETConsole; - +from intelhex import IntelHex; if(len(sys.argv)==1): print "Usage: %s verb [objects]\n" % sys.argv[0];