Closer to reliable AVR glitching.
[goodfet] / client / GoodFETCC.py
index e2f28e6..a515409 100644 (file)
@@ -50,10 +50,10 @@ class GoodFETCC(GoodFET):
         
         #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 +93,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]);
@@ -111,6 +116,13 @@ class GoodFETCC(GoodFET):
         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];
@@ -156,7 +168,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();
@@ -166,7 +178,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):