[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot
Makefile, 1.5, 1.6 TOSBootM.nc, 1.12, 1.13
Jonathan Hui
jwhui at users.sourceforge.net
Tue Jul 12 13:09:48 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3138/TOSBoot
Modified Files:
Makefile TOSBootM.nc
Log Message:
- Reduced code size of TOSBoot yet again by reducing number of
internal flash command calls. TOSBoot is currently at 2002 bytes. The
starting address for the app is now moved to 0x4800 leaving 46KB for
the application.
Index: Makefile
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Makefile 30 Jun 2005 05:01:17 -0000 1.5
--- Makefile 12 Jul 2005 20:09:08 -0000 1.6
***************
*** 1,2 ****
--- 1,31 ----
+ # $Id$
+
+ # tab:2
+ #
+ #
+ # "Copyright (c) 2000-2005 The Regents of the University of California.
+ # All rights reserved.
+ #
+ # Permission to use, copy, modify, and distribute this software and its
+ # documentation for any purpose, without fee, and without written agreement is
+ # hereby granted, provided that the above copyright notice, the following
+ # two paragraphs and the author appear in all copies of this software.
+ #
+ # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+ # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+ # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+ # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #
+ # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ # AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ # ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
+ # PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
+ #
+ #
+
+ #
+ # @author Jonathan Hui <jwhui at cs.berkeley.edu>
+ #
COMPONENT=TOSBoot
***************
*** 9,15 ****
-Istm25p \
-DTOSBOOT_START=0x4000 \
! -DTOSBOOT_END=0x4A00 \
-DNESC_BUILD_BINARY \
! -O1
include $(TOSDIR)/../apps/Makerules
--- 38,44 ----
-Istm25p \
-DTOSBOOT_START=0x4000 \
! -DTOSBOOT_END=0x4800 \
-DNESC_BUILD_BINARY \
! -Os
include $(TOSDIR)/../apps/Makerules
Index: TOSBootM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/TOSBootM.nc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** TOSBootM.nc 8 Jul 2005 22:15:06 -0000 1.12
--- TOSBootM.nc 12 Jul 2005 20:09:08 -0000 1.13
***************
*** 1,6 ****
// $Id$
! /* tab:4
! * "Copyright (c) 2000-2004 The Regents of the University of California.
* All rights reserved.
*
--- 1,6 ----
// $Id$
! /* tab:2
! * "Copyright (c) 2000-2005 The Regents of the University of California.
* All rights reserved.
*
***************
*** 88,92 ****
uint32_t extFlashRead32() {
uint32_t result = 0;
! uint8_t i;
for ( i = 0; i < 4; i++ )
result |= ((uint32_t)call ExtFlash.readByte() & 0xff) << (i*8);
--- 88,92 ----
uint32_t extFlashRead32() {
uint32_t result = 0;
! uint8_t i;
for ( i = 0; i < 4; i++ )
result |= ((uint32_t)call ExtFlash.readByte() & 0xff) << (i*8);
***************
*** 99,104 ****
uint16_t addr, len;
uint16_t j;
! pgnum_t numPgs;
! uint8_t i;
// read size of image
--- 99,104 ----
uint16_t addr, len;
uint16_t j;
! pgnum_t numPgs;
! uint8_t i;
// read size of image
***************
*** 166,173 ****
// check if secLength is all ones
! if (!(secLength+1))
return FAIL;
! buf[intAddr++ % TOSBOOT_INT_PAGE_SIZE] = call ExtFlash.readByte();
if ( --secLength == 0 ) {
--- 166,174 ----
// check if secLength is all ones
! if ( secLength == 0xffffffff )
return FAIL;
! buf[(uint16_t)intAddr % TOSBOOT_INT_PAGE_SIZE] = call ExtFlash.readByte();
! intAddr++;
if ( --secLength == 0 ) {
***************
*** 207,212 ****
void startupSequence() {
! uint8_t gestureCount;
! uint8_t flags;
// check voltage and make sure flash can be programmed
--- 208,212 ----
void startupSequence() {
! tosboot_args_t args;
// check voltage and make sure flash can be programmed
***************
*** 221,228 ****
// get current value of counter
! call IntFlash.read((uint8_t*)TOSBOOT_GESTURE_COUNT_ADDR, &gestureCount, sizeof(gestureCount));
// increment gesture counter, see if it exceeds threshold
! if (++gestureCount >= TOSBOOT_GESTURE_MAX_COUNT - 1) {
// gesture has been detected, display receipt of gesture on LEDs
codeNotify(LEDS_GESTURE);
--- 221,228 ----
// get current value of counter
! call IntFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &args, sizeof(args));
// increment gesture counter, see if it exceeds threshold
! if (++args.gestureCount >= TOSBOOT_GESTURE_MAX_COUNT - 1) {
// gesture has been detected, display receipt of gesture on LEDs
codeNotify(LEDS_GESTURE);
***************
*** 235,259 ****
reboot();
}
!
! // update gesture counter
! call IntFlash.write((uint8_t*)TOSBOOT_GESTURE_COUNT_ADDR, &gestureCount, sizeof(gestureCount));
!
! // read flags
! call IntFlash.read((uint8_t*)TOSBOOT_FLAGS_ADDR, &flags, sizeof(flags));
!
! if (!(flags & TOSBOOT_REPROGRAM) && gestureCount < TOSBOOT_GESTURE_MAX_COUNT - 1) {
! uint32_t addr;
!
! // get address of new program
! call IntFlash.read((uint8_t*)TOSBOOT_NEW_IMG_START_ADDR, &addr, sizeof(addr));
!
! // if an error happened during reprogramming, reboot and try again
! // after two tries, try programming the golden image
! if (programImage(addr) == R_PROGRAMMING_ERROR)
! reboot();
! // reset flag for reprogramming
! flags |= TOSBOOT_REPROGRAM;
! call IntFlash.write((uint8_t*)TOSBOOT_FLAGS_ADDR, &flags, sizeof(flags));
}
--- 235,248 ----
reboot();
}
! else {
! // update gesture counter
! call IntFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &args, sizeof(args));
! if ( !args.noReprogram ) {
! // if an error happened during reprogramming, reboot and try again
! // after two tries, try programming the golden image
! if (programImage(args.imageAddr) == R_PROGRAMMING_ERROR)
! reboot();
! }
}
***************
*** 261,267 ****
startupLeds();
! // reset counter
! gestureCount = 0xff;
! call IntFlash.write((uint8_t*)TOSBOOT_GESTURE_COUNT_ADDR, &gestureCount, sizeof(gestureCount));
runApp();
--- 250,257 ----
startupLeds();
! // reset counter and reprogramming flag
! args.gestureCount = 0xff;
! args.noReprogram = TRUE;
! call IntFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &args, sizeof(args));
runApp();
More information about the Tinyos-beta-commits
mailing list