Wednesday, March 6, 2013

Install tinyos on Raspberry Pi

sourcehttp://www.mail-archive.com/tinyos-help@millennium.berkeley.edu/msg43109.html
author:   Inglezakis Antonios



You have to install,the following packages from raspbian's repositories first (if they exist). |sudo apt-get install build-essential openjdk-6-jdk openjdk-6-jre python2.7 python2.7-dev automake avarice avr-libc msp430-libc avrdudebinutils-avr binutils-msp430 gcc-avr gcc-msp430 gdb-avr gdb-msp430 subversion graphviz python-docutils git checkinstall

For every needed package than does not exist in raspbian's repositories, you have to build and install it from source code!!!!


|After that, you have to download/clone tinyos source code repository from github
git clone https://github.com/tinyos/tinyos-main.git

Before the complilation of any example, you also need to install from source nesc compiler.
git clone https://github.com/tinyos/nesc.git

cd to nesc source code directory
./configure [--prefix=YOURPREFIXPATH]
make
make install ( or sudo checkinstall if YOURPREFIXPATH is in system directory)
example:

|mkdir -p $HOME/local/compilers
|

|./configure --prefix=$HOME/local/compilers
|

|make
|

|make install|

|export PATH=$HOME/local/compilers/bin:$PATH|


Then you have to build tinyos tools from source code:
|cd tinyos-main/tools
./Bootstrap
./configure --prefix=$HOME/local/tosTools
make all
make install  (or sudo checkinstall  if prefix dir is in system directory)|


After that, you need to set some enviroment variables, so that you can build any application
Create the file $HOME/local/tinyos-env.sh

   #!/bin/bash
   echo "Setting TinyOs 2 enviroment variables!"
   export PATH=$HOME/local/tosTools/bin:$PATH

   export PATH=$HOME/local/compilers/bin:$PATH
   export TOSROOT=$HOME/local/src/tinyos-2x
   export TOSDIR=$TOSROOT/tos
   export MAKERULES=$TOSROOT/support/make/Makerules
   export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
   export PYTHONPATH=.:$TOSROOT/support/sdk/python:$PYTHONPATH
   export PATH=$TOSROOT/support/sdk/c:$PATH|

Then make it executable:

   |chmod +x $HOME/local/tinyos-env.sh|


and make it to be loaded on every terminal start, for your user. Just add the following lines to the $????/.bashrc file.
   |# TinyOS enviroment variables
   |

   |source $HOME/local/tinyos-env.sh|


Raspberry Pi is an ARM based platform, so every precompiled package for i386 or amd64 architecture fails to be installed.
Have a nice day!

Inglezakis Antonios

No comments: