User Tools

Site Tools



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 lucid main" | sudo tee -a /etc/apt/sources.list
- or -
echo "deb 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
tar xf mspgcc-20120406.tar.bz2
cd mspgcc-20120406
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
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
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
sudo make install
export PATH=/usr/local/msp430/bin:$PATH
cd ../msp430mcu-20120406
sudo MSP430MCU_ROOT=`pwd` ./scripts/ /usr/local/msp430
cd ../msp430-libc-20120224/src
sudo PATH=$PATH make PREFIX=/usr/local/msp430 install

Step 3: Checkout the TinyOS 2.x source tree

svn checkout tinyos-main

Step 4: Compile the TinyOS tools

cd tinyos-main/tools
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


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:

$ cd $HOME/tinyos/src
$ svn checkout 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 tinyos-branches
tinyos_install.txt · Last modified: 2013/02/10 01:13 by bradjc