Boomerang Tmote Linux install

From TinyOS Wiki
Jump to: navigation, search

This document describes how to download and install the software and tools necessary to develop for Tmote using TinyOS in Linux.


Initial Environment

This install guide uses certain environment variables which are listed here with their defaults. Double check their values before using them in this guide.

export JDKROOT=/opt/sun-jdk-
export MSPGCCROOT=/opt/msp430
export TOSROOT=$HOME/tinyos-1.x


Java is used for the tools that interface between a mote and your PC. The TinyOS tools have been tested on the Java 2 Platform, Standard Edition v 1.4.2 (J2SE).

After installing the JDK, ensure that JDKROOT is set for your installation, such as:

export JDKROOT=/opt/sun-jdk-

FTDI USB Drivers

The FTDI serial USB drivers have been a part of the 2.4 and 2.6 Linux kernel for some time. These drivers expose the USB on Tmote as a virtual serial port. The driver is called "ftdi_sio".

TinyOS CVS Repository

The TinyOS CVS repository is hosted by the TinyOS SourceForge project. To get the latest, bleeding edge version of the code, enter the following commands at a shell prompt; just press Enter when prompted for a password:

cd $HOME
cvs login
cvs -z3 co tinyos-1.x

After downloading the TinyOS 1.x source code, ensure that TOSROOT is set for your installation, such as:

export TOSROOT=$HOME/tinyos-1.x


MSPGCC is the compiler used by TinyOS for the TI MSP430 platform. A patched version of this compiler its supporting tools is necessary for Tmote.

Linux users can use the build-mspgcc script found in the TinyOS CVS in the directory tinyos-1.x/tools/src/mspgcc/. You can run it directly inside that directory and it will download, compile, and install the patched tools for you.

If the build-mspgcc script does not seem to work, you can also follow the manual compilation instructions described in the ToolChain README (it's complicated) in the same directory as build-mspgcc.

After installing MSPGCC, if you are following along this guide, set the MSPGCCROOT for your installation, such as:

export MSPGCCROOT=/opt/msp430

Patched MSP430 Assembler

The MSP430 assembler patched for TinyOS and nesC is now built as a part of the build-mspgcc script, instructions above.

MSP430-BSL for Tmote

msp430-bsl is the programmer, or "Boot Strap Loader", for the MSP430 developed by the MSPGCC project. Tmote requires a special version distributed with TinyOS to support its unique hardware design. For Linux, just symlink to msp430-bsl, probably like this:

cd /opt/msp430/bin
ln -s $TOSROOT/tools/src/mspgcc-pybsl/ ./msp430-bsl


Motelist is a command-line utility that displays which serial ports have Tmote motes attached, available in $TOSROOT/tools/src/motelist/. The motelist-linux script works with Linux kernel 2.4. The motelist-linux2 script works with Linux kernel 2.6. Try symlinking the appropriate script it to /usr/local/bin/motelist.

For both versions, you'll have to figure out a way to let users read the /proc/tty/driver/usbserial file. I've had success configuring sudo to give all/some users nopassword access to a script that just cats it.

Run it with "motelist"; try "motelist -h" for additional options.

TinyOS Scripts

Some TinyOS scripts, specifically set-mote-id, are necessary to the build process. Install these scripts by entering the following command:

cd $TOSROOT/tools/scripts/ && make install prefix=/usr/local


Now is a good time to fully prepare your environment for Tmote and TinyOS. Add these commands like these to your ~/.bashrc script. Note that the xxxROOT variables must match your installation and must be defined using unix-style paths.

# /usr/local/bin
export PATH="/usr/local/bin:$PATH"

# Java
export JDKROOT=opt/sun-jdk-
export PATH="$JDKROOT/bin:$PATH"

export MSPGCCROOT=/opt/msp430

# TinyOS
export TOSROOT=$HOME/tinyos-1.x
export TOSDIR=$TOSROOT/tos
export CLASSPATH="`$TOSROOT/tools/java/javapath`"
export MAKERULES=$TOSROOT/tools/make/Makerules

Before continuing to the final steps of this guide, ensure that these commands have been executed, possibly by logging back into your bash shell. Compiling in TinyOS requires TOSDIR be set, using the TinyOS Java tools requires that CLASSPATH be properly set, and building for Tmote requires that MAKERULES be set.


nesC is the programming language used for TinyOS, and it requires its own front-end compiler. Download the nesC 1.1.3 source archive from SourceForge. Then, to compile and install nesC, enter the follow command at the shell prompt:

./configure && make && make install

Additionally, install the TinyOS front-end, by entering the following commands at the shell prompt:

cd $TOSROOT/tools/src/ncc
./Bootstrap && ./configure && make && make install

nesC Installation Problems

"token_buffer" failure

Should nesC fail with the following error message:

c-lex.c:123: error: static declaration of ‘token_buffer’ follows non-static declaration
c-lex.h:90: error: previous declaration of ‘token_buffer’ was here

Download this file and apply it from within the nesC folder by typing

patch -p0 < static-clex.patch.nesc

"avr-gcc" failure

Should nesC fail with an error message concerning avr-gcc, make sure you have it installed properly by considering the directions here.

TinyOS Java Tools

The TinyOS Java tools require the MIG utility provided by nesC to generate certain source files for processing messages. Compile the Java sources with the following commands:

cd $TOSROOT/tools/java; make; make

Installation Problems

If installation fails by not finding particular java files, please check that your CLASSPATH variable is set correctly. You can do this using tos-check-env.

If installation fails as a result of avr-gcc missing or not working, please try the solution posted here.


TOSComm is a beta package provided by TinyOS that provides native serial port access to Java. It is required to use tools such as SerialForwarder. TOSComm is intended as a replacement for JavaComm. To install TOSComm, as root, run the following commands:

cd $TOSROOT/beta/TOSComm; make install

If TOSComm doesn't work for you (it is beta software), you can always try JavaComm. JavaComm for Linux requires some effort to install.

Device Nodes

You can check to make sure your system is creating the needed device nodes by plugging a telos into the USB and running motelist. If the mote is found, but is not associated with a device node (e.g., /dev/usb/tts/0), then the device node is not getting created automatically. If your linux distribution is using devfs to manage /dev, the device nodes for the telos (/dev/usb/tts/*) should appear automatically. If your linux distribution is using udev to manage /dev, you may need to augment your local udev rule file (look in /etc/udev/rules.d/) with a line like:

BUS="usb-serial", ID="ttyUSB[0-9]*", NAME="tts/USB%n", SYMLINK="usb/tts/%n"

Finally, if all else fails, you can create these nodes manually with

mkdir /dev/usb; mkdir /dev/usb/tts
for i in 0 1 2 3 4 5 6 7 8 9 10; do mknod /dev/usb/tts/$i c 188 $i; done
chmod -R a+rX /dev/usb; chmod a=rw /dev/usb/tts/*

External Guides

These are webpages established by users of Tmote Sky and/or Moteiv's Telos Revision B platform. Moteiv cannot warrant the accuracy of these pages; however, they may be useful for getting TinyOS running on other systems.


Installing TinyOS on Fedora Core 2 by Tom Mowad

Installing TinyOS on Debian by Markus Becker

Installing TinyOS on Red Hat 9 by Matt Miller

Installing TinyOS on Ubuntu by Chad Metcalf

Potentially Out-of-Date

Installing TinyOS Manually for Telos by Bor-rong Chen