X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2Fgoodfet.cc;h=eb5ffa63a994ae94d34e5447be1a909d5cf50288;hp=10442b1852fc160f1f3d00d20dbb974f0e2dd062;hb=1c58df5f46dc4550684ed9227732e880d2023791;hpb=7544a1e347bc72edc26e6e4e7b9eec059c3324e3 diff --git a/client/goodfet.cc b/client/goodfet.cc index 10442b1..eb5ffa6 100755 --- a/client/goodfet.cc +++ b/client/goodfet.cc @@ -1,9 +1,14 @@ #!/usr/bin/env python +# GoodFET Chipcon Example +# +# (C) 2009 Travis Goodspeed +# +# This code is being rewritten and refactored. You've been warned! import sys; import binascii; -from GoodFET import GoodFET; +from GoodFETCC import GoodFETCC; from intelhex import IntelHex; @@ -22,8 +27,8 @@ if(len(sys.argv)==1): sys.exit(); #Initailize FET and set baud rate -client=GoodFET(); -client.serInit("/dev/ttyUSB0") +client=GoodFETCC(); +client.serInit() #Connect to target client.CCsetup(); @@ -31,6 +36,9 @@ client.CCstart(); if(sys.argv[1]=="test"): client.CCtest(); +if(sys.argv[1]=="deadtest"): + for i in range(1,10): + print "IDENT as %s" % client.CCidentstr(); if(sys.argv[1]=="dumpcode"): f = sys.argv[2]; start=0x0000; @@ -44,7 +52,7 @@ if(sys.argv[1]=="dumpcode"): h = IntelHex(None); i=start; while i<=stop: - h[i>>1]=client.CCpeekcodebyte(i); + h[i]=client.CCpeekcodebyte(i); if(i%0x100==0): print "Dumped %04x."%i; i+=1; @@ -67,10 +75,12 @@ if(sys.argv[1]=="dumpdata"): print "Dumped %04x."%i; i+=1; h.write_hex_file(f); +if(sys.argv[1]=="status"): + print "Status: %s" %client.CCstatusstr(); if(sys.argv[1]=="erase"): - print "Status: %s" % client.CCstatusstr(); - client.CCchiperase(); - print "Status: %s" %client.CCstatusstr(); + print "Status: %s" % client.CCstatusstr(); + client.CCchiperase(); + print "Status: %s" %client.CCstatusstr(); # if(sys.argv[1]=="flash"): # f=sys.argv[2]; @@ -83,11 +93,11 @@ if(sys.argv[1]=="erase"): # h = IntelHex(f); -# client.MSP430masserase(); +# client.CCchiperase(); # 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]); +# client.CCwriteflash(i,h[i>>1]); # if(i%0x100==0): # print "%04x" % i; if(sys.argv[1]=="writedata"): @@ -106,8 +116,8 @@ if(sys.argv[1]=="writedata"): client.CCpokedatabyte(i,h[i]); if(i%0x100==0): print "%04x" % i; -if(sys.argv[1]=="flashtest"): - client.MSP430flashtest(); +#if(sys.argv[1]=="flashtest"): +# client.CCflashtest(); if(sys.argv[1]=="peekdata"): start=0x0000; if(len(sys.argv)>2):