JTAGARM7 is back up and running, folks! Tested Halt/Release, Get/Set Registers,...
[goodfet] / client / goodfet.msp430
index f204081..b606edc 100755 (executable)
@@ -10,6 +10,7 @@ from intelhex import IntelHex16bit, IntelHex;
 if(len(sys.argv)==1):
     print "Usage: %s verb [objects]\n" % sys.argv[0];
     print "%s test" % sys.argv[0];
+    print "%s selftest" % sys.argv[0];
     print "%s dump $foo.hex [0x$start 0x$stop]" % sys.argv[0];
     print "%s erase" % sys.argv[0];
     print "%s eraseinfo" % sys.argv[0];
@@ -25,13 +26,12 @@ if(len(sys.argv)==1):
 client=GoodFETMSP430();
 client.serInit()
 
-#Connect to target
 client.setup();
-#print "setup"
-
-#Identify model number.
 client.start();
 
+if(sys.argv[1]=="starttest"):
+    for foo in range(1,10):
+        client.start();
 if(sys.argv[1]=="info"):
     #print "Model    %08x " % client.MSP430deviceid();
     #print "Core     %04x " % client.MSP430coreid();
@@ -71,9 +71,41 @@ if(sys.argv[1]=="eraseinfo"):
     print "Erasing info memory."
     client.MSP430infoerase();
 
-
+if(sys.argv[1]=="selftest"):
+    import time;
+    
+    entry=client.peek16(0xFFC0);
+    print "Calling self-test at 0x%04x." %entry;
+    print "Memory from 0x3020 to 0x3030 should be zeroed.";
+    
+    for i in range(0x3020,0x3030):
+        client.MSP430poke(i,0xFFFF);
+    client.MSP430setPC(entry);
+    time.sleep(5);
+    errors=0;
+    
+    if(client.peek8(0x302F)==0xFF):
+        print "Test not run.  Try again.";
+        exit(0);
+    
+    for i in range(0x3020,0x3030,2):
+        ret=client.peek16(i);
+        if ret!=0:
+            errors=errors+1;
+            print "Failure at 0x%04x, returned %02xh." % (i,ret);
+        
+    if errors==0:
+        print "Test succeeded.  Board is ready to ship."
+    else:
+        print "Test failed.  Is it soldered correctly?"
+    #client.MSP430dumpmem(0x3020,0x3030);
+    
 if(sys.argv[1]=="ivt"):
-    client.MSP430dumpmem(0xFFE0,0xFFFF);
+    client.MSP430dumpmem(0xFFC0,0xFFFF);
+if(sys.argv[1]=="regs"):
+    for i in range(0,16):
+        print "r%i=%04x" % (i,client.MSP430getreg(i));
+
 if(sys.argv[1]=="flash"):
     f=sys.argv[2];
     start=0;
@@ -151,15 +183,17 @@ if(sys.argv[1]=="poke"):
     print "Poking %06x to become %04x." % (start,val);
     
     while client.MSP430peek(start)&(~val)>0:
-        client.MSP430pokeflashblock(start,[val&0xFF, (val>>8)&0xFF]);
+        client.MSP430pokeflash(start,val);
         print "Poked to %04x" % client.MSP430peek(start);
 if(sys.argv[1]=="serial"):
     oid=0xdeadbeef;
     if(len(sys.argv)>2):
         oid=eval(sys.argv[2]);
     else:
-        simpchin=u=unichr(24207)+unichr(21015)+unichr(21495)
-        print simpchin;
+        #Crashes Windows.
+        #simpchin=u=unichr(24207)+unichr(21015)+unichr(21495);  #Chinese for "Serial Number".
+        #print simpchin;
+        
         oid=input(u"Serial Number? ");
     adr=0xFFB0;
     if(len(sys.argv)>2):