TinyOS is becoming the defacto standard OS for sensor network platforms and Ubuntu is most popular distro in Linux flavours. The follwing steps helps to install the TinyOS environment and compile and run the programs.
After everything is done, download this skelton code and verify the installation
UPDATED FOR TINYOS 2.1.1Assumptions
Distribution is Ubuntu Hardy Heron
TinyOS version is TinyOS 2.1.0/ 2.1.1
Username is "test"
If this is not, update information is given at each step with your version
Installation
- Go to System -> Administration-> Synaptic Package Manager ( from the Top Panel )
- In Synaptic Package Manager go to settings ->repositories.
- Take 3rd party Software . Click on Add and copy the following. Assuming that your distribution is Hardy.
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main
or for a different distribution of Ubuntu(deb http://tinyos.stanford.edu/tinyos/dists/ubuntu * main)
- Click OK and then reload repositories
- After reload is done, Search for TinyOS and set install and apply changes.
- Once the installation is finished, set the shell environment. Take a shell and type
gedit ~/.bashrc and add follwing lines at bottomsource /opt/tinyos-2.1.0/tinyos.sh
OR
source /opt/tinyos-2.1.1/tinyos.sh
Checking the Installation- Close the previous shell. Take a new Shell
- Type echo $MAKERULES. If everything is ok, it will display the path.
First Program in TinyOS
Follwing is the simplest program which can be written for TinyOS
Take gedit, copy paste following code.
/* */
configuration SkelAppC { }
implementation
{
components MainC, SkelC;
SkelC -> MainC.Boot;
}
Save as SkelAppC.nc
Take new file in gedit. Type follwing code
/* The SKEL application */
module SkelC
{
uses interface Boot;
}
implementation
{
event void Boot.booted()
{
1;
}
}
Save the file as SkelC.nc
Take new file in gedit
Type following
COMPONENT=SkelAppC
include $(MAKERULES)
Save as Makefile
Verification
Assuming that username is "test" and your files "SkelC.nc, SkelAppC.nc and Makefile" are in /home/test/tinyos/apps
Take a shell. Type following
cd /home/test/tinyos/apps make telosb
If everything is fine, your output should look similar to above one.
(Same code is provided for download)
Links you may be interested
Running TinyOS Programs using Avrora
Running multiple node simulation using Avrora: Example BlinkToRadio