Saturday, August 4, 2012

Genereating Packet Object using MIG (TinyOS) problems solving.

Here we are trying to generate TinyOS packet object in Java, that is necessary to interact with Java interface.

First I follow TinyOS documentation, it is very helpful
http://docs.tinyos.net/tinywiki/index.php/Mote-PC_serial_communication_and_SerialForwarder#MIG:_generating_packet_objects

  • We need to add new dependency to the make file
    BUILD_EXTRA_DEPS=<packetstructurename>.class
  • Add a statement to compile from .java to .class
    <packetstructurename>.class: <packetstructurename>.java
            "javac" <packetstructurename>.java  
    #put a tab before javac (not only spacing)
  • Add a statement to explain how to create .java file
    <packetstructurename>.java:
            mig java -target=null -java-classname=<packetstructurename> <headerfile>.h <packetstructurename> -o $@ 
    #put a tab before "mig" (not only spacing)

For further details you can go to the link above.

 Now go to the program directory using cd.
make telosb

Note that the mote I used is TelosB, you may change it as you need.
 Those errors appeared

 In component `HplMsp430InterruptP':
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430InterruptP.nc:262: syntax error before `}'
In component `HplCC2420InterruptsC':
/opt/tinyos-2.1.1/tos/platforms/telosa/chips/cc2420/HplCC2420InterruptsC.nc:60: cannot find `Port14'
/opt/tinyos-2.1.1/tos/platforms/telosa/chips/cc2420/HplCC2420InterruptsC.nc:61: cannot find `Port10'
/opt/tinyos-2.1.1/tos/chips/cc2420/lpl/DummyLplC.nc:39:2: warning: #warning "*** LOW POWER COMMUNICATIONS DISABLED ***"
make: *** [exe0] Error 1

After long googling, could not found  a proper solution to this problem, fortunately these errors don't appear when using Tossim.

make telosb sim

Using this method did not solve the problem of course, it only produces new ones :).

Unknown target telosb
Known targets for TinyOS directory /opt/tinyos-2.1.1/tos
and the specified include directories are:
  epic shimmer2 intelmote2 eyesIFXv1 eyesIFXv2 null iris mica2dot micaz mica2 tinynode telosb shimmer mulle telosa
make: *** [sim-exe] Error 2

I don't know what does that contradicting error mean, but actually it does not matter, I build without problems using micaz instead of , what I want is the .java and .class files, which most likely will be the same (I hope).

Final Note: if you got problem with python like that one.

python2.5-config: Command not found

First check python version

python -V

in my case the version was 2.7, now change the python version seen by TinyOS

cd $TOSROOT/tinyos-2.xxxx/support/make/
sudo gedit sim.extra

Change PYTHON_VERSION entry to your Python Version.

And that is it, hope my first post is useful.