msp430 MSPGCC Eclipse Ubuntu Tutorial
msp430 MSPGCC Eclipse Ubuntu Tutorial
ECLIPSE
MSPGCC
UBUNTU
TUTORIAL
Peter from Slovenia, Ptuj
August 2007
This tutorial describes how to install mspgcc and mspgdb using deb packages and set eclipse for msp430
debugging under Ubuntu.
I use Ubuntu 7.04 Feisty Fawn.
Things I had to do to make it work:
ECLIPSE:
I installed Eclipse using Automatix2:
Figure 1: Automatix2
CDT:
Then I downloaded following plugins for Eclipse from http://www.zylin.com
:
● embeddedcdtlinuxgtk20070424.zip
● zylincdt20070424.zip
Extracted and copied its contents to "features" and "plugins" directory here:
● /usr/lib/eclipse/plugins
● /usr/lib/eclipse/features
MSPGCC:
I used this rpms for mspgcc from this tutorial (http://www.linuxjournal.com/article/8682):
Downloaded from the cdk4msp SourceForge download page:
cdkmspbase0.220031111.i386.rpm
cdkmspbinutils2.1420031106.i386.rpm
cdkmspexampleslibc20031101cvs20031102.noarch.rpm
cdkmspexamplesmspgcc20031101cvs20031102.noarch.rpm
cdkmspgcc3.3.220031106.i386.rpm
cdkmspgdb5.1.120031106.i386.rpm
cdkmspgdbproxy5.1.120031106.i386.rpm
cdkmspjtaglib20031101cvs20031102.i386.rpm
cdkmsplibc20031101cvs20031102.noarch.rpm
and converted them to .deb using alien which I installed using synaptic:
sudo alien k cdkmspbase0.220031111.i386.rpm
sudo alien k cdkmspbinutils2.1420031106.i386.rpm
sudo alien k cdkmspexampleslibc20031101cvs20031102.noarch.rpm
sudo alien k cdkmspexamplesmspgcc20031101cvs20031102.noarch.rpm
sudo alien k cdkmspgcc3.3.220031106.i386.rpm
sudo alien k cdkmspgdb5.1.120031106.i386.rpm
sudo alien k cdkmspgdbproxy5.1.120031106.i386.rpm
sudo alien k cdkmspjtaglib20031101cvs20031102.i386.rpm
sudo alien k cdkmsplibc20031101cvs20031102.noarch.rpm
Then I installed converted .deb files with synaptic:
MSPGCC was installed here:
/opt/cdk4msp
Then I started to configure Eclipse from this tutorial which was written for Windowz users:
It was very helpful.
http://msp430.techcontent.net/wiki/index.php/IDEs/Eclipse
ECLIPSE PROJECT:
First I created a new Managed Make C Project:
Figure 2: New Project window
Figure 3: Select name window
Figure 4: Type of project window
Just drop in source files onto project to add them.
When you add source file it probably won't compile cause you have to set project first.
Figure 5: Main C perspective window
CONFIGURING PROJECT:
Right click on new project and select Properties:
My setting for eclipse are following:
Command entry for GCC C Compiler (change to appropriate msp430 microcontroller):
/opt/cdk4msp/bin/msp430gcc mmcu=msp430x149
Figure 6: GCC C Compiler Project main properties
elf extension must be set.
Figure 7: GCC C Compiler Build Settings
Figure 8: GCC C Compiler Parser
Under GCC Compiler Directories I have following entries:
● /opt/cdk4msp/msp430/include
● /usr/local/lib
● /opt/cdk4msp/lib
● /opt/cdk4msp/include
● /opt/cdk4msp/msp430/bin
● /opt/cdk4msp/bin
● /usr/bin
Figure 9: GCC C Compiler Directories
I don' know maybe few of these entries are not necessary.
Linker command entry (change to appropriate msp430 microcontroller):
/opt/cdk4msp/bin/msp430gcc mmcu=msp430x149micro controller
Figure 10: GCC C Linker Settings
Figure 11: GCC C Linker library paths
Assembler command entry:
/opt/cdk4msp/bin/msp430as
Figure 12: GCC Assembler command settings
Figure 13: GCC Assembler paths
Eclipse can start GDB Proxy for you.
Just create new external tool entry under:
Debug\External Tools\External Tools...
GDBProxy location entry:
/opt/cdk4msp/bin/msp430gdbproxy
Arguments entry:
port=3333 msp430
Figure 14: My GDB Proxy External tool settings
I also had to:
● add these paths in console:
export PATH=$PATH:/opt/cdk4msp/bin:/opt/cdk4msp/lib
● Change parallel port permissions in console every time computer is restarted:
chmod 777 /dev/parport0
So now it should work.
Switch to Debug mode in upper right corner:
Figure 15: Debug mode
Just run GDBProxy external tool under “Run”.
Figure 16: Running GDBProxy
Then click on “Bug” icon in upper left corner to erase flash and upload:
Figure 17: Uploading program
This is the output I get from gdb:
Figure 18: GDB Output
Now I can start debugging with Resume button, target stops on Breakpoint:
Figure 19: Debug
My used test program (fet140_1.c):
//*******************************************************************************
// MSP-FET430P140 Demo - Software Toggle P1.0
//
// Description; Toggle P1.0 by xor'ing P1.0 inside of a software loop.
// ACLK = n/a, MCLK = SMCLK = default DCO ~ 800k
//
// MSP430F149
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// | P1.0|-->LED
//
// M. Buccini
// Texas Instruments, Inc
// february 2002
// Built with IAR Embedded Workbench Version: 1.25A
//******************************************************************************
#include <msp430x14x.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= 0x01; // Set P1.0 to output direction
for (;;)
{
unsigned long i;
i = 6000; // Delay
do (i--);
while (i != 0);
}
}