TmoteSky Linux install on PowerPC (PPC)/Ubuntu Edgy (6.10)
Introduction
This document explains how to install Tmote and and all of it's its needed environment, such as TinyOS 1.x, NESC compiler etc, under Ubuntu Edgy (6.10) running on PPC CPU. Please be noted, this has only been tested on Powerbook G4 configuration so far and is not guaranteed to work on other PPC configurations.
Installation
This document follows the recommended installation of the complete environment for Tmote under Linux, with a few modification where needed for PPC. The original document can be found here.
Ubuntu packages
First, the development packages needs to be installed. Open from the main menu System->Administration->Synaptic Package Manager application.
- Make sure that you have the following package installed:
- build-essential (In this procedure version 11.3 is installed)
- cvs, subversion, autoconf, automake (>= 1.9), python-dev, graphviz, g++4.0, g++3.4 gcc-avr, uisp
Java for PowerPC
Sun doesn't support Java for PowerPC but there are alternatives. For this installation, Java SDK from IBM is chosen because of its popularity and reputation. The installation can be retrieved from here. Choose the 32-bit iSeries/pSeries.Download the SDK AND the Java Communications API. Note!: You don't need the JRE package because it is included in the SDK.
Follow the installation instruction that comes with the download. If you choose to install the SDK somewhere else than suggested as in above, make sure that appropriate changes are made for the JDKROOT variable such as:
export JDKROOT=/opt/IBMJava2-ppc-142
You need also to set the following variable to tell Java what processor (PPC) you are using:
export JITC_PROCESSOR_TYPE=6
(Discard this line)Don't forget to update the Java Communications API files in their appropriate directories. Just follow the same structure as given in the Java Communication API.
Hint:
It's easier to install via the rpm package. Use alien -i tool to extract and install it.
TinyOS 1.x
The TinyOS CVS repository is hosted by the TinyOS SourceForge project. To get the latest version of the code, enter the following commands at the shell prompt; just press Enter when prompted for a password:
cd $HOME
cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos 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
MSPGCC is the compiler used by TinyOS for the TI MSP430 platform. A patched version of this compiler and its supporting tools are necessary for Tmote. 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
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 bsl.py to msp430-bsl, like this:
cd /opt/msp430/bin
ln -s $TOSROOT/tools/src/mspgcc-pybsl/bsl.py ./msp430-bsl
MoteList
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. Symlink the appropriate script it to /usr/local/bin/motelist:
ln -s $HOME/tinyos-1.x/tools/src/motelist/motelist-linux /usr/local/bin/motelist
Note! If you are making the link with superuser, replace $HOME with the appropriate path.
Connect the TMote Sky to your usb port and run:
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
Linux Environment
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.
#IBM-JAVA for PPC G4
export JITC_PROCESSOR_TYPE=6
#/usr/local/bin
export PATH="/usr/local/bin:$PATH"
#Java
export JDKROOT=/opt/IBMJava2-ppc-142
export PATH="$JDKROOT/bin:$PATH"
#MSPGCC
export MSPGCCROOT=/opt/msp430
export PATH="$MSPGCCROOT/bin:$PATH"
# 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
Download the nesC 1.1.3 source archive from SourceForge.
IF building nesc-1.1.3 fails with:
...
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 and patch the following file with:
patch -p0 < static-clex.patch.nesc (in nesc)
Recompile and install it again.
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
Here, there will be some compiling errors. Presumably these error will lead to that some Java classes that will not be compiled. Contribution to these errors are however not known at the time of the writing.
And finally, because we are using Telosb architechture, you need to do the following:
In $JAVA_HOME/jre/lib/javax.comm.properties, comment the line that reads:
#dev/ttyS=PORT_SERIAL
And uncomment the line:
dev/ttyUSB=PORT_SERIAL
TOSComm
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
Test
Now it is time to test if the installation went well. Plug the Tmote Device and write the following command:
motelist
It should give similar response as:
Reference Device Descriptiion
---------- ---------------- ---------------------------------------------
M4A3U434 /dev/ttyUSB0 Moteiv tmote sky
Please note: Even if it is working, there are no reference at this time for telling how well. If you encounter any errors due to the installation, please report it.