Table of Contents
This chapter presents the timers example. This application written for the WSN430 hardware platform aims at demonstrating WSim's capability to simulate interrupts. We will also discuss setting breakpoints in an application using LPMs (Low Power Modes).
If you are using the Worldsens Live CD, go to /opt/worldsens/examples/wsn430-timer
.
If not, go to $WSIM_FOLDER/examples/wsn430-timer and type
:
[wsn430-timer]$
make
You should see:
msp430-gcc -mmcu=msp430x1611 -O2 -Wall -I../wsn430-leds -I../wsn430-clock -I../wsn430-serial -g -c -o main.o main.c
msp430-gcc -c -mmcu=msp430x1611 -O2 -Wall -I../wsn430-leds -I../wsn430-clock -I../wsn430-serial -g ../wsn430-clock/clock.c
msp430-gcc -c -mmcu=msp430x1611 -O2 -Wall -I../wsn430-leds -I../wsn430-clock -I../wsn430-serial -g ../wsn430-serial/uart1.c
msp430-gcc -mmcu=msp430x1611 -O2 -Wall -I../wsn430-leds -I../wsn430-clock -I../wsn430-serial -g -c -o timer.o timer.c
msp430-gcc -mmcu=msp430x1611 -o wsn430-timer.elf main.o clock.o uart1.o timer.o
msp430-objcopy -O ihex wsn430-timer.elf wsn430-timer.a43
msp430-objdump -dSt wsn430-timer.elf >wsn430-timer.lst
If you are not using the Worldsens Live CD and you see an error, make
sure all the tools are in your $PATH
.
Once the example is compiled, you can execute it using WSim with the same options presented in the previous example, i.e.:
ui
: to show the user interface (i.e. the LEDs blinking).trace
: write simulator traces in a file (wsim.trc
).mode
: WSim mode (time
, steps
or gdb
); if this is not specified, WSim will run forever.modearg
: if mode is time
or steps
,
then this option will specify the simulation time in nanoseconds or number of steps.The command to type is therefore the following (expected output is included below):
[wsn430-timer]$
wsim-wsn430 --ui --trace --mode=time --modearg=100000000000 wsn430-timer.elf
WSim 0.82cvs, copyright 2005, 2006, 2007 Worldsens wsim:pid:22830 wsim:log:wsim.log
The mode option | |
---|---|
As explained above, when the |
After having converted the trace file as explained in the previous example,
you will again obtain EPS files for each type of data: wsim.gp.CC1100_state.eps
,
wsim.gp.ds2411.eps
, wsim.gp.Interrupt.eps
,
wsim.gp.led1.eps
, wsim.gp.led2.eps
,
wsim.gp.led3.eps
, wsim.gp.m25p80.eps
,
wsim.gp.msp430_aclk.eps
, wsim.gp.msp430_mclk.eps
,
wsim.gp.msp430_smclk.eps
, wsim.gp.Power_mode.eps
,
wsim.gp.Usart0.eps
, wsim.gp.Usart1.eps
.
However, this time, besides from LED files, another interesting file to analyse is the interrupt file,
wsim.gp.Interrupt.eps
, which presents harware interrupts issued during
the execution of the program by the simulator. This file is included below, as well as LED trace files: