X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFET.py;h=65fb46cce5a35170e660f25f95fb6ac7716b44ce;hp=53026dfe60c17c146f2b41fd2de17d82a75f93fd;hb=295146e3502f1b5f27e1e61b72eb8a82607f0213;hpb=042a155324ef5b76951e0194f61ab28c1c0521ce diff --git a/client/GoodFET.py b/client/GoodFET.py index 53026df..65fb46c 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -372,8 +372,17 @@ class GoodFET: def eeprompeek(self,address): """Read a word of memory from the monitor.""" return self.peekbyte(address)+(self.peekbyte(address+1)<<8); - - def pokebyte(self,address,value): + def peekbysym(self,name): + """Read a value by its symbol name.""" + #TODO include memory in symbol. + reg=self.symbols.get(name); + return self.peek8(reg,"data"); + def pokebysym(self,name,val): + """Write a value by its symbol name.""" + #TODO include memory in symbol. + reg=self.symbols.get(name); + return self.pokebyte(reg,val); + def pokebyte(self,address,value,memory="vn"): """Set a byte of memory by the monitor.""" self.data=[address&0xff,address>>8,value]; self.writecmd(0,0x03,3,self.data); @@ -469,6 +478,30 @@ class GoodFET: if self.verbose: print "Comm error recognized by monitorecho()."; return 0; return 1; + + def monitor_info(self): + print "GoodFET with %s MCU" % self.infostring(); + print "Clocked at %s" % self.monitorclocking(); + return 1; + + def monitor_list_apps(self, full=False): + self.monitor_info() + old_value = self.besilent + self.besilent = True # turn off automatic call to readcmd + self.writecmd(self.MONITORAPP, 0x82, 1, [int(full)]); + self.besilent = old_value + + # read the build date string + self.readcmd() + print "Build Date: %s" % self.data + print "Firmware apps:" + while True: + self.readcmd() + if self.count == 0: + break + print self.data + return 1; + def monitorclocking(self): """Return the 16-bit clocking value.""" return "0x%04x" % self.monitorgetclock(); @@ -535,6 +568,12 @@ class GoodFET: for foo in range(0,length): data[foo]=self.peek8(address+foo,memory); return data; + def pokeblock(self,address,bytes,memory="vn"): + """Poke a block of a data into memory at an address.""" + for foo in bytes: + self.pokebyte(address,foo,memory); + address=address+1; + return; def loadsymbols(self): """Load symbols from a file.""" return;