User Tools

Site Tools


tinyos_install

~~REDIRECT>ref:tinyos:install:start~~

Installing TinyOS

Instructions for setting up TinyOS based off the ones found at TinyOS Getting Started. I've updated them as of 2012/01/26 and verified they work with a clean install of Ubuntu 11.10.

Install TinyOS

Step 0: Enable the Stanford tinyos repository

This allows Ubuntu to find the correct packages from the Stanford servers.

Peplace <distribution> with the distribution of Ubuntu you are using: hardy (8.04), jaunty (9.04), karmic (9.10), lucid (10.04), maverick (10.10), or natty (11.04). If you are using something newer than natty, just use natty.

echo "deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main" | sudo tee -a /etc/apt/sources.list
- or -
echo "deb http://tinyos.stanford.edu/tinyos/dists/ubuntu natty main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update

Step 0.5: Make sure you have necessary tools for this process

There are some various linux tools that you need for all of these steps to work. If you already have them you're all set, but you can check by trying to install them. There may be more than this, please add them if you find them.

sudo apt-get install texinfo patch automake g++ python-serial

Step 1: Install the nesc compiler

sudo apt-get install nesc

This doesn't actually install anything I guess. When you install the tinyos tools below you actually install nesc and ncc.

Step 2: Install msp430-gcc

Install msp430-gcc version 4.6.3. You can do it from source, but may the force be with you.

From source 4.6.3
wget http://sourceforge.net/projects/mspgcc/files/mspgcc/mspgcc-20120406.tar.bz2
tar xf mspgcc-20120406.tar.bz2
cd mspgcc-20120406
 
wget http://sourceforge.net/projects/mspgcc/files/msp430mcu/msp430mcu-20120406.tar.bz2
wget http://sourceforge.net/projects/mspgcc/files/msp430-libc/msp430-libc-20120224.tar.bz2
wget http://ftpmirror.gnu.org/binutils/binutils-2.21.1a.tar.bz2
wget http://ftpmirror.gnu.org/gcc/gcc-4.6.3/gcc-core-4.6.3.tar.bz2
 
tar xf binutils-2.21.1a.tar.bz2
tar xf gcc-core-4.6.3.tar.bz2
tar xf msp430mcu-20120406.tar.bz2
tar xf msp430-libc-20120224.tar.bz2
 
cd gcc-4.6.3
./contrib/download_prerequisites
patch -p1<../msp430-gcc-4.6.3-20120406.patch
 
cd ../binutils-2.21.1
patch -p1<../msp430-binutils-2.21.1a-20120406.patch
 
cd ..
mkdir binutils-2.21.1-build
cd binutils-2.21.1-build
../binutils-2.21.1/configure --target=msp430 --prefix=/usr/local/msp430
make
sudo make install
 
# don't compile gcc in its src director, it just doesn't work
cd ../
mkdir gcc-4.6.3-build
cd gcc-4.6.3-build
../gcc-4.6.3/configure --target=msp430 --prefix=/usr/local/msp430 --enable-languages=c
make
sudo make install
 
export PATH=/usr/local/msp430/bin:$PATH
 
cd ../msp430mcu-20120406
sudo MSP430MCU_ROOT=`pwd` ./scripts/install.sh /usr/local/msp430
 
cd ../msp430-libc-20120224/src
make 
sudo PATH=$PATH make PREFIX=/usr/local/msp430 install

Step 3: Checkout the TinyOS 2.x source tree

svn checkout http://tinyos-main.googlecode.com/svn/trunk/ tinyos-main

Step 4: Compile the TinyOS tools

cd tinyos-main/tools
./Bootstrap
./configure
make all
sudo make install

A few ENTERs will be required by the last two commands.

Step 5: Set the environment variables

Add the following to .profile (or .bash_profile or .bashrc depending on your system):

export TOSROOT=$HOME/tinyos-main
export TOSDIR=$TOSROOT/tos
export MAKERULES=$TOSROOT/support/make/Makerules
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
export PYTHONPATH=.:$TOSROOT/support/sdk/python:$PYTHONPATH
export PATH=$TOSROOT/support/sdk/c:$PATH
#export PATH=/usr/local/msp430/bin:$PATH

Step 6: Fix nesc/tinyos include *.h problems

Getting a ton of syntax errors of the can't find the right .h files variety?

vim tinyos-main/support/make/msp/msp.rules

Add the following right before OBJCOPY = msp430-objcopy:

CFLAGS += -I/usr/msp430/include
CFLAGS += -I/usr/lib/gcc/msp430/4.6.3/include

If you used the from source directions above:

CFLAGS += -I/usr/local/msp430/include

shed/tinyos

To setup our TinyOS projects, download the shed/tinyos repository and add the following environmental variables.

export SHED_REPO=<shed location>
export TOSROOTN=$SHED_REPO/tinyos
export TOSMAKE_PATH=$SHED_REPO/tinyos/support/make

OLD -> Not needed

TinyOS Contrib

Additionally, the UDPAccel app by default requires a special print library (see the README.txt file in the UDPAccel directory). This is included in tinyos-2.x-contrib. To download the contrib files: http://tinyos.cvs.sourceforge.net/viewvc/tinyos/tinyos-2.x-contrib/

$ cd $HOME/tinyos/src
$ svn checkout http://tinyos.cvs.sourceforge.net/viewvc/tinyos/tinyos-2.x-contrib/ tinyos-2.x-contrib

Then you must set the environment variable $TOSCONTRIB. Run the following line at the terminal or add it to the same file as in step 5 of the tinyos install instructions.

$ export TOSCONTRIB=$HOME/tinyos/src/tinyos-2.x-contrib
TinyOS Branches

Development versions reside in the branches, and you may want to use them (like Blip 2.0 for instance).

$ cd $HOME
$ svn checkout http://tinyos-contrib.googlecode.com/svn/branches/ tinyos-branches
tinyos_install.txt · Last modified: 2013/02/10 01:13 by bradjc