added fast packet sniffing option -x. doubles RX speed but could easily result in...
[goodfet] / client / goodfet.bsl
index 4267275..b51fce2 100755 (executable)
@@ -14,7 +14,7 @@
 # JTAG programmer.
 
 import sys, time, string, cStringIO, struct
-sys.path.append("/usr/lib/tinyos")
+#sys.path.append("/usr/lib/tinyos")  #We no longer require TinyOS.
 import serial, os, glob
 
 #forked from TinyOS Telos version.
@@ -1225,19 +1225,29 @@ class BootStrapLoader(LowLevel):
             raise BSLException, "programming without data not possible"
     def actionFromweb(self):
         """Grab GoodFET firmware from the web, then flash it."""
-        print "Grabbing %x firmware." % self.dev_id;
-        print "%s" % firmware[self.dev_id];
-        fn="/tmp/.goodfet.hex"
-        os.system("curl %s >%s" % (firmware[self.dev_id],fn))
+        print "Grabbing %x firmware." % self.dev_id;
+        print "%s" % firmware[self.dev_id];
+        fn="/tmp/.goodfet.hex"
+        os.system("curl %s >%s" % (firmware[self.dev_id],fn))
         
-        fw=Memory(fn);
-        #fw.loadIhex(open(fn,"rb"));
+        # fw=Memory(fn);
+        # #fw.loadIhex(open(fn,"rb"));
+        
+        # sys.stderr.write("Program ...\n")
+        # sys.stderr.flush()
+        # self.programData(fw, self.ACTION_PROGRAM | self.ACTION_VERIFY)
+        # sys.stderr.write("%i bytes programmed.\n" % self.byteCtr)
+        # sys.stderr.flush()
+        
+        
+        print """
+The --fromweb feature is temporarily disabled, pending a rewrite.
+Please grab a copy of the appropriate .hex from
+http://goodfet.sf.net/dist/ and flash it like so:
+
+goodfet.bsl -e -p foo.hex        
+"""
         
-        sys.stderr.write("Program ...\n")
-        sys.stderr.flush()
-        self.programData(fw, self.ACTION_PROGRAM | self.ACTION_VERIFY)
-        sys.stderr.write("%i bytes programmed.\n" % self.byteCtr)
-        sys.stderr.flush()
         
     def actionVerify(self):
         """Verify programmed data"""
@@ -1370,9 +1380,11 @@ General options:
                         --swap-reset-test, and --telos-latch
   --telosb              Implies options --swap-reset-test, --telos-i2c,
                         --no-BSL-download, and --speed=38400
+  --apimote             Implies --swap-reset-test
   --goodfet10
   --goodfet20
   --goodfet30
+  --goodthopter         Same as GF30.
   --tmote               Identical operation to --telosb
   --z1                  Bootstrap a Z1
   --no-BSL-download     Do not download replacement BSL (disable automatic)
@@ -1483,6 +1495,8 @@ def main(itest=1):
     if(os.environ.get("board")=='z1' or 
        os.environ.get("board")=='zolertiaz1'):
         bsl.z1 = 1
+    if(os.environ.get("board")=='apimote' or os.environ.get("board")=='apimote1'):
+        bsl.swapRSTTEST = 1;
     
     
     if comPort is None and os.environ.get("GOODFET")!=None:
@@ -1522,7 +1536,7 @@ def main(itest=1):
              "swap-reset-test", "telos-latch", "telos-i2c", "telos", "telosb",
              "tmote","no-BSL-download", "force-BSL-download", "slow",
              "dumpivt", "dumpinfo", "fromweb",
-             "goodfet40", "goodfet30", "goodfet20", "goodfet10",
+             "goodfet40", "goodfet30",  "goodthopter", "goodfet20", "goodfet10",
              "z1",
              "nhbadge", "nhbadgeb", "goodfet"
             ]
@@ -1671,7 +1685,7 @@ def main(itest=1):
         elif o in ("--goodfet20", ):
             bsl.invertRST = 1
             bsl.invertTEST = 1
-        elif o in ("--goodfet30", ):
+        elif o in ("--goodfet30", "--goodfet31", "--goodthopter" ):
             bsl.invertRST = 1
             bsl.invertTEST = 0
         elif o in ("--goodfet40", ):
@@ -1680,6 +1694,8 @@ def main(itest=1):
         elif o in ("--goodfet", ):
             bsl.invertRST = 1
             bsl.invertTEST = 1
+        elif o in ("--apimote",):
+            bsl.swapRSTTEST = 1;
         elif o in ("--nhbadge", "--nhbadgeb" ):
             bsl.invertRST = 1
             bsl.invertTEST = 1