]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Fix for Deluge T2 to properly deal with images bigger than 64K.
authorrazvanm <razvanm>
Thu, 23 Apr 2009 00:44:56 +0000 (00:44 +0000)
committerrazvanm <razvanm>
Thu, 23 Apr 2009 00:44:56 +0000 (00:44 +0000)
tools/tinyos/misc/tos-build-deluge-image
tools/tinyos/misc/tos-deluge
tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc
tos/lib/tosboot/TOSBootM.nc

index 3095167aeeed9ad4c37b26a5700c52c0c9ec4691..0dddf828cc76d74acf23a145d628e63e7dd99d8c 100755 (executable)
@@ -130,10 +130,11 @@ except:
 all = []
 section = []
 end_addr = None
+offset = 0
 for line in image.split():
     #print "DEBUG:", line
     length = int(line[1:3], 16)
-    addr = int(line[3:7], 16)
+    addr = int(line[3:7], 16) + offset
     rectype = int(line[7:9], 16)
     data = []
     if len(line) > 11:
@@ -155,6 +156,8 @@ for line in image.split():
             start_addr = addr
         section += data
         end_addr = addr + length
+    elif rectype == 0x02:
+        offset = int(line[9:9+4], 16) << 4
     elif rectype == 0x01:
         all.append((start_addr, section))
         section = []
index 9ec58283e567b4eb881f462fd37870558679048a..d9c8746377b88c39822dd952dc8bf54f2edc834a 100755 (executable)
@@ -70,7 +70,7 @@ class FMReqPacket(tos.Packet):
         tos.Packet.__init__(self,
                             [('cmd',    'int',  1),
                              ('imgNum', 'int',  1),
-                             ('offset', 'int',  2),
+                             ('offset', 'int',  4),
                              ('length', 'int',  2),
                              ('data',   'blob', None)],
                             packet)
index 06420ce4a02ab4037f13cd7937738a9cf2d6eb98..e758e77a750356d8a7691d939a7f2d292dc87289 100644 (file)
@@ -45,7 +45,7 @@ implementation
   typedef nx_struct SerialReqPacket {
     nx_uint8_t cmd;
     nx_uint8_t imgNum;
-    nx_uint16_t offset;
+    nx_uint32_t offset;
     nx_uint16_t len;
     nx_uint8_t data[0];
   } SerialReqPacket;
index e04718f4d33d0abb97845aaf126aa3857511e20b..fb73723ee06b280c220ece55e8579befcf59c60c 100644 (file)
@@ -96,10 +96,11 @@ implementation {
   }
 
   bool verifyImage(ex_flash_addr_t startAddr) {
-    uint16_t addr;
+    uint32_t addr;
     uint8_t  numPgs;
     uint8_t  i;
 
+
     if (!verifyBlock(startAddr + offsetof(DelugeIdent,crc),
                     startAddr, offsetof(DelugeIdent,crc)))
       return FALSE;
@@ -118,9 +119,6 @@ implementation {
     for ( i = 0; i < numPgs; i++ ) {
       if (!verifyBlock(startAddr + i*sizeof(uint16_t),
                       startAddr + addr, DELUGE_BYTES_PER_PAGE)) {
-       if (i == 0)
-         while (1)
-           call Leds.flash(2);
        return FALSE;
       }
       addr += DELUGE_BYTES_PER_PAGE;
@@ -131,7 +129,7 @@ implementation {
 
   error_t programImage(ex_flash_addr_t startAddr) {
     uint8_t  buf[TOSBOOT_INT_PAGE_SIZE];
-    uint16_t pageAddr, newPageAddr;
+    uint32_t pageAddr, newPageAddr;
     in_flash_addr_t intAddr;
     in_flash_addr_t secLength;
     ex_flash_addr_t curAddr;