X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2Fgoodfet.msp430;h=9fcb68f3c6239f94f0bebef538af568938530b6a;hp=3140e138fdf6c1d1bfe098a30dbf59a17fbf6160;hb=1c1abaa53f950a77dd7e71b2b354e3de0046313b;hpb=fa5713a93ff59ebdd126f5b7914a96b5030b32fb diff --git a/client/goodfet.msp430 b/client/goodfet.msp430 index 3140e13..9fcb68f 100755 --- a/client/goodfet.msp430 +++ b/client/goodfet.msp430 @@ -39,6 +39,9 @@ if(sys.argv[1]=="info"): 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; @@ -53,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); @@ -74,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;