[Tinyos-2-commits] CVS: tinyos-2.x/tools/tinyos/misc Makefile.am, 1.3, 1.4 tinyos.py, 1.1, 1.2 tos-deluge, 1.2, 1.3

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Fri Jun 1 17:09:18 PDT 2007


Update of /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19802/tools/tinyos/misc

Modified Files:
	Makefile.am tinyos.py tos-deluge 
Log Message:
Add support for MicaZ to Deluge T2.


Index: Makefile.am
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile.am	7 Nov 2006 19:30:43 -0000	1.3
--- Makefile.am	2 Jun 2007 00:09:15 -0000	1.4
***************
*** 25,30 ****
  	      tos-check-env \
  	      tos-storage-stm25p \
! 	      tos-storage-at45db
! 	      
  
  bin_PROGRAMS = tos-serial-debug
--- 25,34 ----
  	      tos-check-env \
  	      tos-storage-stm25p \
! 	      tos-storage-at45db \
! 	      tos-build-deluge-image \
! 	      tos-deluge
  
  bin_PROGRAMS = tos-serial-debug
+ 
+ pythondir = $(bindir)
+ python_DATA = tinyos.py

Index: tinyos.py
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tinyos.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tinyos.py	22 May 2007 20:34:20 -0000	1.1
--- tinyos.py	2 Jun 2007 00:09:15 -0000	1.2
***************
*** 24,27 ****
--- 24,31 ----
  # @author Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
  
+ ###############################################################################
+ # TinyOS 2 Python Serial Module
+ ###############################################################################
+ 
  class Serial:
      HDLC_FLAG_BYTE = 0x7e
***************
*** 37,46 ****
      SERIAL_PROTO_PACKET_NOACK = 69
      SERIAL_PROTO_PACKET_UNKNOWN = 255
!   
!     __s = None       # An instance of serial.Serial object
      __debug = False   # Debug mode
      
      def __init__(self, port, baudrate):
!        self.__s = serial.Serial(port, baudrate, rtscts=0, timeout=0.5)
      
      def __format_packet(self, packet):
--- 41,66 ----
      SERIAL_PROTO_PACKET_NOACK = 69
      SERIAL_PROTO_PACKET_UNKNOWN = 255
!     
!     __s = None        # An instance of serial.Serial object
      __debug = False   # Debug mode
      
+     __baud_rate = {}
+     
      def __init__(self, port, baudrate):
!         __baud_rate = {'telos': 115200, 'telosb': 115200, 
!                        'tmote': 115200, 'micaz': 57600, 
!                        'mica2': 57600, 'mica2dot': 19200, 
!                        'eyes': 115200, 'intelmote2': 115200}
!         
!         # Converts baud rate from platform name to value, if necessary
!         try:
!             int(baudrate)
!         except:
!             baudrate = __baud_rate.get(baudrate)
!         
!         if not baudrate == None:
!             self.__s = serial.Serial(port, baudrate, rtscts=0, timeout=0.5)
!         else:
!             raise ValueError, 'Invalid baud rate'
      
      def __format_packet(self, packet):
***************
*** 187,193 ****
                  else:
                      print "Timeout waiting for ACK... Retry"
!                         
          return False
      
      def set_debug(self, debug):
          self.__debug = debug
--- 207,214 ----
                  else:
                      print "Timeout waiting for ACK... Retry"
!                     
          return False
      
+     # Sets whether debugging message will in this module will be printed
      def set_debug(self, debug):
          self.__debug = debug

Index: tos-deluge
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-deluge,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tos-deluge	25 May 2007 17:38:08 -0000	1.2
--- tos-deluge	2 Jun 2007 00:09:15 -0000	1.3
***************
*** 29,33 ****
  # A command line utility to interact with nodes via a direct serial connection.
  # For the usage menu, please run this tool without any arguments. For example, 
! # "./tos-deluge.py"
  ###############################################################################
  
--- 29,33 ----
  # A command line utility to interact with nodes via a direct serial connection.
  # For the usage menu, please run this tool without any arguments. For example, 
! # "./tos-deluge"
  ###############################################################################
  
***************
*** 58,63 ****
  
  # Deluge-specific parameters
  DELUGE_MAX_PAGES       = 128
! DELUGE_METADATA_OFFSET = 0
  DELUGE_METADATA_SIZE   = 16
  DELUGE_IDENT_OFFSET    = 16 + (2 * DELUGE_MAX_PAGES)
--- 58,64 ----
  
  # Deluge-specific parameters
+ DELUGE_PLATFORMS       = ["telosb", "micaz"]   # Currently supported platforms
  DELUGE_MAX_PAGES       = 128
