This is an old revision of the document!

Using the MSP430 Launchpad in Arch Linux

Start by installing all the stuff listed in the top part of this document.

You can get all this stuff through AUR, and its dependencies through pacman.

  • binutils-msp430
  • gcc-msp430
  • msp430-gdb
  • msp430-libc
  • msp430mcu
  • mspdebug

Next, you need a make file. This one has worked for me.

CFLAGS=-Os -Wall -g -mmcu=msp430g2553
all: $(OBJS)
	$(CC) $(CFLAGS) -o main.elf $(OBJS)
%.o: %.c
	$(CC) $(CFLAGS) -c $<
	rm -fr main.elf $(OBJS)

Get your hands on some sample code to play with, something like this that blinks an LED works fine.

#include <msp430g2553.h>
#define pause for (i=0; i < 100; i++) wait(7000)
void wait(int ticks)
	while(TAR < ticks) _NOP();
void main(void)
	int i = 0;
	WDTCTL = WDTPW + WDTHOLD; // stop watchdog
	// setup TXD and RXD
	P1SEL =  0;   // all ports GPIO
	P1DIR = 0xFF; // all is output
		P1OUT ^= (BIT0); // toggle bit0 (red LED)
		pause; // wait

Now, type “make”. If jesus loves you, this should happen:

[john@TX100 blinktest]$ make 
msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -c main.c 
main.c:11:6: warning: return type of 'main' is not 'int' 
msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -o main.elf main.o 
[john@TX100 blinktest]$ ls 
main.c  main.elf  main.o  makefile

Now, start mspdebug:

[john@TX100 blinktest]$ sudo mspdebug rf2500
MSPDebug version 0.18 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2011 Daniel Beer <>
This is free software; see the source for copying conditions.  There is NO
Trying to open interface 1 on 004
Initializing FET...
FET protocol version is 30066536
Configured for Spy-Bi-Wire
Set Vcc: 3000 mV
Device ID: 0x2553
Device: MSP430G2553
Code memory starts at 0xc000
Number of breakpoints: 2
fet: FET returned NAK
fet: warning: message 0x30 failed

Available commands:
    =         delbreak  gdb       load      opt       reset     simio
    alias     dis       help      locka     prog      run       step
    break     erase     hexout    md        read      set       sym
    cgraph    exit      isearch   mw        regs      setbreak

Available options:
    color           gdb_loop        iradix
    fet_block_size  gdbc_xfer_size  quiet

Type "help <topic>" for more information.
Press Ctrl+D to quit.


Now at this point, things get a little bit convoluted. I think the guide I linked above does a few extra/weird things, but whatever, it works.

At the (mspdebug) prompt, type 'erase' to wipe the chip, then type prog main.elf and your program will be dumped on the chip. Now you need to start the debugger. I suggest you use tmux or screen for all of this, because you'll need two terminals at once. In the first terminal, run the command 'gdb' and switch to another terminal. Here, run msp430-gdb main.elf as a standard user. At the (gdb) prompt, enter 'target remote localhost:2000' and then type continue. After a few seconds, your program should start and your LED will begin blinking.

msplinux.1329272523.txt.gz · Last modified: 2018/03/06 08:59 (external edit)
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0