This guide is for installing TinyOS 1.x for the Intel Shimmer mote on Ubuntu 6.06.1 LTS (Dapper Drake)
This Shimmer Install guide is based on guides available from Konrad Lorincz at Harvard and
Chad Metcalf of www.5secondfuse.com that have been enhanced and modified to work with the Intel Shimmer platform.
This guide is specifically for the Shimmer which uses the TI MSP430 MCU. Motes that use the Atmel AVR series processors requiring the avr-gcc compiler will not work with this guide as the default Ubuntu / Debian version is used and it does not work properly with TinyOS.
To begin
Install Ubuntu 6.06.1 LTS onto a machine, get the network configured, then install all the Ubuntu Updates.
Install Ubuntu / Java Packages needed for TinyOS Install
To get the Sun Java package used later on, add universe and multiverse to /etc/apt/sources.list
In the sources.list file, uncomment the following two lines as shown, and add multiverse at the end.
## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://us.archive.ubuntu.com/ubuntu/ dapper universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ dapper universe multiverse
Update the package descriptions to bring in the packages from universe and multiverse:
sudo apt-get update
Install the kernel source and Ubuntu build essentials
sudo apt-get install linux-headers-`uname -r`
sudo apt-get install build-essential
Install other required packages:
sudo apt-get install cvs autoconf automake1.4 gcc-3.4 fakeroot gcc-avr avr-libc binutils-avr swig gperf
Install Java
sudo apt-get install sun-java5-jdk
Accept the license for the Sun JDK
The Shimmer mote works with TinyOS-1.x, from CVS
Put the following into your .bashrc
# Java & MSPGCC
export JDKROOT=/usr/lib/jvm/java-1.5.0-sun
export JAVAXROOT=/usr/lib/jvm/java-1.5.0-sun
export MSPGCCROOT=/opt/msp430
export PATH="$JDKROOT/bin:$MSPGCCROOT/bin:$PATH"
#Tinyos path items
export TOSROOT=$HOME/tinyos-1.x
export TOSDIR=$TOSROOT/tos
unset CLASSPATH
export CLASSPATH=`$TOSROOT/tools/java/javapath`
export MAKERULES=$TOSROOT/tools/make/Makerules
#TinyOS Aliases
alias Deluge="java net.tinyos.tools.Deluge"
alias tinyviz="$TOSROOT/tools/java/net/tinyos/sim/tinyviz"
alias sf="java net.tinyos.sf.SerialForwarder"
alias listen="java net.tinyos.tools.Listen"
alias apps="cd $TOSROOT/apps"
alias tos="cd $TOSROOT/tos"
Install Java Comm version 3.0 for Linux (comm3.0_u1_linux.zip). You need a free Sun download account to get this.
Download it at:
After downloading the Java Comm 3.0 for Linux to your home directory:
unzip comm3.0_u1_linux.zip
sudo cp -r commapi/jar/* $JDKROOT/jre/lib/
sudo cp commapi/lib/* $JDKROOT/jre/lib/i386
sudo cp commapi/docs/javax.comm.properties $JDKROOT/jre/lib
Checkout TinyOS from CVS
From your home directory as the .bashrc above references your home directory
cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
For the above, CVS password is blank since this is anonymous login, hit enter here.
cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-1.x
Sometimes the 2nd step which actually checks out the entire tinyos-1.x source tree from CVS fails part way through the checkout. To restart the process, Ctrl+C and then issue the same command as above again.
The last line of the CVS checkout is
U tinyos-1.x/tos/types/list.h
So, if this is the last line when CVS exits and returns to the prompt, the TinyOS tree was likely checked out successfully.
Install MSPGCC using the script in the TinyOS Tree
cd $TOSROOT/tools/src/mspgcc/
Build MSPGCC with GCC 3.4
export CC=gcc-3.4
export CXX=gcc-3.4
sudo ./build-mspgcc install
Install the MSP430 BSL for the Shimmer
sudo ln -s $TOSROOT/contrib/handhelds/tools/src/mspgcc-pybsl/bsl.py /opt/msp430/bin/msp430-bsl
Install TinyOS Scripts
cd $TOSROOT/tools/scripts/
sudo make install prefix=/usr/local
sudo ln -s $TOSROOT/tools/src/motelist/motelist-linux /usr/local/bin/motelist
Install nesC
Install the nesC version 1.2.2 as this works with the Shimmer sample code installed later.
nesC version 1.2.2 is available at: http://downloads.sourceforge.net/nescc/nesc-1.2.2.tar.gz
If this link becomes outdated, find version 1.2.2 at http://sourceforge.net/projects/nescc
Now unpack the package and install it:
gunzip nesc-1.2.2.tar.gz
tar -xvf nesc-1.2.2.tar
cd nesc-1.2.2
export CC=gcc-3.4
export CXX=gcc-3.4
./configure
make
sudo make install
Install the TinyOS frontends for nesc
cd $TOSROOT/tools/src/ncc
./Bootstrap
./configure
make
sudo make install
Compile the Java Tools
cd $TOSROOT/tools/java
make
make
Yes, you do need to make twice.
Install TOSComm
To get TOSComm to work, you need to remove the two JAVADIR lines from the Makefile at $TOSROOT/beta/TOSComm/comm/Makefile and replace them with the following:
JAVADIR = /usr/lib/jvm/java-1.5.0-sun
Now, build TOSComm
cd $TOSROOT/beta/TOSComm
sudo make
Instal JNI
Tinyos uses JNI to allow Java access to environment variables.
sudo cp $TOSROOT/tools/java/jni/libgetenv.so $JDKROOT/jre/lib/i386
Install the Shimmer tools
The Shimmer tools are available at:
Download the Shimmer Platform code from the link on the Getting Started Guide Page: shimmerPlatform.tar.gz
tar -zxf shimmerPlatform.tar.gz
The perl script in the Shimmer Platform Code has DOS carriage returns, these need to be changed to UNIX carriage returns
sudo apt-get install tofrodos
Now, convert the Perl script to UNIX carriage returns using fromdos
cd shimmerPlatform
fromdos makeShimmerPlatform.pl
./makeShimmerPlatform.pl
Let's build / run Blink
You'll get a problem with multiple targets defined when trying to make blink. This is because the shimmer.target in the contrib directory conflicts with the one the script from the Shimmer Getting Started Guide in the TinyOS top level.
cd $TOSROOT/contrib/handhelds/apps/Blink
make shimmer install bsl,/dev/ttyUSB0 (with /dev/ttyUSB0 being the usb serial device your
mote is at after it is plugged in. To see this, type dmesg and see where the FTDI serial controller is at the bottom of the output)
Example dmesg output from my system showing the Shimmer being connected to ttyUSB0:
[17185791.708000] usb 2-1: new full speed USB device using uhci_hcd and address 2
[17185792.296000] usbcore: registered new driver usbserial
[17185792.296000] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[17185792.296000] usbcore: registered new driver usbserial_generic
[17185792.296000] drivers/usb/serial/usb-serial.c: USB Serial Driver core
[17185792.332000] drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
[17185792.336000] ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
[17185792.336000] drivers/usb/serial/ftdi_sio.c: Detected FT232BM
[17185792.336000] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
Example output when trying to compile Blink without the fix.
multiple targets specified
make: *** [exe0] Error 2
To fix the multiple targets problem:
cd $TOSROOT/contrib/handhelds/tools/make
mv shimmer.target shimmer.unused
Install the TestSamplingStorageRadio program from the Shimmer Getting Started Guide
You need a second mote that isn't a shimmer to receive the data and transmit it to the PC. I used a telosb mote.
cd $TOSROOT/apps/TOSBase
make telosb install.0 bsl,/dev/ttyUSB1
Download the Shimmer testSamplingStorageRadio program from the from the link on the Getting Started Guide Page: testSamplingStorageRadio.tar.gz
gunzip testSamplingStorageRadio.tar.gz
tar -xvf testSamplingStorageRadio.tar
Open Serial Forwarder and point it at the serial port where you have TOSBase (in this case /dev/ttyUSB1 was where the telosb mote was connected)
java net.tinyos.sf.SerialForwarder -comm serial@/dev/ttyUSB1:telosb
Compile and run the Java receiver:
cd testSamplingStorageRadio/java
make
make run
Install the TestSamplingStorageRadio on the shimmer
In a new terminal:
cd ~/testSamplingStorageRadio
make shimmer install bsl,/dev/ttyUSB0
In the window where the java reciever is running, you should see something similar to the following:
# srcAddr= 1 timeRaw= 891540 timeSec= 27.208 nbrSamples= 9
27.208 1951 1930 1568
27.408 1987 1987 1762
27.608 2311 1933 2036
# srcAddr= 1 timeRaw= 911202 timeSec= 27.808 nbrSamples= 9
27.808 2273 1968 2017
28.008 2252 2008 2008
28.208 2261 2005 2002
# srcAddr= 1 timeRaw= 930864 timeSec= 28.408 nbrSamples= 9
28.408 2248 2002 2030
28.608 2247 2008 2023
28.808 2250 2014 2009
# srcAddr= 1 timeRaw= 950526 timeSec= 29.008 nbrSamples= 9
29.008 2253 2006 2024
29.208 2255 2006 2027
29.408 2250 2004 2022
The fields are described on the Shimmer Getting Started Guide Webpage