CoffeeBreak Tutorial #1 : Setting up Ubuntu 12.04LTS 64bit to say hi to MSP430

I am starting this series to document all the hiccups/issues/problems, i face while doing stuff i like.This can be a log as well as a help to fellow makers.

I recently moved to Ubuntu on a new system as my Laptop had started to develop some hardware issues with the Graphics Card that require uncalled investment which i am not currently interested in! I am preparing for some exams and this post was a result of my small concentration session ๐Ÿ™‚

PS: I am still a Linux Noob and follow the “google-when-stuck” strategy or ask for help from my friend RKS!

Now lets get started,

We need the following modules/packets to get running

  1. binutils-msp430- Binary Utilities for MSP430 -Linker,Assembler etc
  2. gcc-msp430- GCC compiler
  3. msp430-libc- C Libs
  4. mspdebug- the programmer

So, to get them all just type this in Terminal (Ctrl+Alt+T)

sudo apt-get install binutils-msp430 gcc-msp430 msp430-libc mspdebug

This will install all the required files.

To check that all went as you wanted you just type the following to get the corresponding outputs as shown:

on typing


in terminal you should get:

Screenshot from 2014-02-17 18:28:28on entering mspdebug rf2500 you should get:

Screenshot from 2014-02-17 18:29:18Now why “rf2500”? This is the device that the launchpad uses while programming the on-board MSP430 using spy-by-wire.

Now lets see how the device enumerates on the USB bus by doing



on terminal

The output before and after is shown:

Screenshot from 2014-02-17 18:06:25You can see the device 008 here is our Launchpad!

On connecting the Launchpad and running mspdebug as before we get:

Screenshot from 2014-02-17 18:30:55leaving us with mspdebug prompt to play with! For the time, lets just exit.

Now lets start with the blinky here. This was written for CCS but lets see if it works for gcc as well!

A few modifications with geany IDE and save it as main.c in home !

Screenshot from 2014-02-17 18:45:40The next task is to compile the c file into an .o file using the msp430-gcc and then linking it to get an .elf file which can be burned onto the chip. Seems a lot? It is fun though!

The commands are as follows:

msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -c main.c

-Os -Optimization for low space

-Wall -Warnings all (show and not supress)

g –ย is used to embed debug info

-mmcu -which mcu?

-c to compile

Screenshot from 2014-02-17 18:52:14It throws up an ignorable warning!

Now lets link it ! You might have noticed a .o file created in home.

msp430-gcc ย -g ย -mmcu=msp430g2553 -o main.elf main.o

-o is to give out the output file. rf2500 accepts in .elf while BSL ones take .txt. We are concerned about .elf .

Screenshot from 2014-02-17 18:52:33Now you see a .elf file as well ! We have got our gold \m/ !

Now just burn/download it to launchpad using :

sudo mspdebug rf2500 'erase' 'load main.elf' 'exit'

erase- it will erase the mcu

load will (down)load/burn the file into the mcu flash.

exit-will exit.

Screenshot from 2014-02-17 18:52:57If everything went well, we will have a blinking red led on board. Phew!! Thats a lot !

You can play with the commands on mspdebug and try setting breakpoints and doing most of the things that can be done in CCS !

Update: RKS tipped me with an easier recipe for GUI friendly compiing! He sent this screenshot where he configures Geany to compile the code with 2 keyboard presses and 2 button clicks! Thats FAB!


He says,Go to Menu-> Set Build Commands. You can then add a label as Flash label will not be available over there by clicking on it. and fill the fields as he mentions:

Compile: msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -c “%f”

Build: msp430-gcc -g -mmcu=msp430g2553 -o “%e.elf” “%e.o”

Flash: mspdebug rf2500 ‘erase’ ‘load %e.elf’ ‘exit’

and hit OK! You are done! Thats pretty nice and cool! Thanks Champ!! ๐Ÿ˜€

Update 2: It can get easier(lasier)! Just 3(4) Keystrokes..

Add what you did for Flash menu in the execute field as in the screenshot. So now its just F8–>F9–>F5–>Enter

Screenshot from 2014-02-17 22:52:38

Comparison to CCS:

Pros: Fast and less memory intensive as everything is on the command line. Setting up is fast and most code can be cross compiled,Free as in no code limit,Geeky,Split Second Compilation ๐Ÿ˜€

Cons: Less supported, boring without a GUI, Serial/UART is not supported out of the box,Smaller community!



Sometimes you may also need to add a udev rule so that the system can identify the msp430 launchpad.Follow this

BTW my Configuration: Ubuntu 12.04LTS 64bit , Launchpad v1.5