Tuesday, October 20, 2015

Using AVRORA simulator with TinyOS

AVRORA is a popular AVR Simulation and analysis framework for simulating the programs developed for AVR micro controllers. This tool can be used to simulate the programs written in TinyOS environment with little modifications. This post explains how TinyOS programs can be simulated using AVRORA.

This was tested in UBUNTU 12.04 OS environment.

Save the files downloaded from the following steps to a folder. In my system it is
/home/prv/avrora

Step 1: Download the converter from http://compilers.cs.ucla.edu/avrora/jars/avrora-beta-1.7.091.jar

Step 2: Rename the downloaded file as avrora.jar

Step 3: Download the converter.sh file from https://drive.google.com/file/d/0B8u5Jm1ly3NYNm41UEU0ZjdzYkU/view?usp=sharing

Step 4: Open the bashrc file
            gedit ~./bashrc
            and add the following lines at the end of the file.

alias avrora='java -jar /home/prv/avrora/avrora.jar'
alias convert-avrora='sh /home/prv/avrora/converter.sh'

Step 5: Save the file and close all the consoles opened.

Now, to test the AVRORA setup, run any application programmed in TinyOS.

For example, go to the folder Blinks available in /opt/tinyos-2.1.2/tos/apps.

compile the program

make mica2

it creates a build folder in which you will find micaz2 sub folder. Move to it.
In micaz2 folder there exists a main.exe file. This file is the main file consists of  application and TinyOS environment.

convert it into avrora environment as follows

convert-avrora main.exe blink.od

Now, run the avrora

avrora -seconds=5.0 -platform=mica2 blink.od

This command runs the blink application for one sensor node. To do the same for multiple nodes use the following command

avrora -simulation=sensor-network -seconds=10.0 -nodecount=2 blink.od

The screen shot after running the command

avrora -simulation=sensor-network -seconds=2.0 -nodecount=1 blink.od

is as follows



References

[1] http://compilers.cs.ucla.edu/avrora/
[2] http://mythicalcomputer.blogspot.in


No comments: