The MSP430 toolchain should be installed into an Ubuntu 18.04LTS virtual machine. It allows us to compile, debug and also flash (write a program into ROM) code for the TI Launchpad.
Some common binaries we will be using in this class are:
msp430-gccfor compiling C code to MSP430 machine code (
mspdebugfor reprogramming the MSP430G2553 chip on the board
msp430-objdumpfor dumping out the contents of a compiled
msp430-gdbfor live debugging of the MSP430G2553 microcontroller as it is running
wget -qO- https://maccreery.cs.wmich.edu/shared/script.sh | bash 2>&1 | tee script.log
- Copy & paste this line into a terminal inside an Ubuntu VM and press enter.
- It will install all needed components for this class and then restart the OS.
Here is a short explaination of how to use each of the tools.
This is the MSP430 C Compiler. It is a patched version of the GNU C Compiler (GCC). We need to run this in order to translate our C source code into MSP430 machine code. For example, we can execute:
msp430-gcc -mmcu=msp430g2553 -o output.elf source.c
in order to compile the C source file
source.c to an MSP430 machine code file named
output.elf. The word given after the
-o switch will determine what the output file is named. It is a good idea to name them with the
.elf extension as that is the type of file it will create.
This program will allow us to communicate with the board in order to reprogram the chip that is installed on it (the black, rectangular centipede with silver feet). If there is a MSP430 machine code file named
output.elf in the current directory, we could execute:
mspdebug tilib 'prog output.elf'
and it will transfer the
output.elf machine code to the MSP430G2553 chip.
This program is able to decompile an MSP430 machine code file. So, it takes a
.elf file as input and can output to the screen the actual instructions the machine code represents. For example, we can execute:
msp430-objdump -D hworld.elf
and it will decompile all sections in the file, showing the actual instructions that will be executed for each 2, 4 or 6 byte sequences.
Finally, this is a patched version of the GNU Debugger which will allow us (with the help of
mspdebug) to debug a program running on the MSP430. This includes setting and removing code breakpoints, inspecting variables in scope and also reading and setting contents of memory (RAM).