MSP430 in 64-bit Ubuntu 12.04 Linux – the Arduino Way
As is the case with the Arduino IDE, once installed, the environment can be very easily reconfigured to work with different types of boards and MSP430-family MCUs by selecting the appropriate item from the Tools->Board menu. My own installation process has been helped along big times by other MSPGCC and Energia installation tutorials, such as Sakoman’s here but there were several issues specific to 64-bit Linux which I could not find described elsewhere hence this tutorial.
The 64-bit Linux Energia installation process can be broken down to four steps:- Install prerequisite libraries and binaries
- Download and install Energia. The Energia binaries work on a 64-bit system but mspgcc needs to be recompiled. Included mspgcc binaries won’t work.
- Complile and install 64-bit MSPGCC toolchain. The source codes needed for compiling are included in the Energia download above
- Make sure your system recognises Launchpad as a USB device, has a proper driver, and your user has permissions to use it
please note: on a 32-bit system you can get Energia’s binaries with already pre-compiled mspgcc toolchain utilities and therefore the separate mspgcc install is not required.
Install prerequisites.
In Ubuntu/Debian:
sudo apt-get update sudo apt-get install build-essential sudo apt-get build-dep gcc sudo apt-get install libgmp3-dev libmpfr-dev libmpc-dev sudo apt-get install texinfo texi2html sudo pico /etc/apt/sources.list sudo apt-get build-dep gcc-4.5 sudo apt-get build-dep gcc-4.6 sudo apt-get build-dep gcc sudo apt-get install libstdc++ sudo apt-get install libcurses5-dev sudo apt-get install build-essential sudo apt-get install libncurses5-dev sudo apt-get install zlibc sudo apt-get install libexpat1-dev zlib1g-dev libreadline6-dev sudo apt-get install mspdebug
Download Energia Binary Files (includes MSPGCC4.6 sources) and compile mspgcc
mkdir ~/electronics/energia cd ~/electronics/energia wget https://github.com/downloads/energia/Energia/energia-0101E0008-linux.tgz tar xzf ./energia-0101E0008-linux.tgz cd energia-0101E0008/hardware/tools sudo ./build-mspgcc cd ~/electronics/energia/energia-0101E0008/lib cp 'librxtxSerial64.so' 'librxtxSerial.so'
Update Energia’s start script to point to the right binary path
./build-mspgcc that comes with the Linux binary installs mspgcc into /opt/energia/bin. So, open the energia script and change the header of the fine to export new path.
pico ~/electronics/energia/energia
Edit the file to look like this:
#!/bin/bash
#export PATH=$PATH:/opt/mspgcc/bin
export PATH=$PATH:/opt/energia/bin
APPDIR="$(dirname -- $(readlink -f -- "${0}") )"
cd $APPDIR
for LIB in \
java/lib/rt.jar \
java/lib/tools.jar \
lib/*.jar \
;
do
CLASSPATH="${CLASSPATH}:${LIB}"
done
export CLASSPATH
LD_LIBRARY_PATH=`pwd`/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
export PATH="${APPDIR}/java/bin:${PATH}"
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base
You should be able to start Energia by running ~/electronics/energia/energia (add a menu item to avoid using terminal every time to start Energia if you like). Load one of the standard example that come in the Sketchbook directory, Blink for example, and try to compile it (Verify). At this point you should see no errors, otherwise mspgcc did not get installed properly.
Setting up serial comunication with the Launchpad board
Launchpad requires a USB Abstract Control Model driver called cdc-acm in Linux. If your system already has the cdc-acm driver from a previous install of another USB device that also needed it, you’re fine – you can start uploading your compiled Energia sketches now.
If you don’t have the driver, you will need to install it and make sure it gets associated with Launchpad and your Linux user has permissions to use it.
Plug Launchpad into a USB port and run:
sudo lsusb
You should see a like like this:
Bus 002 Device 013: ID 0451:f432 Texas Instruments, Inc. eZ430 Development Tool
Where 0451:f432 is the ID of the current version of the Launchpad hardware that Newark ships right now. Make note of the ID. The device should become a virtual serial port /dev/ttyACM0
run this to verify that cdc-acm driver is installed:
sudo modinfo cdc-acm
if you don’t see the module’s name in the output, you will need a new cdcacm driver. By the way, it doesn’t help matters much that the driver is called cdcacm and the module loads as cdc-acm (with a dash) – be careful about these naming differenced. The best way to go about reinstalling the patch is to take a look at this thread on TI forums which contains links to patch files and more descriptions. I’m going to have to skip explaining the process in detail because I’m writing this about a week after the actual installation and my records about the process now, after the fact, make very little sense to me, so I would like to avoid confusing my readers. I have used that TI forums page linked above as a guide.
Once you have the driver and the module loads, you still need to add a udev rule so that Launchpad is recognized every time you plug it in and you have permissions to use it:
- create a file called 71-persistent-msp430.rules in /etc/udev/rules.d/ directory
- Add this line in there:
ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0660", GROUP="plugdev"note that eariler versions of Launchpad had “f430″ in there, but the current v1.5 needs “f432″
- Add your user to the group plugdev:
sudo adduser user plugdev
- restart udev service:
sudo service udev restart
Plug Launchpad in now, you should be able to upload your compiled sketches and use it just as you would an Arduino. My Launchpad came with an MSP430G2553 MCU plugged in, so this is what I selected in Tools->Board, so pick the right MCU and program away using your shiny new tool that only set you back $4.30
I anticipate that there may be a lot of questions related to installing Energia and programming MSP430, so I have create a special MSP430 Board in the Forums. Please direct yourt more specific questions and comments there instead of the comments form below for easier-to-use discussion format.
Good luck!




FOR UBUNTU-12.04, 32 BITS
The file /usr/lib/libgmp.so.3 it’s broke, for to solve this problem is necesary to install this library:
sudo ln -s /usr/lib/x86_64-linux-gnu/libgmp.so.10.0.2 /usr/lib/libgmp.so.3
sudo apt-get install libgmp3c2
sudo apt-get update
That’s all.
Thank you very Much!