X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETCC.py;h=093709d589c737a4e6e91a07aade22d9db1b4e10;hp=d5208bd2dccf01f0f90430465fad8589ee86f8b1;hb=c8bfdc4d07ad8331f3ca1db80185637b455ddf1b;hpb=f1803b3ed1a5bd2673fb14c1f023940355cb4254 diff --git a/client/GoodFETCC.py b/client/GoodFETCC.py index d5208bd..093709d 100644 --- a/client/GoodFETCC.py +++ b/client/GoodFETCC.py @@ -47,13 +47,18 @@ class GoodFETCC(GoodFET): if(pc!=self.CCgetPC()): print "ERROR: PC changed during CCdebuginstr([NOP])!"; + print "Checking pokes to XRAM." + for i in range(0xf000,0xf020): + self.CCpokedatabyte(i,0xde); + if(self.CCpeekdatabyte(i)!=0xde): + print "Error in XDATA at 0x%04x" % i; #print "Status: %s." % self.CCstatusstr(); #Exit debugger - self.CCstop(); + self.stop(); print "Done."; - def CCsetup(self): + def setup(self): """Move the FET into the CC2430/CC2530 application.""" #print "Initializing Chipcon."; self.writecmd(0x30,0x10,0,self.data); @@ -93,6 +98,11 @@ class GoodFETCC(GoodFET): hi=ord(self.data[0]); lo=ord(self.data[1]); return (hi<<8)+lo; + def CCcmd(self,phrase): + self.writecmd(0x30,0x00,len(phrase),phrase); + val=ord(self.data[0]); + print "Got %02x" % val; + return val; def CCdebuginstr(self,instr): self.writecmd(0x30,0x88,len(instr),instr); return ord(self.data[0]); @@ -106,6 +116,24 @@ class GoodFETCC(GoodFET): self.data=[adr&0xff, (adr&0xff00)>>8]; self.writecmd(0x30,0x91, 2, self.data); return ord(self.data[0]); + def CCpeekirambyte(self,adr): + """Read the contents of IRAM at an address.""" + self.data=[adr&0xff]; + self.writecmd(0x30,0x02, 1, self.data); + return ord(self.data[0]); + def CCpeekiramword(self,adr): + """Read the little-endian contents of IRAM at an address.""" + return self.CCpeekirambyte(adr)+( + self.CCpeekirambyte(adr+1)<<8); + def CCpokeiramword(self,adr,val): + self.CCpokeirambyte(adr,val&0xff); + self.CCpokeirambyte(adr+1,(val>>8)&0xff); + def CCpokeirambyte(self,adr,val): + """Write the contents of IRAM at an address.""" + self.data=[adr&0xff, val&0xff]; + self.writecmd(0x30,0x02, 2, self.data); + return ord(self.data[0]); + def CCpokedatabyte(self,adr,val): """Write a byte to data memory.""" self.data=[adr&0xff, (adr&0xff00)>>8, val]; @@ -145,7 +173,7 @@ class GoodFETCC(GoodFET): str="%s %s" %(self.CCstatusbits[i],str); i*=2; return str; - def CCstart(self): + def start(self): """Start debugging.""" self.writecmd(0x30,0x20,0,self.data); ident=self.CCidentstr(); @@ -155,7 +183,7 @@ class GoodFETCC(GoodFET): self.CChaltcpu(); #print "Status: %s." % self.CCstatusstr(); - def CCstop(self): + def stop(self): """Stop debugging.""" self.writecmd(0x30,0x21,0,self.data); def CCstep_instr(self):