|
If you own the Crossbow(xbow) Mica2 motes, Debian unstable (as of Jan-Feb 2006), and your nerves
are stretching because of several failed attempts to get TinyOS/NesC/Java to run, then this is
for you.
Proper version: TinyOS 1.1.15 (Dec 2005 CVS), NesC 1.1.3, JDK 1.4-1.5.
After struggling for quite a few days to get TinyOS installed, and hitting my head with so many
incompatibility issues, I thought about writing a little guide for those who ran into the same
problems as I did, and didn't find a peaceful way to solve them.
Before starting this, I read some guides on the Internet on how to compile and install TinyOS
from CVS with NesC 1.1.3, but that didn't work. A lot of compilation errors, a lot of time spent
on reading posts on the mailing-list that were describing similar problems, and so on.
Basically the problem arises when you combine different versions of TinyOS with NesC. Getting
the java code to compile and work presented some problems too. All in all, a mess.
I built a small/dumb script that should help those who are just starting out. It will try to get
all the necessary/compatible versions of TinyOS, compile (almost - it's better to compile NesC as
root, or whatever, after you install the TinyOS packages) everything, and present some
instructions on how to use the whole thing. You can download the script here:
TinyOS_Debian_install.sh.
The basic requirements are written at the beginning of the file.
- If that still doesn't help, and you still have compilation errors, here's a short FAQ that could
help you solve them:
- if "make pc" gives an error like this:
...
In file included from /opt/tinyos-1.x/tos/platform/pc/GuiMsg.h:51,
from /opt/tinyos-1.x/tos/types/dbg.h:70,
from /opt/tinyos-1.x/tos/platform/pc/hardware.h:65,
from /opt/tinyos-1.x/tos/system/tos.h:132:
/opt/tinyos-1.x/tos/types/AM.h:156: parse error before 'struct'
/opt/tinyos-1.x/tos/types/AM.h:157: parse error before 'struct'
/opt/tinyos-1.x/tos/types/AM.h:159: parse error before 'struct'
/opt/tinyos-1.x/tos/types/AM.h: In function 'TOS_MsgLength':
/opt/tinyos-1.x/tos/types/AM.h:184: parse error before 'TOS_Msg'
...
it's because:
The offsetof() macro has been changed since Linux kernel 2.6.9. Instead
of using a generic method, it is now replaced by a compiler specific
function __builtin_offsetof() which is not recognized by nesc.
fix with: patch -p1 < builtin_offset.patch.nesc (in nesc)
- 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
...
fix with: patch -p0 < static-clex.patch.nesc (in nesc)
- if building nesc-1.1.3 fails with:
...
semantics.c: In function 'init_data_declaration':
semantics.c:119: error: parse error before '=' token
semantics.c: In function 'duplicate_decls':
semantics.c:1539: error: parse error before '||' token
...
fix with: patch -p1 < noinline.patch.nesc (in nesc)
- if in tools/java, make fails:
use # export CLASSPATH="`$TOSROOT/tools/java/javapath`"
- if:
getenv JNI library not found. Env.getenv will not work (please consult installation directions in tinyos-1.x/tools/java/net/tinyos/util/Env.INSTALL)
then:
copy /opt/tinyos-1.x/tools/java/jni/libgetenv.so to /usr/lib/j2sdk1.5-sun/jre/lib/i386
(of course, /usr/lib/j2sdk1.5-sun should be replaced with your JDK installation)
- if running SerialForwarder (for instance) gives an error like:
Exception in thread "Thread-6" java.lang.VerifyError: (class: gnu/io/RXTXPort$SerialOutputStream, method: flush signature: ()V) Illegal use of nonvirtual function call
at gnu.io.RXTXPort.(RXTXPort.java)
at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java)
at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:627)
at net.tinyos.packet.SerialByteSource.openStreams(SerialByteSource.java:65)
at net.tinyos.packet.StreamByteSource.open(StreamByteSource.java:51)
at net.tinyos.packet.Packetizer.openSource(Packetizer.java:119)
at net.tinyos.packet.AbstractSource.open(AbstractSource.java:77)
at net.tinyos.packet.Packetizer.open(Packetizer.java:114)
at net.tinyos.packet.PhoenixSource.run(PhoenixSource.java:167)
then run it with:
java -noverify net.tinyos.sf.SerialForwarder
- if make in /opt/tinyos-1.x/ fails with:
make[4]: Entering directory /opt/tinyos-1.x/tools/src/uisp/src'
g++ -DHAVE_CONFIG_H -I. -I. -I. -Wall -Werror -g -O2 -c Avr.C
g++ -DHAVE_CONFIG_H -I. -I. -I. -Wall -Werror -g -O2 -c AvrAtmel.C
g++ -DHAVE_CONFIG_H -I. -I. -I. -Wall -Werror -g -O2 -c AvrDummy.C
Global.h: In member function 'void TPt::MkRef()':
Global.h:45: error: 'NULL' was not declared in this scope
Global.h: In member function 'void TPt::UnRef()':
Global.h:46: error: 'NULL' was not declared in this scope
Global.h: In constructor 'TPt::TPt()':
Global.h:48: error: 'NULL' was not declared in this scope
Global.h: In member function 'TRec* TPt::operator->() const':
Global.h:59: error: 'NULL' was not declared in this scope
Global.h: In member function 'TRec& TPt::operator*() const':
Global.h:60: error: 'NULL' was not declared in this scope
Global.h: In member function 'TRec& TPt::operator[](int) const':
Global.h:61: error: 'NULL' was not declared in this scope
make[4]: *** [AvrDummy.o] Error 1
then edit:
tools/src/uisp/src/Global.h
and add:
#include "assert.h"
+#include "string.h"
- if make in /opt/tinyos-1.x/apps/Blink (for example) fails with:
...
avr-gcc: installation problem, cannot exec `cc1': No such file or directory
...
then you probably forgot to install NesC
- Other ideas:
- use JavaX Comm 2.0 Solaris with RXTX (see my installation script);
- if you want to change the duty cycle for mote transmission while using Surge, edit Surge.h and modify "INITIAL_TIMER_RATE = 1024 * 8";
- use the CVS versions of both TinyOS and NesC when you can (you can get TinyOS installed from 1.1.15 for instance, and then copy the newer files from CVS that interest you);
- copy the contrib/xbow/tools/java/net/tinyos/surge stuff over
tools/java/net/tinyos/surge
and start patching the sources there (you need to do that since the surge that comes with
TinyOS is older, the windows are not resized properly, and the sensor value tabs are missing);
- get lots of coffee with you... it will be your only friend during the long hours.
|