TinyOS 1.x/2.x All-in-One Packages for Linux
Update: I'm no longer actively involved in TinyOS and these
files may be out of date. You're on your own, and you've been warned ...
;-/
TinyOS is a rudimentary operating system for "motes" — battery-powered
sensor boards with radio transceiver, serial port(s) and a
microcontroller.
Installing TinyOS can be a real pain. Here you can find a single tarball of all the required files.
My package works for Telos/Tmote motes. I have tested it on Ubuntu
Linux Feisty (7.04) server (gcc-3.3) running on VMWare over Mac OS X.
I have not included Mica toolchain.
It is possible to have both TinyOS 1.x and 2.x with these packages. They will be in two different directories. Switching between the two is as simple as running a shell command.
Required kernel modules
For USB-serial communication, load "usbserial" and "ftdi_sio" kernel modules.
sudo modprobe usbserial ftdi_sio
Also, find an unused serial device (/dev/ttyS3 in my case) and point it to the USB port.
cd /dev
sudo mv ttyS3 ttyS3.old
sudo ln -sf ttyUSB0 ttyS3
Make the device writable by non-root users:
sudo chmod go+rw /dev/ttyUSB0
TinyOS 2.x Package
tinyos2.tar.gz (98 MB)
IMPORTANT: If you download and use this tarball, you must agree to the Sun JDK Licence agreement.
This tarball contains:
- tinyos-2.x source tree (2.0.2)
- msp430 tools (Telos)
- Sun JDK 1.5.0 Update 13
- pyserial Python 2.5 package
- nescc tools
- TinyOS tools
Installation
Extract the tarball and you can get started with TinyOS right away. Update your ~/.bashrc with these lines:
tos2x() {
export ORIGPATH=$PATH
export ORIGCLASSPATH=$CLASSPATH
export ORIGLD_LIBRARY_PATH=$LD_LIBRARY_PATH
export TOPDIR=~/tinyos2
export TOSROOT=$TOPDIR/tinyos-2.x-src
export TOSDIR=$TOSROOT/tos
export MAKERULES=$TOSROOT/support/make/Makerules
export TOS2_XTRAS=$TOPDIR/tinyos-extras
export TOS2_TOOLS=$TOS2_XTRAS/tools
export PYTHONPATH=$PYTHONPATH:$TOS2_XTRAS/python2.5/site-packages
export MSP430=$TOS2_XTRAS/msp430
export JAVA_HOME=$TOS2_XTRAS/sun-jdk1.5.0_13
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:$JAVA_HOME/commapi/jar/comm.jar:.
export PATH=$PATH:$JAVA_HOME/jre/bin:$JAVA_HOME/bin:$MSP430/bin:$TOS2_TOOLS/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MSP430/lib:$TOS2_TOOLS/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/commapi/lib
}
(Change TOPDIR to point to the directory you extracted the tarball)
Then source the bashrc and load the variables:
source ~/.bashrc
tos2x
That's about it.
Testing
To test your setup, connect the Telosb mote, go to tinyos-2.x-src/apps/Blink directory and compile the app:
make telosb install
To test the Java toolchain, try running the SerialForwarder:
java net.tinyos.sf.SerialForwarder serial@/dev/ttyS3:telos
If you don't get a JNI error, you're in luck. If you do, you need to create two libraries as follows:
cd tinyos-2.x-src/tools/
./Bootstrap
./configure
cd tinyos/java/
make
Copy the env/libgetenv-32.so and serial/libtoscomm-32.so files to
tinyos-extras/sun-jdk1.5.0_13/jre/lib/i386/ directory. Rename the files
to libgetenv.so and libtoscomm.so. Try running the SerialForwarder
again.
TinyOS 1.x Package
tinyos1.tar.gz (164 MB)
This tarball contains:
- tinyos-1.x source tree (1.1.15)
- avr tools
- msp430 tools (Telos)
- Blackdown J2SDK 1.4.2
- pyserial Python 2.4 package
- nescc tools
- TinyOS tools
Note that the msp430/avr tools in this package are different from those in the 2.x package.
Installation
Extract the tarball and you can get started with TinyOS right away. Update your ~/.bashrc with these lines:
tos1x() {
export ORIGPATH=$PATH
export ORIGCLASSPATH=$CLASSPATH
export ORIGLD_LIBRARY_PATH=$LD_LIBRARY_PATH
export ORIGPYTHONPATH=$PYTHONPATH
export ORIGINCLUDE_PATH=$INCLUDE_PATH
export TOPDIR=~/tinyos1
export TOSROOT=$TOPDIR/tinyos-1.x
export TOSDIR=$TOSROOT/tos
export TOS_XTRAS=$TOPDIR/tinyos-extras
export JAVA_HOME=$TOS_XTRAS/blackdown-j2sdk1.4.2
export TOS_TOOLS=$TOS_XTRAS/tools
export INCLUDE_PATH=/usr/include:$TOS_TOOLS/avr/include
export CLASSPATH=`$TOSROOT/tools/java/javapath`:$JAVA_HOME/commapi/jar/comm.jar:$TOSROOT/beta/Drip/tools/java:$TOSROOT/beta/Drain/tools/java:$TOSROOT/contrib/nucleus/tools/java
export PATH=$JAVA_HOME/bin:$TOS_TOOLS/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JAVA_HOME/jre/lib/i386/client:$JAVA_HOME/lib:$JAVA_HOME/commapi/lib:$TOS_TOOLS/lib:$JAVA_HOME/jre/lib/i386:$JAVA_HOME/jre/lib
export MAKERULES=$TOSROOT/tools/make/Makerules
export PYTHONPATH=$PYTHONPATH:$TOS_XTRAS/python2.4/site-packages:$TOS_TOOLS/python/pytos/util
source $TOSROOT/tools/python/util/pytosProfile
}
(Change TOPDIR to point to the directory you extracted the tarball)
Then source the bashrc and load the variables:
source ~/.bashrc
tos1x
That's about it.
Pytos
I've gotten Pytos to work on Telos motes with this setup. I've included the jpype source in tinyos-extras/ directory. I've edited Oscilloscope application's Makefile and .nc file to work with Pytos. If you do not want it, remove the targets from Makefile and the calls to rpc and ramsymbols from the .nc file. Also, Pytos worked only when I set "localonly=true" in PytosShell.py, based on author Kamin's suggestion. This means you cannot use this Pytos on multi-hop nodes.
Pytos worked only on Blackdown JDK for me. Sun and IBM JDK users: you are on your own.
Testing
To test your setup, connect the Telosb mote, go to tinyos-1.x-src/apps/Blink directory and compile the app:
make telosb install
To test the Java toolchain, first create the jar archive:
cd tinyos-1.x-src/tools/java
make
make
(Yes, you need to do "make" twice.)
Next, try running the SerialForwarder:
java net.tinyos.sf.SerialForwarder serial@/dev/ttyS3:telos
If you don't get a JNI error, you're in luck. If you do, copy the getenv library:
cd tinyos-1.x/tools/java/jni/
cp libgetenv.so tinyos-extras/blackdown-j2sdk1.4.2/jre/lib
Try running the SerialForwarder again.
Toggling between 1.x and 2.x
Add this function to your .bashrc:
notos() {
unset JAVA_HOME
unset TOSROOT
export PYTHONPATH=$ORIGPYTHONPATH
export LD_LIBRARY_PATH=$ORIGLD_LIBRARY_PATH
export CLASSPATH=$ORIGCLASSPATH
export PATH=$ORIGPATH
export INCLUDE_PATH=$ORIGINCLUDE_PATH
}
Source the file. Then you can switch from TinyOS 2.x to 1.x as follows:
notos
tos1x
This file created 11/Nov/2007