Installing TinyOS 2.1

If you already have a 1.x tree or an existing 2.x tree, you can use the upgrade instructions at
[1], with the added note that Cygwin should be upgraded to the latest version. In cygwin run "cygcheck -c" and check the cygwin entry is 1.5.25-11 or later. As of Apr08, Cygwin is not supported on Windows Vista.

There are two ways to do a clean install of TinyOS. The first way is to install a live CD that gives you a virtualized Linux with a complete TinyOS install. Note that since this is on a CD, you can't modify anything; you can, however, make a LiveUSB device to use as your TinyOS install. The second way is to install TinyOS on your host operating system. When installing on a host operating system, you can either use a debian package repository or manually install with RPMs. There is not yet a live CD for 2.1.

If you typically run tinyos from CVS and only require the toolchain installation, you can install the tinyos-required package instead of the tinyos one to just pull these in.

Keep in mind had inconsistent success with running apt-get upgrade tinyos, so for now it's best to play it safe and remove any old tinyos packages before installing the new ones.

Also you have used the TinyOS debian repository in the past, keep in mind that all of the tools have been updated for TinyOS-2.1, but still work with all older versions of TinyOS as well. If you try updating in this way, and you see conflicts with some deprecated packages, send me an email (cire831@gmail.com), and I'll add them to the conflicts list so that they get removed when the updated tools are installed. These conflicts should be OK so long as you remove any old packages; they are due to a change in the names of the updated packages installing into the same locations as the outdated ones.

Manual installation on your host OS with RPMs

Currently, the TinyOS Core Working Group supports TinyOS on two platforms: Cygwin (Windows)
and Linux. There have been some successful efforts to getting TinyOS environments working
on Mac OSX, but OSX is not supported by the Core WG.

Installing a TinyOS enviromnent has five basic steps; Windows requires an extra step,
installing Cygwin, which is a UNIX-like environment. The steps are:

Installing a Java 1.6 JDK. Java is the most common way of interacting
with mote base stations or gateways that are plugged into a PC or laptop.

Windows only. Install Cygwin. This gives you a shell
and many UNIX tools which the TinyOS environment uses, such as perl and shell
scripts.

Installing native compilers. As you're compiling code for low-power
microcontrollers, you need compilers that can generate the proper assembly code.
If you using mica-family motes, you need the AVR toolchain; if you're using
telos-family motes, you need the MSP430 toolchain.

Installing the nesC compiler. TinyOS is written in nesC, a dialect
of C with support for the TinyOS concurrency model and component-based
programming. The nesC compiler is platform-independent: it passes its output
to the native compilers, so that it can take advantage of all of the effort
put into their optimizations.

Installing the TinyOS source tree. If you want to compile and
install TinyOS programs, you need the code.

Installing the Graphviz visualization tool. The TinyOS
environment includes nesdoc, a tool that automatically
generates HTML documentation from source code. Part of this process
involves drawing diagrams that show the relationships between
different TinyOS components. Graphviz
is an open source tool
that nesdoc uses to draw the diagrams.

Step 1: Install Java 1.6 JDK

Step 2: Install Cygwin

This step is required for Windows installations only. If you are installing
on Linux, skip to step 3.

We have put online the cygwin packages that we've confirmed to be
compatible with TinyOS. The instructions below use those packages. You
can also upgrade your cygwin environment according to the instructions
at www.cygwin.com and your environment will most likely work. A large
number of TinyOS users, upgrade their cygwin packages at least monthly
from cygnus. However, since we can't test what packages are compatible
as they become available daily, we can't confirm that today's set will
work.

Download cygwin-files.zip and unzip it under some local folder say c:/cygwin-files

Go to c:/cygwin-files and start the setup. Use following instructions.

When it ask for "Choose A download source", then use "Install from Local Directory" option

When it ask for "Select Root Install Director" then use following options.

Root Directory: c:\cygwin (or some other directory without spaces in its name)