! DELUGE_METADATA_OFFSET = 0   # Location offset in the image
  DELUGE_METADATA_SIZE   = 16
  DELUGE_IDENT_OFFSET    = 16 + (2 * DELUGE_MAX_PAGES)
***************
*** 375,382 ****
        
  def print_usage():
!     print "Usage: %s <device> <-p|-i|-r|-d|-e|-s> image_number [options]" % sys.argv[0]
      print "  -p --ping\n     Provide status of the image in the external flash"
      print "  -i --inject\n     Inject a compiled TinyOS application"
!     print "      [options]: <tos_image.xml file path>"
      print "  -r --reboot\n     Reboot and reprogram the directly-connected mote"
      print "  -d --dissemination\n     Disseminate the image in the external flash to the network"
--- 376,390 ----
        
  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>\n     Either the platform name or the baud rate value"
!     print "      -------------------"
!     print "      | micaz  |  57600 |"
!     print "      ---------+---------"
!     print "      | telosb | 115200 |"
!     print "      -------------------"
!     print ""
      print "  -p --ping\n     Provide status of the image in the external flash"
      print "  -i --inject\n     Inject a compiled TinyOS application"
!     print "      [options]: tos_image.xml file path"
      print "  -r --reboot\n     Reboot and reprogram the directly-connected mote"
      print "  -d --dissemination\n     Disseminate the image in the external flash to the network"
***************
*** 385,421 ****
  
  # ======== MAIN ======== #
! num_req_arg = 4   # Minimum number of required arguments for this script
  if len(sys.argv) >= num_req_arg:
      try:
!         sys.argv[3] = int(sys.argv[3])
      except:
!         print "ERROR: Volume ID is not valid"
          os._exit(-1)
      
      # Initializes serial port communication
      try:
!         s = tinyos.Serial(sys.argv[1], 115200)
!         s.set_debug(False)   # Disables debug msg
      except:
!         print "ERROR: Unable to initialize serial port connection"
          os._exit(-1)
      
!     if sys.argv[2] in ["-p", "--ping"]:
          print "Pinging node ..."
!         op_ping(s, sys.argv[3]) 
!     elif sys.argv[2] in ["-i", "--inject"] and len(sys.argv) == (num_req_arg + 1):
          print "Pinging node ..."
!         op_inject(s, sys.argv[3], sys.argv[4])
!     elif sys.argv[2] in ["-r", "--reboot"]:
!         if op_reprog(s, sys.argv[3]):
              print "Command sent"
!     elif sys.argv[2] in ["-d", "--dissemination"]:
!         if op_diss(s, sys.argv[3]):
              print "Command sent"
!     elif sys.argv[2] in ["-e", "--erase"]:
!         if op_erase(s, sys.argv[3]):
!             print "Image number %d erased" % sys.argv[3]
!     elif sys.argv[2] in ["-s", "--reset"]:
!         if op_reset(s, sys.argv[3]):
              print "Successfully reset image versioning information"
      else:
--- 393,430 ----
  
  # ======== MAIN ======== #
! num_req_arg = 5   # Minimum number of required arguments for this script
  if len(sys.argv) >= num_req_arg:
+     # Checks for valid image number format
      try:
!         sys.argv[4] = int(sys.argv[4])
      except:
!         print "ERROR: Image number is not valid"
          os._exit(-1)
      
      # Initializes serial port communication
      try:
!         s = tinyos.Serial(sys.argv[1], sys.argv[2])
!         s.set_debug(False)
      except:
!         print "ERROR: Unable to initialize serial port connection to", sys.argv[1]
          os._exit(-1)
      
!     if sys.argv[3] in ["-p", "--ping"]:
          print "Pinging node ..."
!         op_ping(s, sys.argv[4]) 
!     elif sys.argv[3] in ["-i", "--inject"] and len(sys.argv) == (num_req_arg + 1):
          print "Pinging node ..."
!         op_inject(s, sys.argv[4], sys.argv[5])
!     elif sys.argv[3] in ["-r", "--reboot"]:
!         if op_reprog(s, sys.argv[4]):
              print "Command sent"
!     elif sys.argv[3] in ["-d", "--dissemination"]:
!         if op_diss(s, sys.argv[4]):
              print "Command sent"
!     elif sys.argv[3] in ["-e", "--erase"]:
!         if op_erase(s, sys.argv[4]):
!             print "Image number %d erased" % sys.argv[4]
!     elif sys.argv[3] in ["-s", "--reset"]:
!         if op_reset(s, sys.argv[4]):
              print "Successfully reset image versioning information"
      else:



More information about the Tinyos-2-commits mailing list