Thursday, March 15, 2012

Manual Installation of Tiny OS in Ubuntu 11.10 from RPM


 The procedure given is for setting up Tiny OS 2.x in Ubuntu 11.10.

  I had followed the TinyOS wiki page and these are the exact steps i followed for Tiny OS installation for my TelosB mote which is using TIMSP430 processor.

After the installation, i dealt  with an error while compiling the TestSerial application for serial communication. It seems the issue is due to the Ubuntu 11.10 version OS.

1. Install Java

    (1) Install "python-software-properties" package.
apt-get install python-software-properties 
    (2) Add proper Repo for Java package.
           Log out from the current terminal and open a new one.
add-apt-repository ppa:ferramroberto/java 
    (3) Update your local package index.
 apt-get update 
    (4) Now install java packages.
 apt-get install sun-java6-jdk sun-java6-plugin 

2. Install  "rpm" package for installing RPM packages in Ubuntu.
 apt-get install rpm 

3. Install compilers for TIMSP430

      (1) Download msp430tools-base from here.
        http://www.tinyos.net/dist-2.0.0/tools/linux/msp430tools-base-0.1-20050607.i386.rpm
      Install it using this command.
 rpm -Uvh --force --nodeps msp430tools-base-0.1-20050607.i386.rpm 
      (2) Download msp430tools-python-tools from here.
        http://www.tinyos.net/dist-2.0.0/tools/linux/msp430tools-python-tools-1.0-1.noarch.rpm
      Install it using this command.
 rpm -Uvh --force --nodeps msp430tools-python-tools-1.0-1.noarch.rpm 
      (3) Download msp430tools-binutils from here.
        http://www.tinyos.net/dist-2.0.0/tools/linux/msp430tools-binutils-2.16-20050607.i386.rpm
      Install it using this command.
rpm -Uvh --force --nodeps msp430tools-binutils-2.16-20050607.i386.rpm 
      (4) Download msp430tools-gcc from here.
        http://www.tinyos.net/dist-2.0.0/tools/linux/msp430tools-gcc-3.2.3-20050607.i386.rpm
      Install it using this command.
 rpm -Uvh --force --nodeps msp430tools-gcc-3.2.3-20050607.i386.rpm 
      (5) Download msp430tools-libc from here.
        http://www.tinyos.net/dist-2.1.0/tools/linux/msp430tools-libc-20080808-1.i386.rpm
      Install it using this command.
 rpm -Uvh --force --nodeps msp430tools-libc-20080808-1.i386.rpm 
      (6) Downloadmsp430tools-jtag-lib from here.
        http://www.tinyos.net/dist-2.0.0/tools/linux/msp430tools-jtag-lib-20031101cvs-20050610.i386.rpm
      Install it using this command.
 rpm -Uvh --force --nodeps msp430tools-jtag-lib-20031101cvs-20050610.i386.rpm 
      (7) Download msp430tools-gdb from here.
        http://www.tinyos.net/dist-2.0.0/tools/linux/msp430tools-gdb-6.0-20050609.i386.rpm   
      Install it using this command.
 rpm -Uvh --force --nodeps msp430tools-gdb-6.0-20050609.i386.rpm 

4. Install TinyOS toolchain.

      (1) Download nesc from here.
        http://tinyos.stanford.edu/tinyos-rpms/nesc-1.3.1-1.fc9.i386.rpm
      Install it using this command.
 rpm -Uvh --ignoreos --nodeps nesc-1.3.1-1.fc9.i386.rpm 
      (2) Download tinyos-deputy from here.
        http://www.tinyos.net/dist-2.1.0/tinyos/linux/tinyos-deputy-1.1-1.fc9.i386.rpm
      Install it using this command.
 rpm -Uvh --ignoreos --nodeps tinyos-deputy-1.1-1.fc9.i386.rpm 
      (3) Download tinyos-tools from here.
        http://tinyos.stanford.edu/tinyos-rpms/tinyos-tools-1.4.0-3.ubuntu.i386.rpm          Install it using this command.
rpm -Uvh --ignoreos --nodeps tinyos-tools-1.4.0-3.ubuntu.i386.rpm 

5. Install TinyOS 2.x source tree.

      (1) Download tinyos source from here.
        http://tinyos.stanford.edu/tinyos-rpms/tinyos-2.1.1-3.ubuntu.noarch.rpm
      Install it using this command.
 rpm -Uvh --ignoreos --nodeps tinyos-2.1.1-3.ubuntu.noarch.rpm 