Install for: All Users

Default Text file type: Unix/Binary

When it ask for "Select local Package directory" then select "c:/cygwin-files" (Note: this location depends on where you have unzip cygwin-files.zip, in step-1 above we have used c:/cygwin-files)

Complete the rest of installation process

Some notes:

You might see a message explaining that you need to reboot because some
files are in use. This most likely means that your cygwin DLL is loaded
and in-use and, therefore, cannot be replaced. When you reboot, the new DLL
will be loaded.

Related to the above warnings, if you see warnings about the cygwin1.dll not
being found, don't worry. All will be well once you reboot and the right DLL is loaded.

You will need the packages rpm, make and perl which are not installed by default. For a complete installation, flex, bison and python are required, too.

Step 3: Install native compilers

Install the appropriate version of the following (Windows or Linux,
avr or msp430 or both) with the rpm command 'rpm -ivh rpm>'.
On
windows, if you get an error claiming that the rpm was intended for a cygwin_nt-5.1 operating system and you're indeed on a windows computer, bypass the erroneous
error by using 'rpm -ivh --ignoreos rpmname'.

†If you receive an rpm error that indicates that you have a newer version already installed, try rpm -Uvh --force††If you receive an rpm error that indicates that you are missing /bin/sh, try rpm -Uvh --force --nodeps

Step 4: Install TinyOS toolchain

The TinyOS-specific tools are the NesC compiler and a set of tools
developed in the tinyos-2.x/tools source code repository. They are
also installed using rpms. If you using the Cygwin version recommended
in these install
instructions, you should install the "Recommended" Windows/Cygwin
nesC RPM.
If you
get strange errors when you try to compile TinyOS programs,
such as the error message "the procedure entry point basename could not be located
in the dynamic link library cygwin1.dll", this is likely due
to a Cygwin version incompatibility: try the "Other" Windows/Cygwin
RPM (1.2.7a).
If you are using Cygwin and installing the nesC RPM
causes an error that the RPM was built for Cygwin,
add the --ignoreos option.

Finally, there are two Linux versions of tinyos-tools, depending
on whether you have a 32-bit or 64-bit machine. The first is the
i386 RPM and the second is the i686 RPM. If you have a 64-bit
Java VM, it is important that you install the i686 RPM or otherwise
the Java support may not work properly.

Step 5: Install the TinyOS 2.x source tree

Now that the tools are installed, you need only install the tinyos 2.x
source tree and then set your environment variables.
Install the appropriate version of the following (Window or Linux)
with the rpm command 'rpm -ivh rpm'.
As with the previous rpms, if you get an error claiming that the rpm
was build for an NT computer and you're on a windows NT computer,
bypass the erroneous error by using 'rpm -ivh --ignoreos
rpmname'.

Ideally, you'll put these environment variables in a shell script that will run when your shell starts, but you needn't
put such a script under /etc/profile.d.
You can use ~/.bash_profile. (in Cygwin, too)

The example
settings below assume that the tinyos-2.x installation is in /opt/tinyos-2.x.
Change the settings to be correct for where you've put your tinyos-2.x tree. Note
that the windows CLASSPATH must be a windows-style path, not a cygwin path. You can
generate a windows style path from a cygwin-style path using 'cygpath -w'. For example:

Change the permissions on any serial (/dev/ttyS<N>), usb
(/dev/tts/usb<N>, /dev/ttyUSB<N>), or parallel (/dev/parport) devices you
are going to use: chmod 666 /dev/<devicename>

Step 6: Installing Graphviz

Go to download page of the Graphviz project
and download the appropriate RPM. You only need the basic graphviz RPM (graphviz-);
you don't need all of the add-ons, such as -devel, -doc, -perl, etc.
If you're not sure what version of Linux you're running,

uname -a

might give you some useful information. Install the rpm with rpm -i rpm-name.
In the case of Windows, there is a simple install program, so you don't need to deal with RPMs.