X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2Fgoodfet.msp430;h=9fcb68f3c6239f94f0bebef538af568938530b6a;hp=1e1b8b959d65594832bb38f39e7bb2e0eb5b4d8e;hb=6648c78f1f6eca1ff5bc477d10b12c2125f31285;hpb=1283fdb830f9ecd0e27e10ef66927562aff674a7 diff --git a/client/goodfet.msp430 b/client/goodfet.msp430 index 1e1b8b9..9fcb68f 100755 --- a/client/goodfet.msp430 +++ b/client/goodfet.msp430 @@ -27,14 +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 "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; @@ -49,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); @@ -70,15 +77,37 @@ if(sys.argv[1]=="flash"): h = IntelHex16bit(f); + #Should this be default? + #Makes flashing multiple images inconvenient. client.MSP430masserase(); + + count=0; #Bytes in commit. + first=0; + vals=[]; + last=0; #Last address committed. for i in h._buf.keys(): - #print "%04x: %04x"%(i,h[i>>1]); + if((count>0x40 or last+2!=i) and count>0 and i&1==0): + #print "%i, %x, %x" % (len(vals), last, i); + client.MSP430pokeflashblock(first,vals); + count=0; + first=0; + last=0; + vals=[]; if(i>=start and i>1]); + val=h[i>>1]; + if(count==0): + first=i; + last=i; + count+=2; + #val2=client.MSP430pokeflash(i,val); + #if(val!=val2): + # print "Write error at %04x, %04x!=%04x." %( + # i, val, val2); + vals+=[val&0xff,(val&0xff00)>>8]; if(i%0x100==0): print "%04x" % i; -if(sys.argv[1]=="flashtest"): - client.MSP430flashtest(); + if count>0: #last commit, ivt + client.MSP430pokeflashblock(first,vals); if(sys.argv[1]=="verify"): f=sys.argv[2]; start=0; @@ -107,6 +136,7 @@ if(sys.argv[1]=="peek"): while start<=stop: print "%04x: %04x" % (start,client.MSP430peek(start)); start=start+2; + if(sys.argv[1]=="poke"): start=0x0000; val=0x00; @@ -114,10 +144,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);