]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Address the comments from Phil Levis about burn and burn-net. The availability for...
authorrazvanm <razvanm>
Thu, 19 Jul 2007 02:19:38 +0000 (02:19 +0000)
committerrazvanm <razvanm>
Thu, 19 Jul 2007 02:19:38 +0000 (02:19 +0000)
apps/tests/deluge/Blink/burn
apps/tests/deluge/Blink/burn-net
tos/lib/net/Deluge/DelugeC.nc
tos/lib/net/Deluge/DelugeP.nc
tos/lib/net/Deluge/DelugePageTransferC.nc
tos/lib/net/Deluge/DelugePageTransferP.nc
tos/lib/net/Deluge/ObjectTransferC.nc

index 6c67b9f1c6901fc8ffeacd1577e2f31f418f9665..ce7b1b26aa5c4da3202a5bb36bf86b41762c9c94 100755 (executable)
@@ -1,12 +1,23 @@
 #!/bin/bash
 
+python -c '
+import sys
+try: 
+  import serial
+except ImportError, e: 
+  sys.exit(1)'
+
+if [[ $? != 0 ]]
+then
+  echo "Please install PySerial first." 
+  exit 2
+fi
+
 TOS_DELUGE=`type -p tos-deluge`
 if [[ ! -x ${TOS_DELUGE} ]] ; then 
     TOS_DELUGE=../../../../tools/tinyos/misc/tos-deluge
 fi 
 
-echo ${TOS_DELUGE}
-
 if [ $# -ne 2 ]; then
   echo "Usage: $0 <port> <platform>"
   echo "<port>       For example, /dev/ttyUSB0"
@@ -14,13 +25,19 @@ if [ $# -ne 2 ]; then
   exit 2
 fi
 
-if [ $2 != 'micaz' -a $2 != 'telosb' ]; then
-  echo "\"$2\" is not a supported platform"
+PORT=$1
+PLATFORM=$2
+
+if [ ${PLATFORM} != 'micaz' -a ${PLATFORM} != 'telosb' ]; then
+  echo "\"${PLATFORM}\" is not a supported platform"
   exit 2
 fi
 
-PORT=$1
-PLATFORM=$2
+if ! [ -a ${TOSDIR}/lib/tosboot/build/${PLATFORM}/main.ihex ]
+then
+  echo ========================== Compile tosboot for ${PLATFORM} ===========================
+  ( cd $TOSDIR/lib/tosboot ; make ${PLATFORM} ) 
+fi
 
 make clean
 
@@ -50,8 +67,8 @@ ${TOS_DELUGE} ${PORT} ${PLATFORM} -i 0 build/${PLATFORM}/tos_image.xml
 
 echo '       +----------------------------------------------------------------+'
 echo '       |                                                                |'
-echo '       | After pressing enter the following things will take place:     |'
-echo '       | - mote will be rebooted                                        |'
+echo '       | In the next step the following things will take place:         |'
+echo '       | - the mote will be rebooted                                    |'
 echo '       | - all the leds will blink for some time as the                 |'
 echo '       |   reprogramming by tosboot takes place.                        |'
 echo '       | - a fading of the leds will indicate the exiting from tosboot. |'
index 8f6b436c8064a3464286e6749babc5f118c9b155..64a19a17ff1c3d48794f76d3b62a92d38cf70f5f 100755 (executable)
@@ -5,8 +5,6 @@ if [[ ! -x ${TOS_DELUGE} ]] ; then
     TOS_DELUGE=../../../../tools/tinyos/misc/tos-deluge
 fi 
 
-echo ${TOS_DELUGE}
-
 if [ $# -ne 2 ]; then
   echo "Usage: $0 <platform> <number of motes>"
   echo "<platform>         \"micaz\", \"telosb\""
@@ -18,10 +16,16 @@ PLATFORM=$1
 NO_MOTES=$2
 
 if [ ${PLATFORM} != 'micaz' -a ${PLATFORM} != 'telosb' ]; then
-  echo "\"$2\" is not a supported platform"
+  echo "\"${PLAFTORM}\" is not a supported platform"
   exit 2
 fi
 
+if ! [ -a ${TOSDIR}/lib/tosboot/build/${PLATFORM}/main.ihex ]
+then
+  echo ========================== Compile tosboot for ${PLATFORM} ===========================
+  ( cd $TOSDIR/lib/tosboot ; make ${PLATFORM} ) 
+fi
+
 echo ================================ Compile Blink =================================
 make clean
 CFLAGS=-DDELUGE_BASESTATION make ${PLATFORM}
@@ -63,22 +67,32 @@ CFLAGS=-DBLINK_REVERSE\ -DDELUGE_BASESTATION make ${PLATFORM}
 echo ========= Upload the new image to the external flash of the last mote ==========
 ${TOS_DELUGE} ${PORT} ${PLATFORM} -i 0 build/${PLATFORM}/tos_image.xml
 
-echo '                  +-----------------------------------------+'
-echo '                  |                                         |'
-echo '                  | Press ENTER to start the dissemination. |'
-echo '                  |                                         |'
-echo '                  +-----------------------------------------+'
+echo '            +-----------------------------------------------------+'
+echo '            |                                                     |'
+echo '            | In the next step the dissemination will be started. |'
+echo '            | When a node receives a page, the second led (green) |'
+echo '            | will blink.                                         |'
+echo '            |                                                     |'
+echo '            |              Press ENTER to continue...             |'
+echo '            |                                                     |'
+echo '            +-----------------------------------------------------+'
+
 read
 
 echo ============================= Start dissemination ==============================
 ${TOS_DELUGE} ${PORT} ${PLATFORM} -d 0
 
-echo '              +--------------------------------------------------+'
-echo '              |                                                  |'
-echo '              | Press ENTER when the second led (green) from all |'
-echo '              | the motes except the last one stops blinking.    |'
-echo '              |                                                  |'
-echo '              +--------------------------------------------------+'
+echo '         +------------------------------------------------------------+'
+echo '         |                                                            |'
+echo '         | The dissemination is completed when the second and third   |'
+echo '         | led from all the motes except the last one stops blinking. |'
+echo '         |                                                            |'
+echo '         | In the next step the motes will be rebooted to allow the   |'
+echo '         | reprogramming to take place.                               |'
+echo '         |                                                            |'
+echo '         |                 Press ENTER to continue...                 |'
+echo '         |                                                            |'
+echo '         +------------------------------------------------------------+'
 read
 
 echo ===================== Trigger the reboot in the new image ======================
index 4759e4da596dc6cf4c5646c500e2877dc51e9d4f..50adc25f59f4e7953f6cab95c76ad13faa35c1cd 100644 (file)
 #include "Deluge.h"
 #include "StorageVolumes.h"
 
-configuration DelugeC {}
+configuration DelugeC
+{
+  uses interface Leds;
+}
 
 implementation
 {
@@ -52,13 +55,13 @@ implementation
   ObjectTransferC.BlockWrite[VOLUME_DELUGE0] -> DelugeStorageC.BlockWrite[VOLUME_DELUGE0];
   ObjectTransferC.BlockRead[VOLUME_DELUGE1] -> DelugeStorageC.BlockRead[VOLUME_DELUGE1];
   ObjectTransferC.BlockWrite[VOLUME_DELUGE1] -> DelugeStorageC.BlockWrite[VOLUME_DELUGE1];
+  ObjectTransferC.Leds = Leds;
   
   components new DisseminatorC(DelugeDissemination, 0xDE00), DisseminationC;
   components ActiveMessageC;
   components NetProgC, DelugeP;
   components new TimerMilliC() as Timer;
-  components LedsC, NoLedsC;
-  DelugeP.Leds -> LedsC;  
+  DelugeP.Leds = Leds;  
   DelugeP.DisseminationValue -> DisseminatorC;
   DelugeP.DisseminationUpdate -> DisseminatorC;
   DelugeP.StdControlDissemination -> DisseminationC;
index 01aad620ffc468b6a721478cb4b3d81a5730f707..8a4d14a9758063d01e55a5a9d381574a625e56f5 100644 (file)
@@ -141,6 +141,7 @@ implementation
   
   event void ObjectTransfer.receiveDone(error_t error)
   {
+    call Leds.set(LEDS_LED1 | LEDS_LED2);
     call ObjectTransfer.publish(recv_uid, recv_size, recv_imgNum);
   }
 
@@ -155,4 +156,6 @@ implementation
   }
   
   event void RadioSplitControl.stopDone(error_t error) {}
+  
+  default async void command Leds.set(uint8_t val) {}
 }
index b36d09edc0bd1a9667abd795ebd006f683f907ee..7594d5efb2c0dac1b0a1b58870f4212bba78c34d 100644 (file)
@@ -37,6 +37,7 @@ configuration DelugePageTransferC
     interface AMSend as SendReqMsg;
     interface AMPacket;
     interface PacketAcknowledgements;
+    interface Leds;
   }
 }
 
