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.