Uploaded by abittencourt12

Eclipse e MSP430

advertisement
MSP430
ECLIPSE
MSPGCC
UBUNTU
TUTORIAL
Peter from Slovenia, Ptuj
August 2007
This tutorial describes how to install msp­gcc and msp­gdb 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:
embeddedcdt­linux­gtk­20070424.zip
zylincdt­20070424.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:
cdk­msp­base­0.2­20031111.i386.rpm
cdk­msp­binutils­2.14­20031106.i386.rpm
cdk­msp­examples­libc­20031101cvs­20031102.noarch.rpm
cdk­msp­examples­mspgcc­20031101cvs­20031102.noarch.rpm
cdk­msp­gcc­3.3.2­20031106.i386.rpm
cdk­msp­gdb­5.1.1­20031106.i386.rpm
cdk­msp­gdb­proxy­5.1.1­20031106.i386.rpm
cdk­msp­jtag­lib­20031101cvs­20031102.i386.rpm
cdk­msp­libc­20031101cvs­20031102.noarch.rpm
and converted them to .deb using alien which I installed using synaptic:
sudo alien ­k cdk­msp­base­0.2­20031111.i386.rpm
sudo alien ­k cdk­msp­binutils­2.14­20031106.i386.rpm
sudo alien ­k cdk­msp­examples­libc­20031101cvs­20031102.noarch.rpm
sudo alien ­k cdk­msp­examples­mspgcc­20031101cvs­20031102.noarch.rpm
sudo alien ­k cdk­msp­gcc­3.3.2­20031106.i386.rpm
sudo alien ­k cdk­msp­gdb­5.1.1­20031106.i386.rpm
sudo alien ­k cdk­msp­gdb­proxy­5.1.1­20031106.i386.rpm
sudo alien ­k cdk­msp­jtag­lib­20031101cvs­20031102.i386.rpm
sudo alien ­k cdk­msp­libc­20031101cvs­20031102.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
/opt/cdk4msp/bin/msp430­gcc ­mmcu=msp430x149
microcontroller):
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/msp430­gcc ­mmcu=msp430x149micro controller
Figure 10: GCC C Linker Settings
Figure 11: GCC C Linker library paths
Assembler command entry:
/opt/cdk4msp/bin/msp430­as
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/msp430­gdbproxy
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;
P1DIR |= 0x01;
// Stop watchdog timer
// Set P1.0 to output direction
for (;;)
{
unsigned long i;
P1OUT ^= 0x01;
}
}
i = 6000;
do (i--);
while (i != 0);
// Toggle P1.0 using exclusive-OR
// Delay
Download