# Copyright (c) 2006 Chad Metcalf # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # Java export JDKROOT=/usr/lib/jvm/java-1.5.0-sun export JAVAXROOT=$JDKROOT if [ "$LD_LIBRARY_PATH" == "" ]; then # So Java can find libtoscomm.so and libgetenv.so export LD_LIBRARY_PATH=$JDKROOT/jre/lib/i386 fi # Set your default version of TinyOS here. if [ "$TINYOS_VER" == "" ]; then export TINYOS_VER=2 export BOOMERANG=0 fi # Preserve any non Tinyos related class paths that have been set prior # to this file being sourced. We check the for an empty OLD_CLASSPATH # to ensure that OLD_CLASSPATH only gets set once. if [ "$OLD_CLASSPATH" == "" ]; then if [ "$CLASSPATH" == "" ]; then export OLD_CLASSPATH="empty" else export OLD_CLASSPATH=$CLASSPATH fi fi # Conditional environmental setup for 3 versions of TinyOS if [ "$TINYOS_VER" == "1" ]; then export TOSROOT=/opt/tinyos-1.x export TOSDIR=$TOSROOT/tos export MAKERULES=$TOSROOT/tools/make/Makerules unset CLASSPATH # Restore the old non tinyos classpath if its not empty if [ "$OLD_CLASSPATH" != "empty" ]; then export CLASSPATH=$OLD_CLASSPATH fi export CLASSPATH=$CLASSPATH\:`$TOSROOT/tools/java/javapath` if [ "$BOOMERANG" == "1" ]; then echo "Setting up for TinyOS 1.x with Boomerang" export MOTEIV_DIR=/opt/moteiv export TOSMAKE_PATH=$MOTEIV_DIR/tools/make for a in $MOTEIV_DIR/tools/java/jars/* $MOTEIV_DIR/tools/java do export MOTEIV_CLASSPATH="$a:$MOTEIV_CLASSPATH" done export CLASSPATH=$MOTEIV_CLASSPATH\:$MOTEIV_DIR/tools/java\:$CLASSPATH # help build files in $TOSDIR/../tools/java/net/tinyos export MIGFLAGS="-target=telosb -I$TOSDIR/lib/CC2420Radio" export SURGE_PLATFORM=telos else echo "Setting up for TinyOS 1.x" fi # These aliases only apply to a 1.x environment alias tinyviz="$TOSROOT/tools/java/net/tinyos/sim/tinyviz" alias Deluge="java net.tinyos.tools.Deluge" else echo "Setting up for TinyOS 2.x" export TOSROOT=/opt/tinyos-2.x export TOSDIR=$TOSROOT/tos unset CLASSPATH # Restore the old non tinyos classpath if its not empty if [ "$OLD_CLASSPATH" != "empty" ]; then export CLASSPATH=$OLD_CLASSPATH fi export CLASSPATH=$CLASSPATH\:$TOSROOT/support/sdk/java/tinyos.jar\:$TOSROOT/support/sdk/java/ export PYTHONPATH=:$TOSROOT/support/sdk/python/ export MAKERULES=$TOSROOT/support/make/Makerules unset TOSMAKE_PATH fi # Finally set the path for the new MSPGCCROOT export MSPGCCROOT=/opt/msp430 export PATH="$MSPGCCROOT/bin:$PATH" # Helpful aliases alias sf="java net.tinyos.sf.SerialForwarder" alias listen="java net.tinyos.tools.Listen" alias apps="cd $TOSROOT/apps" alias tos="cd $TOSROOT/tos" # Environment changing functions # Change this shell's environment to support Tinyos 2.x development function tos2 () { export TINYOS_VER=2 export BOOMERANG=0 . ~/.bash_tinyos } # Change this shell's environment to support Tinyos 1.x development function tos1 () { export TINYOS_VER=1 export BOOMERANG=0 . ~/.bash_tinyos } # Change this shell's environment to support Boomerang function boomerang () { export TINYOS_VER=1 export BOOMERANG=1 . ~/.bash_tinyos } # Set the MOTECOM variable to the first mote in motelist function setMoteCom () { MOTE=`motelist -c| cut -d, -f2` if [ "$BOOMERANG" == "1" ]; then TYPE="tmote" else TYPE="telosb" fi export MOTECOM="serial@$MOTE:$TYPE" } # Change ownership of the TinyOS directories to the TinyOS group. This # was originally written for the LiveCD xubuntos but it's handy to have # around. function tos-fix-permissions () { echo "sudo may prompt you for your password." sudo chown -R root:tinyos /opt/tinyos-* sudo chmod -R g+w /opt/tinyos-* sudo find /opt/tinyos-* -type d -exec chmod 2775 {} \; }