MSP430 console.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Mon, 8 Mar 2010 00:47:32 +0000 (00:47 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Mon, 8 Mar 2010 00:47:32 +0000 (00:47 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@397 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFETConsole.py
client/GoodFETMSP430.py
client/goodfet.msp430

index fa40031..5f1a436 100644 (file)
@@ -11,6 +11,23 @@ import binascii;
 from GoodFET import GoodFET;
 from intelhex import IntelHex;
 
 from GoodFET import GoodFET;
 from intelhex import IntelHex;
 
+
+#grep CMD GoodFETConsole.py | grep def | sed s/\(sel.\*// | sed 's/def CMD//'
+commands="""
+    info
+    lock
+    erase
+    test
+    status
+    halt
+    resume
+    peek
+    flash
+    dump
+    where
+    chip
+"""
+
 class GoodFETConsole():
     """An interactive goodfet driver."""
     
 class GoodFETConsole():
     """An interactive goodfet driver."""
     
index 4551433..bb20bfe 100644 (file)
@@ -10,12 +10,13 @@ import sys, time, string, cStringIO, struct, glob, serial, os;
 from GoodFET import GoodFET;
 
 class GoodFETMSP430(GoodFET):
 from GoodFET import GoodFET;
 
 class GoodFETMSP430(GoodFET):
+    APP=0x11;
     MSP430APP=0x11;  #Changed by inheritors.
     CoreID=0;
     DeviceID=0;
     JTAGID=0;
     MSP430ident=0;
     MSP430APP=0x11;  #Changed by inheritors.
     CoreID=0;
     DeviceID=0;
     JTAGID=0;
     MSP430ident=0;
-    def MSP430setup(self):
+    def setup(self):
         """Move the FET into the MSP430 JTAG application."""
         self.writecmd(self.MSP430APP,0x10,0,None);
         
         """Move the FET into the MSP430 JTAG application."""
         self.writecmd(self.MSP430APP,0x10,0,None);
         
@@ -35,6 +36,12 @@ class GoodFETMSP430(GoodFET):
             ord(self.data[0])+(ord(self.data[1])<<8)+
             (ord(self.data[2])<<16)+(ord(self.data[3])<<24));
         return DeviceID;
             ord(self.data[0])+(ord(self.data[1])<<8)+
             (ord(self.data[2])<<16)+(ord(self.data[3])<<24));
         return DeviceID;
+    def peek16(self,adr,memory="vn"):
+        return self.MSP430peek(adr);
+    def peek8(self,address, memory="vn"):
+        adr=self.MSP430peek(adr&~1);
+        if adr&1==0: return adr&0xFF;
+        else: return adr>>8;
     def MSP430peek(self,adr):
         """Read a word at an address."""
         self.data=[adr&0xff, (adr&0xff00)>>8,
     def MSP430peek(self,adr):
         """Read a word at an address."""
         self.data=[adr&0xff, (adr&0xff00)>>8,
@@ -73,14 +80,14 @@ class GoodFETMSP430(GoodFET):
         #print "%2x %2x %2x %2x ..." % (data[0], data[1], data[2], data[3]);
         self.writecmd(self.MSP430APP,0xE1,len(self.data),self.data);
         return ord(self.data[0])+(ord(self.data[1])<<8);
         #print "%2x %2x %2x %2x ..." % (data[0], data[1], data[2], data[3]);
         self.writecmd(self.MSP430APP,0xE1,len(self.data),self.data);
         return ord(self.data[0])+(ord(self.data[1])<<8);
-    def MSP430start(self):
+    def start(self):
         """Start debugging."""
         self.writecmd(self.MSP430APP,0x20,0,self.data);
         self.JTAGID=ord(self.data[0]);
         #print "Identified as %02x." % self.JTAGID;
         if(not (self.JTAGID==0x89 or self.JTAGID==0x91)):
             print "Error, misidentified as %02x." % self.JTAGID;
         """Start debugging."""
         self.writecmd(self.MSP430APP,0x20,0,self.data);
         self.JTAGID=ord(self.data[0]);
         #print "Identified as %02x." % self.JTAGID;
         if(not (self.JTAGID==0x89 or self.JTAGID==0x91)):
             print "Error, misidentified as %02x." % self.JTAGID;
-        
+        self.MSP430haltcpu();
     def MSP430haltcpu(self):
         """Halt the CPU."""
         self.writecmd(self.MSP430APP,0xA0,0,self.data);
     def MSP430haltcpu(self):
         """Halt the CPU."""
         self.writecmd(self.MSP430APP,0xA0,0,self.data);
index cf0e9bc..c5413c5 100755 (executable)
@@ -24,12 +24,12 @@ client=GoodFETMSP430();
 client.serInit()
 
 #Connect to target
 client.serInit()
 
 #Connect to target
-client.MSP430setup();
+client.setup();
 #print "setup"
 
 #Identify model number.
 #print "setup"
 
 #Identify model number.
-client.MSP430start();
-client.MSP430haltcpu();
+client.start();
+
 #print "started"
 
 if(sys.argv[1]=="info"):
 #print "started"
 
 if(sys.argv[1]=="info"):