]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Added support for program images larger than 65k in nwprog.
authorr-studio <r-studio>
Wed, 21 Apr 2010 11:13:03 +0000 (11:13 +0000)
committerr-studio <r-studio>
Wed, 21 Apr 2010 11:13:03 +0000 (11:13 +0000)
This was done by changing the flash imgae address offsets to 32 bit variables instead of 16 bit in Deluge.h and tos-nwprog.

tools/tinyos/misc/tos-nwprog
tos/lib/net/blip/nwprog/Deluge.h

index d8c78a3fe28333c70808ee7e5ba756dafb82ab8f..4d0ef1df8cb6f82ac9a37938529cfdf347a39d2c 100755 (executable)
@@ -51,8 +51,8 @@ DELUGE_IDENT_SIZE   = 128
 
 NWPROG_PORT = 5213
 NWPROG_PKT_SIZE = 64
-NWPROG_REQ_FMT = "!BBH"
-NWPROG_REPLY_FMT = "!BBBBH"
+NWPROG_REQ_FMT = "!BBL"
+NWPROG_REPLY_FMT = "!BBBBL"
 
 ERROR_SUCCESS = 0
 nRetries = 3
@@ -63,7 +63,7 @@ class CommandFailedException:
 def send_command(cmd_str, retries):
     s.sendto(cmd_str, (remote, NWPROG_PORT))
     s.settimeout(3)
-    (real_cmd, real_imgno, real_offset) = struct.unpack(NWPROG_REQ_FMT, cmd_str[0:4])
+    (real_cmd, real_imgno, real_offset) = struct.unpack(NWPROG_REQ_FMT, cmd_str[0:6])
     try:
         data, addr = s.recvfrom(1024)
         # make sure this is the guy we're programming
@@ -95,7 +95,7 @@ def read(imgNum, unused=None):
 
         data = send_command(sreqpkt, 5)
         if data != False:
-            (error, pack, cmd, imgno, offset) = struct.unpack(NWPROG_REPLY_FMT, data[0:6])
+            (error, pack, cmd, imgno, offset) = struct.unpack(NWPROG_REPLY_FMT, data[0:8])
             if offset == pkt_offset:
                 for c in data[6:]:
                     print >>sys.stderr, ord(c)
index 58489f2b23f79ea3899b8f15ff8502f710760068..f9c3cf32f3a35fd03f9bfff85b23343615d597a0 100644 (file)
@@ -110,9 +110,9 @@ typedef nx_struct prog_req {
   nx_uint8_t cmd;
   nx_uint8_t imgno;
   nx_union {
-    nx_uint16_t offset;
-    nx_uint16_t when;
-    nx_uint16_t nimages;
+    nx_uint32_t offset;
+    nx_uint32_t when;
+    nx_uint32_t nimages;
   } cmd_data;
   nx_uint8_t data[0];
 } prog_req_t;