From 0176d144154fc807d65ba0e9276ccdc2e86dd039 Mon Sep 17 00:00:00 2001 From: travisutk Date: Mon, 8 Mar 2010 00:47:32 +0000 Subject: [PATCH] MSP430 console. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@397 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETConsole.py | 17 +++++++++++++++++ client/GoodFETMSP430.py | 13 ++++++++++--- client/goodfet.msp430 | 6 +++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/client/GoodFETConsole.py b/client/GoodFETConsole.py index fa40031..5f1a436 100644 --- a/client/GoodFETConsole.py +++ b/client/GoodFETConsole.py @@ -11,6 +11,23 @@ import binascii; 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.""" diff --git a/client/GoodFETMSP430.py b/client/GoodFETMSP430.py index 4551433..bb20bfe 100644 --- a/client/GoodFETMSP430.py +++ b/client/GoodFETMSP430.py @@ -10,12 +10,13 @@ import sys, time, string, cStringIO, struct, glob, serial, os; from GoodFET import GoodFET; class GoodFETMSP430(GoodFET): + APP=0x11; 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); @@ -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; + 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, @@ -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); - 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; - + self.MSP430haltcpu(); def MSP430haltcpu(self): """Halt the CPU.""" self.writecmd(self.MSP430APP,0xA0,0,self.data); diff --git a/client/goodfet.msp430 b/client/goodfet.msp430 index cf0e9bc..c5413c5 100755 --- a/client/goodfet.msp430 +++ b/client/goodfet.msp430 @@ -24,12 +24,12 @@ client=GoodFETMSP430(); client.serInit() #Connect to target -client.MSP430setup(); +client.setup(); #print "setup" #Identify model number. -client.MSP430start(); -client.MSP430haltcpu(); +client.start(); + #print "started" if(sys.argv[1]=="info"): -- 2.20.1