X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFET.py;h=1ee0ed9880f9a5f3b45c18f906cefea97bd9d0d4;hp=05c20458d2552c4891a8141630faf362da9a7ac1;hb=165be2e37f8ea460b4654cc0e16e6d8a51da22f4;hpb=0c3db8ce9f40190ec063347e21ed382d5486cb67 diff --git a/client/GoodFET.py b/client/GoodFET.py index 05c2045..1ee0ed9 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -140,6 +140,7 @@ class GoodFET: """Open the serial port""" # Make timeout None to wait forever, 0 for non-blocking mode. import serial; + fixserial=False; if os.name=='nt' and sys.version.find('64 bit')!=-1: print "WARNING: PySerial requires a 32-bit Python build in Windows."; @@ -194,8 +195,9 @@ class GoodFET: #print "'%s'!=\n'%s'" % (self.data,"http://goodfet.sf.net/"); if attemptlimit is not None and attempts >= attemptlimit: return - elif attempts>2: - print "Resyncing. See the GoodFET FAQ about missing info flash."; + elif attempts==2: + print "See the GoodFET FAQ about missing info flash."; + self.serialport.setTimeout(0.2); #self.serialport.flushInput() #self.serialport.flushOutput() @@ -205,7 +207,7 @@ class GoodFET: self.telosBReset(); elif (os.environ.get("board")=='zolertiaz1' or os.environ.get("board")=='z1'): self.bslResetZ1(invokeBSL=0); - elif (os.environ.get("board")=='apimote1'): + elif (os.environ.get("board")=='apimote1') or (os.environ.get("board")=='apimote'): #Explicitly set RTS and DTR to halt board. self.serialport.setRTS(1); self.serialport.setDTR(1); @@ -245,8 +247,8 @@ class GoodFET: if self.verbose: print "Comm error on %i try, resyncing out of %s." % (foo, clocking); - connected=0; - break; + connected=0; + break; if self.verbose: print "Connected after %02i attempts." % attempts; self.mon_connected(); self.serialport.setTimeout(12); @@ -573,6 +575,9 @@ class GoodFET: self.writecmd(0,0x03,3,self.data); return ord(self.data[0]); def poke16(self,address,value): + """Set a word of memory by the monitor.""" + self.MONpoke16(address,value); + def MONpoke16(self,address,value): """Set a word of memory by the monitor.""" self.pokebyte(address,value&0xFF); self.pokebyte(address,(value>>8)&0xFF); @@ -666,7 +671,8 @@ class GoodFET: data="The quick brown fox jumped over the lazy dog."; self.writecmd(self.MONITORAPP,0x81,len(data),data); if self.data!=data: - print "Comm error recognized by monitorecho(), got:\n%s" % self.data; + if self.verbose: + print "Comm error recognized by monitorecho(), got:\n%s" % self.data; return 0; return 1;