The virtual machine is an Ubuntu based minimal distribution, extended with MSP430 related development tools. The VM is based on a VM that is developed within the European WASP project, so there might be references to that project, for example in the form of user names and directories. To run the virtual machine, you need to install VMware player.
The username and password for the main account are 'wasp' and 'wasp'.
After retrieving the latest version of the source code, the typical workflow would be:
$ makeThe command make uses the file Makefile to convert the source code into a binary ELF file, based on modifications that were made to the individual files. It is possible to add addition rules to that file, such that other output is generated as well.
$ wsim-iclbsn2 --ui --trace=sched.trc --mode=time --modearg=5s SchedTest.elfThe command wsim-iclbsn2 simulates an MSP430-based hardware platform and runs the ELF file SchedTest.elf. The selected time mode ensures that the simulation is stopped after a certain time interval, in this case 5 seconds. A trace of the simulation is saved into file sched.trc. The --ui option indicates that a graphic user interface is shown during the simulation, indicating the activity of the LEDs.
$ wtracer --in=sched.trc --out=wsim.vcd --format=vcdThe command wtracer converts the trace file sched.trc into the trace file wsim.vcd, using the format vcd.
$ gtkwave wsim.vcdThe command gtkwave opens a graphic user interface to inspect the traces from the input file, in this case wsim.vcd. In the SST and Signals sections, you can select the variables and registers that were traced during the simulation.
The virtual machine contains a number of text editors. It is also possible to use an editor from the host operating system by mounting the home directory as a network disk. The instructions for mounting the directory are provided when you open a new terminal window.
Two versions of the MSP430 compiler are provided, version 3.3.6
and version 4.4.2, which are located in /opt/msp430-gcc-3.3.6 and
/opt/msp430-gcc-4.4.2, respectively. The default version is 4.4.2.
The compiler toolchain includes the cross compiler, the debugger,
the standard C libraries and several tools to manipulate or inspect
ELF files for the MSP430.
In case you already have a virtual machine with Linux, you could
try to install the MSP430 GCC versions
from a separate archive.
Additional information about the MSP430 processor is available in MSP430 - general.pdf and MSP430 UART.pdf.
The WSIM instruction level
simulator is provided in /usr/local/bin. The simulator can be
used to run MSP430 ELF files for different platforms. It is possible
to run the simulator to observe the behavior of the LEDs (stand alone),
to debug your code (in combination with msp430-insight) or to create
trace files (which can be converted with wtracer and viewed with
gtkwave).
The WSIM simulator tools indicate which command line options are available
by calling it with the --help option:
$ wsim-iclbsn2 --helpFor tracing specific variables or memory locations, the syntax is not provided in that output. In the WSIM tutorial, the --monitor option is explained. For example, when you want to trace the global variable counter, you can use the following command line:
wsim-iclbsn2 --ui --trace --trace=sched.trc --mode=time --modearg=1s --monitor=counter:w SchedTest.elfwhich will simulate the code for one second and trace the counter value. Note that you have to add the --trace option as well.
The simulator has different execution modes, which are specified with the option --mode=mode. The most useful modes are
msp430-insight --se=SchedTest.elfyou can connect to the simulator by using the menu Run -- Connect to target with the following settings:
Target: Remote/TCP Hostname: localhost Port: 2159
Since the MSP430 processor is mainly used in embedded system, the user interface only simulates the LEDs to provide some feedback. However, when you analyse the behaviour of the application with the gtkwave tool, you should remove the --ui option from the command line, as it slows down the simulation.
For those who want to use their own virtual machine image, you can try the WSIM binaries for Linux.
Although gtkwave
is not specifically for the MSP430, it is a very useful tool to analyse
the traces created by the WSIM simulator. The trace file of the WSIM
simulator has to be converted with the program wtracer to the
VCD format, which can be processed by gtkwave. In case wtracer
terminates with a segmentation fault, the trace file was probably not
closed correctly by the simulator. With the time mode option of
the simulator, you can prevent that the simulator is terminated incorrectly.
Within gtkwave, the following commands are quite useful:
When you traced the program counter, the signal will be difficult to interpret. As a first aid, you can modify the data format of the signal by right-clicking on the name of the signal, and selecting the data format 'Analog - Step'. With 'Insert Analog Height Extension', the signal becomes easier to interpret.
It is also possible to attach a 'translate filter file' to the data format. You can use the maketff.sh script to convert an ELF file into a file that GTKwave can read. By attaching that translate filter file to the program counter, GTKwave can show the name of the active function. After enabling 'View - Show Mouseover', a tooltip will appear with the translated value whenever you press a mouse button and move over the signal.
You can save the layout of your GTKwave signal/window configuration with the 'File - Write Save File' option, and specify the created file as additional argument on the command line. That way, you can more quickly inspect the resulting traces from a simulation.
sudo apt-get install application_nameSince the Linux environment is based on a older, minimal Ubuntu release, the applications might not be the latest versions and certain applications might require a large collection of support libraries.