Leo:HowTo-install-TinyOS

From DiLab
Revision as of 00:34, 10 December 2008 by Leo (talk | contribs) (Install TinyOS 2.x)
Jump to: navigation, search

TinyOS Development Environment Setup

Install Ubuntu

More here: http://www.ubuntu.com

At the time of this writeup we are using Ubuntu 8.04 (July 2008).


Install TinyOS 2.x

Adapted from http://www.5secondfuse.com/tinyos/install.html and [WSN project at the University of Skovde].

In order to ensure you have all the required packages, you'll need to add the Stanford's TinyOS repository. In this example I have Ubuntu 8.04 (Hardy Heron) and will therefore ask for "hardy main".

First, as root, open the /etc/apt/sources.list file

Then add the Stanford repository.

 deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main

Now you just need to add the packages.

sudo apt-get update
sudo apt-get install cvs subversion autoconf automake1.9 python-dev  
sudo apt-get install g++ g++-3.4 gperf swig sun-java5-jdk graphviz alien fakeroot
sudo apt-get install tinyos

To make sure that we have no interference with the USB->Serial connection we may want to remove the 'brltty' package.

sudo apt-get remove brltty 

Finally we need to make a logical link to the /opt/tinyos-2.x. If your tinyos2 installation is located in /opt/tinyos-2.0.2 we do the following:

cd /opt
sudo ln -s tinyos-2.0.2 tinyos-2.x

Environment Variables

This guide sets up your development environment so you can use TinyOS 1.x, TinyOS 2.x, and Boomerang. To make life easy you can download this file here http://www.5secondfuse.com/tinyos/.bash_tinyos and save it to your home directory. You'll need to add a line to your .bashrc (in your home directory) to source this file on login. If you use a different shell it would be fairly trivial to change over.

# Add this to your .bashrc
if [ -f ~/.bash_tinyos ]; then
    . ~/.bash_tinyos
fi

The script will allow you to switch between environments on fly. It will also define your $TOSROOT setting.

metcalfc@TinyLaptop:~$ tos1BR Setting up for TinyOS 1.xBR ... Do TinyOS 1.x work ...BR metcalfc@TinyLaptop:~$ tos2BR Setting up for TinyOS 2.x ...BR ... Do TinyOS 2.x workBR

Install TinyOS 1.x

Residing in a directory (e.g. your home directory), use:

cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-1.x
sudo mv tinyos-1.x /opt

Optional: Install TinyOS from CVS

If you decided to use the bleeding edge from cvs. You can put it anywhere. Here I've chosen my home directory. You'll still have the official release in /opt. You'll also need to update your .bash_tinyos to reflect where you put it.BR

cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-2.x
cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-2.x-contrib

Java Serial Communications for TinyOS 1.x

You'll need to install TOSComm in order for your TinyOS 1.x Java toolchain to work. Yes, the TinyOS-tools package from TinyOS 2.x does this but it doesn't work for 1.x. And yes the two can coexist in your $JDKROOT.BR

The installer detects the wrong location to install the files to because of the alternatives setup. Edit the JAVADIR rule in the $TOSROOT/beta/TOSComm/comm/Makefile with (This is for your TinyOS 1 installation):BR

JAVADIR=/usr/lib/jvm/java-6-sun

Now install it. We'll alias g++ to the correct version so we don't have to edit anymore makefiles.BR

alias g++=g++-3.4; cd $TOSROOT/beta/TOSComm/comm; make
sudo make install

Compile Java Tools for TinyOS-1.x

You may need to (re)compile java tools such as teh Listener after getting the sources from CVS.

cd /opt/tinyos-1.x/tools/java
make


Compile Java Tools for TinyOS-2.x

You may need to (re)compile JNI libraries for TinyOS java SDK, for example, if you get the env JNI error after trying to start "java net.tinyos.tools.Listen"

cd /opt/tinyos-2.x/tools
sudo tos-install-jni 

If this does not help, see the README file in the same directory to configure and make.

Further reading

Now you are ready to work with TinyOS and motes.


Here are some tips on how to do that.