From a1d4debb263f8112b008420fea2261c16fb6fd85 Mon Sep 17 00:00:00 2001 From: r-studio Date: Wed, 21 Apr 2010 11:13:03 +0000 Subject: [PATCH] Added support for program images larger than 65k in nwprog. 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 | 8 ++++---- tos/lib/net/blip/nwprog/Deluge.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/tinyos/misc/tos-nwprog b/tools/tinyos/misc/tos-nwprog index d8c78a3f..4d0ef1df 100755 --- a/tools/tinyos/misc/tos-nwprog +++ b/tools/tinyos/misc/tos-nwprog @@ -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) diff --git a/tos/lib/net/blip/nwprog/Deluge.h b/tos/lib/net/blip/nwprog/Deluge.h index 58489f2b..f9c3cf32 100644 --- a/tos/lib/net/blip/nwprog/Deluge.h +++ b/tos/lib/net/blip/nwprog/Deluge.h @@ -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; -- 2.39.2