SPI stuff, cleaned whitespace.
[goodfet] / client / goodfet.msp430
index f9c744c..d012728 100755 (executable)
@@ -27,15 +27,21 @@ client.MSP430setup();
 
 #Identify model number.
 client.MSP430start();
+client.MSP430haltcpu();
 #print "started"
 
 if(sys.argv[1]=="info"):
-    print "Model    %08x " % client.MSP430deviceid();
-    print "Core     %04x " % client.MSP430coreid();
-    print "Identity %04x" % client.MSP430ident();
-    print "Identifies as %s" % client.MSP430identstr();
+    #print "Model    %08x " % client.MSP430deviceid();
+    #print "Core     %04x " % client.MSP430coreid();
+    #print "Identity %04x" % client.MSP430ident();
+    print "Identifies as %s (%04x)" % (
+        client.MSP430identstr(),
+        client.MSP430ident());
 if(sys.argv[1]=="test"):
     client.MSP430test();
+if(sys.argv[1]=="glitch"):
+    for foo in range(0,100):
+        print "Identifies as %04x" % client.MSP430ident();
 if(sys.argv[1]=="dump"):
     f = sys.argv[2];
     start=0x0200;
@@ -50,7 +56,7 @@ if(sys.argv[1]=="dump"):
     h = IntelHex(None);
     i=start;
     while i<=stop:
-        data=client.MSP430peekblock(i,0x20);
+        data=client.MSP430peekblock(i);
         print "Dumped %06x."%i;
         for j in data:
             if i<=stop: h[i]=ord(j);
@@ -75,11 +81,13 @@ if(sys.argv[1]=="flash"):
     for i in h._buf.keys():
         #print "%04x: %04x"%(i,h[i>>1]);
         if(i>=start and i<stop  and i&1==0):
-            client.MSP430writeflash(i,h[i>>1]);
+            val=h[i>>1];
+            val2=client.MSP430pokeflash(i,val);
+            if(val!=val2):
+                print "Write error at %04x, %04x!=%04x." %(
+                    i, val, val2);
             if(i%0x100==0):
                 print "%04x" % i;
-if(sys.argv[1]=="flashtest"):
-    client.MSP430flashtest();
 if(sys.argv[1]=="verify"):
     f=sys.argv[2];
     start=0;
@@ -116,10 +124,10 @@ if(sys.argv[1]=="poke"):
         start=int(sys.argv[2],16);
     if(len(sys.argv)>3):
         val=int(sys.argv[3],16);
-    print "Poking %06x to become %02x." % (start,val);
+    print "Poking %06x to become %04x." % (start,val);
     
     while client.MSP430peek(start)!=val:
-        client.MSP430poke(start,val);
+        client.MSP430pokeflash(start,val);
         print "Poked to %04x" % client.MSP430peek(start);