From: razvanm Date: Thu, 19 Jul 2007 02:19:38 +0000 (+0000) Subject: Address the comments from Phil Levis about burn and burn-net. The availability for... X-Git-Tag: release_tools_1_2_4_1~21 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=36169271d1e789a88c1df81f0aef2168ad24b37f Address the comments from Phil Levis about burn and burn-net. The availability for PySerial is tested and tosboot is compiled if the binary image is missing. --- diff --git a/apps/tests/deluge/Blink/burn b/apps/tests/deluge/Blink/burn index 6c67b9f1..ce7b1b26 100755 --- a/apps/tests/deluge/Blink/burn +++ b/apps/tests/deluge/Blink/burn @@ -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 " echo " 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. |' diff --git a/apps/tests/deluge/Blink/burn-net b/apps/tests/deluge/Blink/burn-net index 8f6b436c..64a19a17 100755 --- a/apps/tests/deluge/Blink/burn-net +++ b/apps/tests/deluge/Blink/burn-net @@ -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 " echo " \"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 ====================== diff --git a/tos/lib/net/Deluge/DelugeC.nc b/tos/lib/net/Deluge/DelugeC.nc index 4759e4da..50adc25f 100644 --- a/tos/lib/net/Deluge/DelugeC.nc +++ b/tos/lib/net/Deluge/DelugeC.nc @@ -27,7 +27,10 @@ #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; diff --git a/tos/lib/net/Deluge/DelugeP.nc b/tos/lib/net/Deluge/DelugeP.nc index 01aad620..8a4d14a9 100644 --- a/tos/lib/net/Deluge/DelugeP.nc +++ b/tos/lib/net/Deluge/DelugeP.nc @@ -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) {} } diff --git a/tos/lib/net/Deluge/DelugePageTransferC.nc b/tos/lib/net/Deluge/DelugePageTransferC.nc index b36d09ed..7594d5ef 100644 --- a/tos/lib/net/Deluge/DelugePageTransferC.nc +++ b/tos/lib/net/Deluge/DelugePageTransferC.nc @@ -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; diff --git a/tos/lib/net/Deluge/DelugePageTransferP.nc b/tos/lib/net/Deluge/DelugePageTransferP.nc index c2b40742..e47a6750 100644 --- a/tos/lib/net/Deluge/DelugePageTransferP.nc +++ b/tos/lib/net/Deluge/DelugePageTransferP.nc @@ -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() {} } diff --git a/tos/lib/net/Deluge/ObjectTransferC.nc b/tos/lib/net/Deluge/ObjectTransferC.nc index bbf6c05d..b27fbcb7 100644 --- a/tos/lib/net/Deluge/ObjectTransferC.nc +++ b/tos/lib/net/Deluge/ObjectTransferC.nc @@ -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;