@@ -63,8 +64,7 @@ implementation
   DelugePageTransferP.Timer -> Timer;
   DelugePageTransferP.BitVecUtils -> BitVecUtilsC;
   
-  components NoLedsC, LedsC;
-  DelugePageTransferP.Leds -> LedsC;
+  DelugePageTransferP.Leds = Leds;
   
   // For collecting statistics
   //components StatsCollectorC;
index c2b4074246a6a504dd39453a3d2bfcf58cd78d74..e47a67506208b0aad67ca8e2d0824ed500693d19 100644 (file)
@@ -490,4 +490,5 @@ dbg("Deluge", "%.3f 115 116 116 117 115 2 %d\n", ((float)((sim_time() * 1000) /
   
   default command error_t BlockRead.read[uint8_t img_num](storage_addr_t addr, void* buf, storage_len_t len) { return FAIL; }
   default command error_t BlockWrite.write[uint8_t img_num](storage_addr_t addr, void* buf, storage_len_t len) { return FAIL; }
+  default async command void Leds.led1Toggle() {}
 }
index bbf6c05d30169d4d99aea81c1dff94ca0143b632..b27fbcb78c86fa00b2abddb9b562167844e7e697 100644 (file)
@@ -33,6 +33,7 @@ configuration ObjectTransferC
   uses {
     interface BlockRead[uint8_t img_num];
     interface BlockWrite[uint8_t img_num];
+    interface Leds;
   }
 }
 
@@ -64,13 +65,11 @@ implementation
   DelugePageTransferC.SendDataMsg -> SendDataMsg;
   DelugePageTransferC.ReceiveDataMsg -> ReceiveDataMsg;
   DelugePageTransferC.AMPacket -> SendDataMsg;
+  DelugePageTransferC.Leds = Leds;
   
   ObjectTransferP.BlockWrite[VOLUME_DELUGE0] = BlockWrite[VOLUME_DELUGE0];
   ObjectTransferP.BlockWrite[VOLUME_DELUGE1] = BlockWrite[VOLUME_DELUGE1];
   
-  components MainC, LedsC, NoLedsC;
-  ObjectTransferP.Leds -> NoLedsC;
-  
   components RandomC, new TimerMilliC() as Timer;
   ObjectTransferP.Random -> RandomC;
   ObjectTransferP.Timer -> Timer;