Moving glitcher away from AVR-specific calls.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Thu, 24 Jun 2010 21:34:17 +0000 (21:34 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Thu, 24 Jun 2010 21:34:17 +0000 (21:34 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@639 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFET.py
client/GoodFETGlitch.py

index 3033093..154bd38 100755 (executable)
@@ -366,11 +366,23 @@ class GoodFET:
     def peek(self,address):
         """Read a word of memory from the monitor."""
         return self.peekbyte(address)+(self.peekbyte(address+1)<<8);
+    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):
         """Set a byte of memory by the monitor."""
         self.data=[address&0xff,address>>8,value];
         self.writecmd(0,0x03,3,self.data);
         return ord(self.data[0]);
+    def setsecret(self,value):
+        """Set a secret word for later retreival.  Used by glitcher."""
+        self.eeprompoke(0,value);
+        self.eeprompoke(1,value);
+    def getsecret(self):
+        """Get a secret word.  Used by glitcher."""
+        self.eeprompeek(0);
+    
     def dumpmem(self,begin,end):
         i=begin;
         while i<end:
index 56f3075..0d49ac3 100644 (file)
@@ -209,14 +209,13 @@ class GoodFETGlitch(GoodFET):
         
         self.secret=0x69;
         
-        while(client.eeprompeek(0)!=self.secret):
+        while(client.getsecret()!=self.secret):
             print "-- Setting secret";
             client.start();
             
             #Flash the secret to the first two bytes of CODE memory.
             client.erase();
-            client.eeprompoke(0,self.secret);
-            client.eeprompoke(1,self.secret);
+            client.setsecret(self.secret);
             sys.stdout.flush()
 
         #Lock chip to unlock it later.
@@ -265,7 +264,7 @@ class GoodFETGlitch(GoodFET):
             client.glitchstart();
             
             #Try to read *0, which is secret if read works.
-            a=client.eeprompeek(0x0);
+            a=client.getsecret();
             if lock>0: #locked
                 if(a!=0 and a!=0xFF and a!=self.secret):
                     gcount+=1;