]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/tests/deluge/Blink/burn
Merge TinyOS 2.1.1 into master.
[tinyos-2.x.git] / apps / tests / deluge / Blink / burn
index 6c67b9f1c6901fc8ffeacd1577e2f31f418f9665..fa4a3b1e00e2ec128d919e3d25c425ac38ee765d 100755 (executable)
@@ -5,34 +5,49 @@ if [[ ! -x ${TOS_DELUGE} ]] ; then
     TOS_DELUGE=../../../../tools/tinyos/misc/tos-deluge
 fi 
 
-echo ${TOS_DELUGE}
+$TOS_DELUGE > /dev/null
 
-if [ $# -ne 2 ]; then
-  echo "Usage: $0 <port> <platform>"
-  echo "<port>       For example, /dev/ttyUSB0"
-  echo "<platform>   \"micaz\", \"telosb\""
+if [[ $? != 0 ]]
+then
+  echo "Unable to locate tos-deluge."
   exit 2
 fi
 
-if [ $2 != 'micaz' -a $2 != 'telosb' ]; then
-  echo "\"$2\" is not a supported platform"
+if [[ $# -ne 3 ]]; then
+  echo "Usage: $0 <prog_source> <comm_source> <platform>"
+  echo "  <prog_source> bsl,PORT | mib510,PORT | eprb,HOST"
+  echo "  <comm_source> serial@PORT:SPEED | network@HOST:PORT"
+  echo "  <platform>    micaz | telosb | iris | epic | mulle"
   exit 2
 fi
 
-PORT=$1
-PLATFORM=$2
-
-make clean
+PPORT=$1
+CPORT=$2
+PLATFORM=$3
 
-echo ============================ Compile and load Blink ============================
-if [ $PLATFORM == 'micaz' ]
+if [ ${PLATFORM} != 'micaz' -a \
+     ${PLATFORM} != 'telosb' -a \
+     ${PLATFORM} != 'iris' -a \
+     ${PLATFORM} != 'mulle' -a \
+     ${PLATFORM} != 'tinynode' -a \
+     ${PLATFORM} != 'epic' ]
 then
-  CFLAGS=-DDELUGE_BASESTATION make ${PLATFORM} install mib510,${PORT}
-elif [ $PLATFORM == 'telosb' ]
+  echo "\"${PLATFORM}\" is not a supported platform"
+  exit 2
+fi
+
+if ! [ -a ${TOSDIR}/lib/tosboot/build/${PLATFORM}/main.ihex ]
 then
-  CFLAGS=-DDELUGE_BASESTATION make ${PLATFORM} install bsl,${PORT}
+  echo ========================== Compile tosboot for ${PLATFORM} ===========================
+  ( cd $TOSDIR/lib/tosboot ; make ${PLATFORM} ) 
 fi
 
+make clean
+
+echo ============================ Compile and load Blink ============================
+CFLAGS=-DDELUGE_BASESTATION make ${PLATFORM} install ${PPORT}
+
+
 echo '           +-------------------------------------------------------+'
 echo '           |                                                       |'
 echo '           | At this point the first led (red) should be blinking. |'
@@ -46,12 +61,12 @@ echo  ============================= Compile a new Blink ========================
 CFLAGS=-DBLINK_REVERSE\ -DDELUGE_BASESTATION make ${PLATFORM}
 
 echo =============================== Upload the image ===============================
-${TOS_DELUGE} ${PORT} ${PLATFORM} -i 0 build/${PLATFORM}/tos_image.xml
+${TOS_DELUGE} ${CPORT} -i 1 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. |'
@@ -63,4 +78,4 @@ echo '       +----------------------------------------------------------------+'
 read
 
 echo =========================== Reboot the base station ============================
-${TOS_DELUGE} ${PORT} ${PLATFORM} -b 0 
+${TOS_DELUGE} ${CPORT} -r 1