Friday, November 8, 2013

Simulating telosb on TOSSIM

12:38 AM By Unknown , , , , 7 comments

Today when I started to simulate the blink program on tossim 2.x after following a tutorial which gives description on how to write programs for tossim on Eclipse, I was stuck on the part where instructions were given to install the program on actual hardware to see the output. As I had just started with TOSSIM and didn't have a mote hardware, my hunt for a simulator for telosb started.

I have already installed Eclipse Juno and then installed Yeti2 sdk for TinyOs platform. Following are the steps on how to simulate the program on telosb using MSPSim Simulator:

MSPSim is a Java-based simulator of the MSP430 microcontroller. After dowloading the last version of MSPSIM from here, unzip it and place the folder in any location. I placed it in /opt. You can rename the folder to MSPSim for convenience. Now go to the folder /opt/MSPSim. Now mspsim can be installed by entering the command:
make
in the MSPSim folder. Now create the jar package of MSPSim with the command:
make jar
Then a mspsim.jar is created in the directory. For simplicity, you may want to create an alias to MSPSim:
alias mspsim="java -jar PATH_TO_MSPSIM/mspsim.jar"
After that, MSPSim can be lauched with the command mspsim

Simulating the Blink application:

We show in this section how to use MSPSIm on the Blink application. First we need to compile the application for the TelosB mote which uses the MSP430microcontroller with the command:
make telosb
Since MSPSim can open ELF file we have to rename the program file:
mv build/telosb/main.exe build/telosb/main.elf
Then we can run MSPSim:
java -jar /opt/MSPSim/mspsim.jar build/telosb/main.elf
Five windows of MSPSim should open, in one of then you should see a picture of the mote with the LED blinking at different frequency. In the terminal you should obtain a MSPSim prompt:
Flash got reset!
MSPSim>Autoloading script: PATH_TO_MSPSIM/scripts/autorun.sc
-----------------------------------------------
MSPSim 0.97 starting firmware: main.elf
-----------------------------------------------
MSPSim>

This is how simulation of a program on telosb can be done when you don't have the mote hardware.

7 comments:

  1. U r welcome. Hope it helped :)

    ReplyDelete
  2. thank you so much NIV, it is realy very helpful to me

    ReplyDelete
  3. Unfortunately, it donsn't work with me. it gave me this error; please help

    Exception in thread "main" java.io.FileNotFoundException: build (Is a directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.(FileInputStream.java:140)
    at java.io.FileInputStream.(FileInputStream.java:96)
    at se.sics.mspsim.util.ELF.readELF(ELF.java:419)
    at se.sics.mspsim.platform.GenericNode.loadFirmware(GenericNode.java:257)
    at se.sics.mspsim.platform.GenericNode.setupArgs(GenericNode.java:130)
    at se.sics.mspsim.Main.main(Main.java:92)

    ReplyDelete
  4. help me for installing eclipse with tossim...and post some code for wsn in nes c...plz... thanku u....

    ReplyDelete