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. 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
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 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
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, probably 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 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: NEEDS UPDATE!!! 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
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.
2.9 nesC
nesC is the programming language used for TinyOS, and it requires its own front-end compiler. Download the latest version from from SourceForge. BEFORE you compile and install it, there is a small modification to be done. In file nesc-x.x.x/tools/Makefile.in. Go to line 638 (in version nesc-1.2.8a) and change the following line: (cd java && jar cf ../$@ `find . -name '*.class'`) TO (cd java && /opt/IBMJava2-ppc-142/bin/jar cf ../$@ `find . -name '*.class'`) And make sure that the path to the jar file is correct. For some unknown reason, the path is lost during make install script. So far, no response from the developers is given. Now, 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
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 Here, there will be some compiling errors. Presumably these error will lead to that some Java classes will not be compiled. Contribution to these errors are however not known at the time of the writing.
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 2.12 Test Now it is time to test if the installation went well. Write the following comment: motelist
It should give the following response: Reference Device Description
---------------- ---------------------------------------------
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 find some errors or contribution, please report it.