Installing TinyOS on Ubuntu

Distribution used: Precise Pangolin (12.04 x64)

TinyOS doesn’t have repository for precise. Hence we will use Lucid’s repository in-order to download and install TinyOS. Add this line to /etc/apt/sources.lst

deb lucid main

Update the apt-get repository using this command:

$ sudo apt-get update

Install TinyOS through apt-get

$ sudo apt-get install tinyos-2.1.1

In-order to execute the compile the nesc codes you may need to change the ownership of TinyOS root directory to your user.

$ sudo chown vayya:vayya -R /opt/tinyos-2.1.1/

Install python development package (headers) (*optional only for TOSSIM)

$ sudo apt-get install python-dev

Add the following lines to .bashrc in your home directory

export TOSDIR=$TOSROOT/tos
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.$CLASSPATH
export MAKERULES=$TOSROOT/support/make/Makerules
export PATH=/opt/msp430/bin:$PATH
source /opt/tinyos-2.1.1/

Install the Java tools by:

$ sudo tos-install-jni
Installing 64-bit Java JNI code in /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64 ....

Installing Java docs
Go to /opt/tinyos-2.1.1/support/sdk/java

$ make
$ make install
$ make javadoc 

Compiling and installing my first TinyOS program

Go to opt/tinyos-2.1.1/apps/Blink and compile the code using command make.

$ make micaz
mkdir -p build/micaz
compiling BlinkAppC to a micaz binary
ncc -o build/micaz/main.exe -Os -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=micaz -fnesc-cfile=build/micaz/app.c -board=micasb -DDEFINED_TOS_AM_GROUP=0x22 --param max-inline-insns-single=100000 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"seshagiri\" -DIDENT_HOSTNAME=\"ATI\" -DIDENT_USERHASH=0x9ec8e428L -DIDENT_TIMESTAMP=0x50b486edL -DIDENT_UIDHASH=0xef33ececL -fnesc-dump=wiring -fnesc-dump='interfaces(!abstract())' -fnesc-dump='referenced(interfacedefs, components)' -fnesc-dumpfile=build/micaz/wiring-check.xml -lm
compiled BlinkAppC to build/micaz/main.exe
2048 bytes in ROM
51 bytes in RAM
avr-objcopy --output-target=srec build/micaz/main.exe build/micaz/main.srec
avr-objcopy --output-target=ihex build/micaz/main.exe build/micaz/main.ihex
writing TOS image

Where Micaz is a widely used wireless mote (see the image below)

Done! Let the coding begins now 🙂


One comment

  1. i am trying to execute make micaz command it shows error….as
    mkdir -p simbuild/micaz
    make: python2.5-config: Command not found
    make: python2.5-config: Command not found
    make: python2.5-config: Command not found
    placing object files in simbuild/micaz
    writing XML schema to app.xml
    compiling BlinkAppC to object file sim.o
    ncc -c -shared -fPIC -o simbuild/micaz/sim.o -g -O0 -tossim -fnesc-nido-tosnodes=1000 -fnesc-simulate -fnesc-nido-motenumber=sim_node\(\) -fnesc-gcc=gcc -Wall -Wshadow -Wnesc-all -target=micaz -fnesc-cfile=simbuild/micaz/app.c -board=micasb -DDEFINED_TOS_AM_GROUP=0x22 –param max-inline-insns-single=100000 -DIDENT_APPNAME=\”BlinkAppC\” -DIDENT_USERNAME=\”root\” -DIDENT_HOSTNAME=\”ubuntu\” -DIDENT_USERHASH=0xa3473ba6L -DIDENT_TIMESTAMP=0x55143bd2L -DIDENT_UIDHASH=0xfa35b294L -Wno-nesc-data-race -fnesc-dump=components -fnesc-dump=variables -fnesc-dump=constants -fnesc-dump=typedefs -fnesc-dump=interfacedefs -fnesc-dump=tags -fnesc-dumpfile=app.xml
    two source files specified (PLATFORM_MICAZ and BOARD_MICASB)
    make: *** [sim-exe] Error 1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s