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.

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

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

main.c
#include <msp430g2553.h>
 
#define pause for (i=0; i < 100; i++) wait(7000)
 
void wait(int ticks)
{
	TAR=0;
	while(TAR < ticks) _NOP();
}
 
void main(void)
{
	int i = 0;
	WDTCTL = WDTPW + WDTHOLD; // stop watchdog
 
	TACTL = TASSEL_2 | MC_2;
 
	// setup TXD and RXD
	P1SEL =  0;   // all ports GPIO
	P1DIR = 0xFF; // all is output
 
 
	while(1)
	{
		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 <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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.

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