[Tinyos-2-commits] CVS: tinyos-2.x/tools/tinyos/misc tos-dump.py, NONE, 1.1 Makefile.am, 1.9, 1.10 tos-deluge, 1.16, 1.17

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Sun Dec 14 16:50:39 PST 2008


Update of /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23246/tools/tinyos/misc

Modified Files:
	Makefile.am tos-deluge 
Added Files:
	tos-dump.py 
Log Message:
Improvements to tos.py. 

This latest version includes:
  * support for MIB600
  * a generic dump program (tos-dump) that has support for decoding the
    printf packets
  * a few example programs for some of the applications (Oscilloscope,
    MultihopOscilloscope, TestFtsp, TestLocalTime).



--- NEW FILE: tos-dump.py ---
#!/usr/bin/env python

import sys
import tos

if '-h' in sys.argv:
    print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600"
    print "      ", sys.argv[0], "network at host:port"
    sys.exit()

am = tos.AM()

while True:
    p = am.read()
    if p:
	print p


Index: Makefile.am
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Makefile.am	18 Jun 2008 20:22:52 -0000	1.9
--- Makefile.am	15 Dec 2008 00:50:37 -0000	1.10
***************
*** 32,36 ****
  	      tos-storage-pxa27xp30	\
  	      tos-build-deluge-image \
! 	      tos-deluge
  
  bin_PROGRAMS = tos-serial-debug
--- 32,37 ----
  	      tos-storage-pxa27xp30	\
  	      tos-build-deluge-image \
! 	      tos-deluge \
! 	      tos-dump.py
  
  bin_PROGRAMS = tos-serial-debug

Index: tos-deluge
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-deluge,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** tos-deluge	25 Aug 2008 16:48:45 -0000	1.16
--- tos-deluge	15 Dec 2008 00:50:37 -0000	1.17
***************
*** 40,47 ****
  DM_AMID = 0x54
  SERIAL_DATA_LENGTH = 28 - 1 - 1 - 2 - 2
- BAUDRATES = {'micaz': 57600,
-              'telosb': 115200,
-              'iris': 57600,
- 	     'epic': 115200}
  
  # Commands for FlashManager
--- 40,43 ----
***************
*** 372,377 ****
  
  def print_usage():
!     print "Usage: %s <device_port> <baud_rate> <-p|-i|-r|-d|-e|-s> image_number [options]" % sys.argv[0]
!     print "  <baud_rate>      Either the platform name (micaz or telosv) or a baudrate value"
      print "  -p --ping        Provide status of the image in the external flash"
      print "  -i --inject      Inject a compiled TinyOS application"
--- 368,375 ----
  
  def print_usage():
!     print "Usage: %s <source> <-p|-i|-r|-d|-e|-s> image_number [options]" % sys.argv[0]
!     print "  <source> can be:"
!     print "     serial at PORT:SPEED   Serial ports"
!     print "     network at HOST:PORT   MIB600"
      print "  -p --ping        Provide status of the image in the external flash"
      print "  -i --inject      Inject a compiled TinyOS application"
***************
*** 392,396 ****
      # Checks for valid image number format
      try:
!         imgNum = int(sys.argv[4])
      except:
          print "ERROR: Image number is not valid"
--- 390,394 ----
      # Checks for valid image number format
      try:
!         imgNum = int(sys.argv[3])
      except:
          print "ERROR: Image number is not valid"
***************
*** 399,460 ****
  
  # ======== MAIN ======== #
! if len(sys.argv) >= 4:
! 
!     if sys.argv[2] in BAUDRATES:
!         baudrate = BAUDRATES[sys.argv[2]]
!     else:
!         try:
!             baudrate = int(sys.argv[2])
!         except:
!             print "ERROR: Wrong baudrate"
!             sys.exit(-1)
  
!     # Initializes serial port communication
!     try:
!         s = tos.Serial(sys.argv[1], baudrate, flush=True, debug=False)
!         am = tos.AM(s)
!     except:
!         print "ERROR: Unable to initialize serial port connection to", sys.argv[1]
!         sys.exit(-1)
  
-     # Check if the mote has the Deluge T2 basestation component:
      try:
          print "Checking if node is a Deluge T2 base station ..."
          ident(timeout=5)
!     except tos.TimeoutError:
          print "ERROR: Timeout. Is the node a Deluge T2 base station?"
          sys.exit(-1)
  
!     if sys.argv[3] in ["-p", "--ping"]:
          checkImgNum()
          print "Pinging node ..."
          ping(imgNum)
!     elif sys.argv[3] in ["-i", "--inject"] and len(sys.argv) == 6:
          checkImgNum()
          print "Pinging node ..."
!         inject(imgNum, sys.argv[5])
!     elif sys.argv[3] in ["-e", "--erase"]:
          checkImgNum()
          if erase(imgNum):
              print "Image number %d erased" % imgNum
!     elif sys.argv[3] in ["-b", "--boot"]:
          if boot():
              print "Command sent"
!     elif sys.argv[3] in ["-r", "--reprogram"]:
          checkImgNum()
          if reprogram(imgNum):
              print "Command sent"
!     elif sys.argv[3] in ["-d", "--disseminate"]:
          checkImgNum()
          if disseminate(imgNum):
              print "Command sent"
!     elif sys.argv[3] in ["-dr", "--disseminate-and-reboot"]:
          checkImgNum()
          if disseminateAndReboot(imgNum):
              print "Command sent"
!     elif sys.argv[3] in ["-s", "--stop"]:
          if stop():
              print "Command sent"
!     elif sys.argv[3] in ["-ls", "--local-stop"]:
          if localstop():
              print "Command sent"
--- 397,442 ----
  
  # ======== MAIN ======== #
! if len(sys.argv) >= 3:
  
!     am = tos.AM()
  
      try:
          print "Checking if node is a Deluge T2 base station ..."
          ident(timeout=5)
!     except tos.Timeout:
          print "ERROR: Timeout. Is the node a Deluge T2 base station?"
          sys.exit(-1)
  
!     if sys.argv[2] in ["-p", "--ping"]:
          checkImgNum()
          print "Pinging node ..."
          ping(imgNum)
!     elif sys.argv[2] in ["-i", "--inject"] and len(sys.argv) == 5:
          checkImgNum()
          print "Pinging node ..."
!         inject(imgNum, sys.argv[4])
!     elif sys.argv[2] in ["-e", "--erase"]:
          checkImgNum()
          if erase(imgNum):
              print "Image number %d erased" % imgNum
!     elif sys.argv[2] in ["-b", "--boot"]:
          if boot():
              print "Command sent"
!     elif sys.argv[2] in ["-r", "--reprogram"]:
          checkImgNum()
          if reprogram(imgNum):
              print "Command sent"
!     elif sys.argv[2] in ["-d", "--disseminate"]:
          checkImgNum()
          if disseminate(imgNum):
              print "Command sent"
!     elif sys.argv[2] in ["-dr", "--disseminate-and-reboot"]:
          checkImgNum()
          if disseminateAndReboot(imgNum):
              print "Command sent"
!     elif sys.argv[2] in ["-s", "--stop"]:
          if stop():
              print "Command sent"
!     elif sys.argv[2] in ["-ls", "--local-stop"]:
          if localstop():
              print "Command sent"



More information about the Tinyos-2-commits mailing list