]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Add checks for the image format from tos_image.xml (problem reported by Jonathan...
authorrazvanm <razvanm>
Mon, 16 Jul 2007 22:11:02 +0000 (22:11 +0000)
committerrazvanm <razvanm>
Mon, 16 Jul 2007 22:11:02 +0000 (22:11 +0000)
tools/tinyos/misc/Makefile.am
tools/tinyos/misc/tinyos.py
tools/tinyos/misc/tos-build-deluge-image
tools/tinyos/misc/tos-build-deluge-image.1 [new file with mode: 0644]
tools/tinyos/misc/tos-deluge
tools/tinyos/misc/tos-deluge.1 [new file with mode: 0644]

index 61303b5b05b6c0d314ea6d6109d8c57f99ac461f..6c2ee1533bc846e8fb867ac8bb204ad5d3e692ce 100644 (file)
@@ -11,7 +11,9 @@ dist_man_MANS = tos-check-env.1       \
                 tos-set-symbols.1      \
                 tos-storage-at45db.1   \
                 tos-storage-stm25p.1   \
-                tos-write-image.1
+                tos-write-image.1      \
+               tos-build-deluge-image.1 \
+               tos-deluge.1
 
 
 bin_SCRIPTS = tos-ident-flags \
index b2b25478f1530e16f5ed8035d548f03cce0a9081..cf521e5fe8ac745e8473291a6918572facbf5a15 100644 (file)
@@ -54,7 +54,7 @@ class Serial:
         
         # Converts baud rate from platform name to value, if necessary
         try:
-            int(baudrate)
+            baudrate = int(baudrate)
         except:
             baudrate = __baud_rate.get(baudrate)
         
index c6af4484f55b2973a4b50ea67e35ad1b3daf4ddd..1219fa464c3d9b58341cd9a8519f36efac787479 100755 (executable)
@@ -132,7 +132,17 @@ for (k, v) in ident_list:
   ident[k] = v
 for p in ['unix_time', 'user_hash', 'uid_hash']:
   ident[p] = int(ident[p][:-1], 16)
-image = dom.getElementsByTagName('image')[0].firstChild.nodeValue
+
+error = "ERROR: getting the image from the XML file failed."
+try:
+  image_element = dom.getElementsByTagName('image')[0]
+  if image_element.getAttribute('format') != 'ihex':
+    error = "ERROR: image format is %s instead of ihex" % image_element.getAttribute('format')
+    sys.exit()
+  image = image_element.firstChild.nodeValue
+except:
+  sys.stderr.write(error + '\n')
+  sys.exit()
 
 all = []
 section = []
diff --git a/tools/tinyos/misc/tos-build-deluge-image.1 b/tools/tinyos/misc/tos-build-deluge-image.1
new file mode 100644 (file)
index 0000000..4a40bc6
--- /dev/null
@@ -0,0 +1,12 @@
+.TH tos-build-deluge-image 1 "Jul 16, 2007"
+.LO 1
+.SH NAME
+
+tos-build-deluge-image \- internal tool for Deluge T2
+
+.SH DESCRIPTION
+
+\fBtos-build-deluge-image\fR is used by \fBtos-deluge\fR to construct the binary image needed by tosboot.
+
+.SH "SEE ALSO"
+\fItos-deluge\fR(1)
\ No newline at end of file
index aedea410150606b18c53b3918897ffab750d4859..f3fa97652afeebf8cc7ba80e0bd3d8c7b810c8f3 100755 (executable)
@@ -345,8 +345,9 @@ def op_inject(s, img_num, tos_image_xml):
     print "--------------------------------------------------"
     
     # Writes the new binary image
-    if op_erase(s, img_num):
-        if op_write(s, img_num, p.stdout.read()):
+    image = p.stdout.read()
+    if len(image) > 0 and op_erase(s, img_num):
+        if op_write(s, img_num, image):
             if op_sync(s, img_num):
                 print "--------------------------------------------------"
                 metadata = getMetaData(s, img_num)
diff --git a/tools/tinyos/misc/tos-deluge.1 b/tools/tinyos/misc/tos-deluge.1
new file mode 100644 (file)
index 0000000..33813ba
--- /dev/null
@@ -0,0 +1,55 @@
+.TH tos-deluge 1 "Jul 16, 2007"
+.SH NAME
+tos-deluge \- Management tool for Deluge T2
+
+.SH SYNOPSIS
+\fBtos-deluge\fR \fIdevice\fR \fIbaudrate\fR <\fB-p\fR|\fB-r\fR|\fB-d\fR|\fB-e\fR|\fB-s\fR> \fIimage_number\fR
+
+\fBtos-deluge\fR \fIdevice\fR \fIbaudrate\fR \fB-i\fR \fIimage_number\fR \fItos_image.xml\fR
+
+.SH DESCRIPTION
+
+\fBtos-deluge\fR is the management tool for Deluge T2. The available operations are: 
+
+.SH ARGUMENTS
+.TP
+.I device
+Any device accepted by PySerial. Examples:
+.RS
+.IP \(bu 4
+/dev/ttyUSB0
+.IP \(bu 4
+COM10
+.IP \(bu 4
+11
+.RE
+
+.TP
+.I baudrate
+Two shortcuts are available: \fBmicaz\fR for 57600 and \fBtelosb\fR for 115200.
+.TP
+.I image_number
+A integer number. 0 is the first image.
+
+.SH OPTIONS
+.TP
+.B -p, --ping
+Provide status of the image in the external flash
+.TP
+.B -i, --inject
+Inject a compiled TinyOS application. The tos_image.xml file path
+.TP
+.B -r, --reprogram
+Reprogram the network
+.TP
+.B -b, --reprogram_bs
+Reprogram only the directly-connected mote
+.TP
+.B -d, --dissemination
+Disseminate the image in the external flash to the network
+.TP
+.B -e, --erase
+Erase an image in the external flash
+.TP
+.B -s, --reset
+Reset the versioning information for a given image