Packages for the MSP430 toolchain are available in the Ubuntu repositories. To fetch the required packages, run:
sudo apt-get install build-essential srecord binutils-msp430 gcc-msp430 gdb-msp430 msp430-libc msp430mcu mspdebug dos2unix
This will install the build toolchain and the mspdebug tool.
Writing and Building Firmware
Clone the msp430-template repository (or fork it and clone your own repository).
git clone firstname.lastname@example.org:uctools/msp430-template
Modify the Makefile:
- Set TARGET to the desired name of the output file (eg: TARGET = main)
- Set SOURCES to a list of your sources (eg: SOURCES = main.c two.c three.c)
- Set MCU to the MSP430 part number to build for (eg: MCU = msp430g2231)
The output files will be created in the 'build' folder
To flash a device using mspdebug, run mspdebug and specify a debugger.
For the MSP430 Launchpad, the debugger is
Note, you may need to run mspdebug as root.
In mspdebug, you can load and run the program:
(mspdebug) load build/main.hex (mspdebug) run