[Tinyos-commits] CVS: tinyos-1.x/tos/lib/Deluge/TOSBoot TOSBootM.nc, 1.1, 1.2

Joe Polastre jpolastre at users.sourceforge.net
Mon Sep 19 14:58:05 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/Deluge/TOSBoot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1403

Modified Files:
	TOSBootM.nc 
Log Message:
more reliably read flash by starting and stopping each time the
loop is entered.  keeps other pests from screwing up our position in
flash by unknown dependencies of other components/commands


Index: TOSBootM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/Deluge/TOSBoot/TOSBootM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TOSBootM.nc	22 Jul 2005 17:40:09 -0000	1.1
--- TOSBootM.nc	19 Sep 2005 21:58:03 -0000	1.2
***************
*** 121,134 ****
      uint32_t intAddr;
      uint32_t secLength;
  
      if (!verifyImage(startAddr))
        return R_INVALID_IMAGE_ERROR;
  
!     startAddr += DELUGE_METADATA_SIZE + DELUGE_CRC_BLOCK_SIZE + DELUGE_IDENT_SIZE;
  
!     call ExtFlash.startRead(startAddr);
  
      intAddr = extFlashRead32();
      secLength = extFlashRead32();
  
      while ( secLength ) {
--- 121,136 ----
      uint32_t intAddr;
      uint32_t secLength;
+     uint32_t curAddr;
  
      if (!verifyImage(startAddr))
        return R_INVALID_IMAGE_ERROR;
  
!     curAddr = startAddr + DELUGE_METADATA_SIZE + DELUGE_CRC_BLOCK_SIZE + DELUGE_IDENT_SIZE;
  
!     call ExtFlash.startRead(curAddr);
  
      intAddr = extFlashRead32();
      secLength = extFlashRead32();
+     curAddr = curAddr + 8;
  
      while ( secLength ) {
***************
*** 136,139 ****
--- 138,142 ----
        pageAddr = newPageAddr = intAddr / TOSBOOT_INT_PAGE_SIZE;
  
+       call ExtFlash.startRead(curAddr);
        // fill in ram buffer for internal program flash sector
        do {
***************
*** 144,152 ****
  
  	buf[(uint16_t)intAddr % TOSBOOT_INT_PAGE_SIZE] = call ExtFlash.readByte();
! 	intAddr++;
  	
  	if ( --secLength == 0 ) {
  	  intAddr = extFlashRead32();
  	  secLength = extFlashRead32();
  	}
  
--- 147,156 ----
  
  	buf[(uint16_t)intAddr % TOSBOOT_INT_PAGE_SIZE] = call ExtFlash.readByte();
! 	intAddr++; curAddr++;
  	
  	if ( --secLength == 0 ) {
  	  intAddr = extFlashRead32();
  	  secLength = extFlashRead32();
+ 	  curAddr = curAddr + 8;
  	}
  
***************
*** 154,158 ****
  
        } while ( pageAddr == newPageAddr && secLength );
!       
        call Leds.set(pageAddr);
  
--- 158,163 ----
  
        } while ( pageAddr == newPageAddr && secLength );
!       call ExtFlash.stopRead();
! 
        call Leds.set(pageAddr);
  
***************
*** 164,169 ****
      }
  
-     call ExtFlash.stopRead();
- 
      return R_SUCCESS;
  
--- 169,172 ----



More information about the Tinyos-commits mailing list