6. Add path.

      (1) Open bashrc file.
 vim ~/.bashrc 
      (2) Add the following lines to end of the bashrc file.
export TOSROOT=/opt/tinyos-2.x
export TOSDIR=$TOSROOT/tos
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
export MAKERULES=$TOSROOT/support/make/Makerules
export PATH=/opt/msp430/bin:/opt/jflashmm:$PATH 

7. Graphviz installation.

       (1) You can download graphviz and its dependency libgraphviz from this location.
         http://www.graphviz.org/Download_linux_ubuntu.php
       (3) liblasi0 is a dependency which i installed from ubuntu repo for graphviz.
 apt-get install liblasi0 
       (2) Install graphviz and its dependency.
 dpkg -i libgraphviz4_2.28.0-1_i386.deb

dpkg -i graphviz_2.28.0-1_i386.deb 
      

Errors

(1) Error while compiling the TestSerial application for serial communication.
/apps/tests/TestSerial# make telosb

mkdir -p build/telosb
mig java -target=null -I/opt/tinyos-2.x/tos/lib/T2Hack
-DIDENT_APPNAME=\"TestSerialAppC\" -DIDENT_USERNAME=\"root\"
-DIDENT_HOSTNAME=\"ubuntu\" -DIDENT_USERHASH=0xa3473ba6L
-DIDENT_TIMESTAMP=0x4f634feeL -DIDENT_UIDHASH=0x185584f2L -java-
classname=TestSerialMsg TestSerial.h test_serial_msg -o TestSerialMsg.java
two source files specified (PLATFORM_NULL and IDENT_APPNAME="TestSerialAppC")
failed to parse message file TestSerial.h

make: *** [TestSerialMsg.java] Error 1 

Solution:

  Couldn't solve the issue. It seems  the issue is with the ubuntu version 11.10. I solved the issue by switching back to Ubuntu 10.04 LTS version.

(2) Error with the java files.
        java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb

Exception in thread "main" java.lang.NoClassDefFoundError: net/tinyos/tools/Listen

Caused by: java.lang.ClassNotFoundException: net.tinyos.tools.Listen
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: net.tinyos.tools.Listen.  Program will exit.

Solution:

  1. Download of whole "java" as tarball from Tiny OS CVS repository.
      http://tinyos.cvs.sourceforge.net/viewvc/tinyos/tinyos-2.x/support/sdk/java/
  2. Replace the "java" file from /opt/tinyos-2.x/support/sdk/ with the extracted java file, from the downloaded tarball file.
  3. Go inside the java folder in terminal and give "make" command.
  4. Enjoy.

(3) Error in installing rpm packages.
rpm -Uvh --force --nodeps msp430tools-base-0.1-20050607.i386.rpm

rpm: please use alien to install rpm packages on Debian, if you are really sure use --force-debian switch. See README.Debian for more details.

Solution:
  Use this command instead.
rpm -Uvh --force-debian --nodeps msp430tools-base-0.1-20050607.i386.rpm


(3) Error in "make "
make telosb
make: *** No rule to make target `telosb'.  Stop.

Solution:

This is because you have done the installation as root user and trying to "make" as a different user.
Solve this by doing "make" as root user or give proper permission for that particular user.
sudo chown prasanth:prasanth -R /opt/tinyos-2.x/

5 comments:

  1. Thank you for this tutorial. It is very helpful. But I got stuck at one place. In point 6, its written that 'Add path'. I had gone into /opt/tinyos2.x but couldn't open the bashrc file. What path do I need to add? Please help.

    ReplyDelete
    Replies
    1. Hi Poojarini,

      You dont have to go to opt/tinyos2.x path. Just give this command in your terminal "vim ~/.bashrc " and it will open the required file.
      That was a linux command in which "~" means your home folder and ".bashrc" will be inside your home folder. If you are logged in as "poojarani" in your linux system, above command will open .bashrc file in /home/poojarani/.bashrc. Another thing is .bashrc is a hidden file inside above said folder.

      Delete
  2. I want to install tinyos 1.x so can u give me thats installation steps ..... plzzzzzzzzz

    ReplyDelete
  3. kindly check the complete error I got http://ajeya.wordpress.com/2014/06/13/introduction-to-tinyos-on-cygwin-with-windows-7-ends-in-error-given-here-are-the-errors-but-no-solutions/

    ReplyDelete
  4. Hi ,
    What exactly do you mean by the solution for the Error in 'make'?
    I am trying to install on cygwin and I am getting the same error. So kindly suggest me which command to use.Thank you

    ReplyDelete