How to setup MSP430 Launchpad in ubuntu

 

 

 

 

 

 

 

 

This will help you to set up MSP430 Launchpad in ubuntu…TI provides support only for windows.we will setup the toolchain,debugger and test ablink led c program.

First install the dependencies needed

$sudo apt-get install git-core gcc-4.4 texinfo patch libncurses5-dev
$ sudo apt-get install zlibc zlib1g-dev libx11-dev libusb-dev libreadline6-dev

Now download mspgcc compiler

git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4
cd mspgcc4
sudo sh buildgcc.sh

The build script will ask a number of questions.  Accept the default by pressing Enter for each question except “Do you want to start build right now?”  The proper response here is of course “yes”!

Download and install mspdebug the debugger

cd ..
git clone git://mspdebug.git.sourceforge.net/gitroot/mspdebug/mspdebug
cd mspdebug
make
sudo make install

Now make a blink.c program

/* Demo app to blink the red LED on the TI Launchpad */
#include <msp430x24x.h>
int main(void) {
 volatile int i;
// stop watchdog timer
 WDTCTL = WDTPW | WDTHOLD;
 // set up bit 0 of P1 as output
 P2DIR = 0x01;
 // intialize bit 0 of P1 to 0
 P2OUT = 0x00;
// loop forever
 for (;;) {
 // toggle bit 0 of P1
 P2OUT ^= 0x01;
 // delay for a while
 for (i = 0; i < 0x6000; i++);
 }
}

Now compile it

$ /opt/msp430-gcc-4.4.5/bin/msp430-gcc -oS -o blink.elf blink.c

Now we generated the elf or executable.use mspdebug to download the program to the board

$ sudo mspdebug rf2500
(mspdebug) prog blink.elf
Erasing...
Programming...
Writing 104 bytes to fc00...
Writing  32 bytes to ffe0...
(mspdebug) run
Running. Press Ctrl+C to interrupt...

The red LED will be blinking right now…

Advertisements