This document describes how to upgrade your TinyOS 1.x environment to a TinyOS 2.x environment. This requires that you not only install the TinyOS 2.x rpm, but also that you upgrade your tools from the toolset distributed with TinyOS 1.1.0 and used with all 1.x TinyOS versions up through and including TinyOS 1.1.14. The new toolset was created for use with TinyOS 1.x beyond 1.1.14 as well as TinyOS 2.x. We call this new tooset version the '1.2' toolset.
Because we expect many developers to maintain a 1.x and 2.x tree simultaneously, we will also explain what parts of your environment need to be reconfigured if you switch from TinyOS 2.x to TinyOS 1.x. The 1.2 toolset is backwards compatible with the 1.x TinyOS tree, so switching back and forth requires only a few variable changes. You can find those directions at the bottom of the page.
There are 3 steps to upgrading from 1.x to 2.x:
At this time, we have available compiler toolsets for Atmel AVR and TI MSP430 platforms.
All of the tools are in the http://www.tinyos.net/dist-1.2.0/
and the http://www.tinyos.net/dist-2.0.0
distribution trees, but are linked below for convenience.
Tool | Windows/Cygwin | Linux |
avr-binutils† | avr-binutils-2.15tinyos-3.cygwin.i386.rpm | avr-binutils-2.15tinyos-3.i386.rpm |
avr-gcc | avr-gcc-3.4.3-1.cygwin.i386.rpm | avr-gcc-3.4.3-1.i386.rpm |
avr-libc | avr-libc-1.2.3-1.cygwin.i386.rpm | avr-libc-1.2.3-1.i386.rpm |
avarice | avarice-2.4-1.cygwin.i386.rpm | avarice-2.4-1.i386.rpm |
insight (avr-gdb) | avr-insight-6.3-1.cygwin.i386.rpm | avr-insight-6.3-1.i386.rpm |
rpm -Uvh --force
TI MSP430 Tools
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. Due to file conflicts between the new version
of the tinyos-tools and older NesC installations, you must upgrade
your NesC installation before you upgrade tinyos-tools.
Also, if you plan on maintaining a tinyos-1.x tree
simultaneously with a tinyos-2.x tree, the tinyos-tools installed for the
1.x versions must remain installed so use rpm -ivh
. If you are
only installing a 2.x tree, you can use rpm -Uvh
.
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. If you are using Cygwin and installing the nesC RPM
causes an error that the RPM was built for Cygwin, add the --ignoreos
option.
Tool | Recommended Windows/Cygwin | Other Windows/Cygwin | Linux | Command |
NesC | nesc-1.2.8a-1.cygwin.i386.rpm | nesc-1.2.8b-1.cygwin.i386.rpm | nesc-1.2.8a-1.i386.rpm | rpm -Uvh rpm -Uvh --ignoreos (if Cygwin complains) |
Tool | Windows/Cygwin | 32-bit Linux | 64-bit Linux | Command |
tinyos-tools | tinyos-tools-1.2.4-2.cygwin.i386.rpm | tinyos-tools-1.2.4-3.i386.rpm | tinyos-tools-1.2.4-3.i686.rpm | rpm -ivh --force (1.x tree)rpm -Uvh (no 1.x tree) |
If you have an existing 1.x tree, we strongly recommend that you use
the install (-i
) rpm argument when installing the tinyos-2.x rpm rather
than the upgrade (-U
) argument. The difference is that the -U
will
first remove the tinyos-1.x tree while -i
will not remove previously installed
files. Said another way, we recommend using rpm -ivh
.
If you have an existing 2.x tree which you want to keep unchanged, then you will need to move it to make space for the new one. For example, if you have an existing tree in /opt/tinyos-2.x/, then you can move it to /opt/tinyos-2.x-old. Once you have moved it, we recommend performing a forced installation of the 2.0 tree.
If you have an existing 2.x tree which you do not care about, then we recommend removing it before installing the new one with a forced install.
TinyOS 2.xWindows/Cygwin | Linux | Command | |
TinyOS | tinyos-2.0.2-2.cygwin.noarch.rpm | tinyos-2.0.2-2.noarch.rpm | rpm -Uvh (to upgrade) rpm -ivh (to install) rpm -ivh --force (to force install) |
In TinyOS 1.x, much of your environment was set by the rpm installation process by copying a tinyos.sh file into /etc/profile.d which was subsequently run anytime a shell was started. Because this was deemed unnecessarily invasive, the 2.x rpm does not do this. Rather, you need to set these variables yourself. Ideally, you'll put them in a shell script that will run when your shell starts, but you needn't put such a script under /etc/profile.d.
Please take note of the current settings since you'll need those if you want to work in your current 1.x tree sometime in the future.
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:
export CLASSPATH=`cygpath -w $TOSROOT/support/sdk/java/tinyos.jar` export CLASSPATH="$CLASSPATH;."TinyOS 2.x
Environment Variable | Windows | Linux | |
TOSROOT | /opt/tinyos-2.x | same as in Cygwin | |
TOSDIR | $TOSROOT/tos | same as in Cygwin | |
CLASSPATH | C:\tinyos\cygwin\opt\tinyos-2.x\support\sdk\java\tinyos.jar;. | $TOSROOT/support/sdk/java/tinyos.jar:. | |
MAKERULES | $TOSROOT/support/make/Makerules | same as in Cygwin | |
PATH† | /opt/msp430/bin:$PATH | same as in Cygwin |
In addition to the above environment variables, do the following on Linux machines:
chown -R <your uid> /opt/tinyos-2.x
chmod 666 /dev/<devicename>
Finally, if you have installed TinyOS 2.0.1, there is a bug in TOSSIM (which will be fixed in 2.0.2). The bug is in file tos/chips/atm128/sim/atm128_sim.h. Change these lines 22 and 23 from:
#define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr) + 0x20) #define _SFR_IO16(io_addr) _MMIO_WORD((io_addr) + 0x20)
to
#define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr)) #define _SFR_IO16(io_addr) _MMIO_WORD((io_addr))
If you do not do this, then timers will not work correctly.
Since the tools are backwardly compatible, you need only change your environment variables to point to the 1.x settings. Assuming that your old tree was in /opt/tinyos-1.x, you would use the following values:
TinyOS 1.xEnvironment Variable | Windows | Linux | |
TOSROOT | /opt/tinyos-1.x | same as in Cygwin | |
TOSDIR | $TOSROOT/tos | same as in Cygwin | |
CLASSPATH | `$TOSROOT/tools/java/javapath` | same as in Cygwin | |
MAKERULES | $TOSROOT/tools/make/Makerules | same as in Cygwin |
Switching between the two should require switching only these environment variables.