Looks like you're having trouble with the toscomm library underlying the 
TOSCommJNI class.  I 
can tell you about it for 2.x.

First off, you need to have a copy of the library for your platform.  It should 
be named 
something like libtoscomm.so.  The source code for the library is in the 
tools/tinyos/java/serial directory.  The second requirement is that you place 
this in the proper 
path for Java to load it (more on this below).  The third requirement is that 
its dependencies 
are available on your system.

In my version of TinyOS, the code attempts to statically load the library along 
with the 
TOSCommJNI class, so theoretically it would fail out before even getting to the 
constructor.  It 
is interesting that you did not get an error at this point, almost as though 
the library had 
loaded but lacked necessary symbols.


There are a number of tests you can employ to find out more about what is 
happening on your 
system.


First, you can find out the library path that Java uses.  You can query it as a 
property in 
Java:

  System.out.println("library path: " + 
System.getProperty("java.library.path"));

Some versions of Java may also let you set it on the command-line, but be 
careful about assuming 
what that means even if it does.



Second you can look at the library itself, and see what it exports:

  nm libtoscomm.so

Assuming it hasn't been stripped, you should see a list of functions.  The ones 
used by 
TOSCommJNI are things like

  00011230 T Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1read_1_1SWIG_10
  000118c4 T Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1read_1_1SWIG_11

with the Java_* stuff at the beginning.  These in particular are the read() 
methods.  You should 
make sure they exist.


Next, you might want to check the library's dependencies to ensure they are 
available and that 
it can load them.

If you have the ldd program, use it.  If not then run the /lib/ld-2*.so with 
the --list option.

  ldd libtoscomm.so
OR
  /lib/ld-[some number].so --list libtoscomm.so

You might see something like

# /lib/ld-2.3.2.so --list cdc/lib/libtoscomm.so
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40022000)
        libm.so.6 => /lib/libm.so.6 (0x400fd000)
        libgcc_s.so.1 => libgcc_s.so.1 (0x40177000)
        libc.so.6 => /lib/libc.so.6 (0x40187000)
        /lib/ld-2.3.2.so => /lib/ld-2.3.2.so (0x2aaaa000)

The libstdc++.so.5 library caused me a lot of trouble, as well as the 
libgcc_s.so.1 library.  
Versions matter, as do locations.

Make sure those dependencies are satisfied.  At this point, it might be worth 
noting the 
LD_LIBRARY_PATH environment variable which lets you set custom paths for these 
libraries, so you 
can include them without dumping them into your system folders.  An override of 
locations.


I hope that helps.

Jon.

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to