2013
02.10

This note explains how to set up Eclipse for developing images for the EZ430-F2013. This note assumes that the development environment is set up in Ubuntu 12.10.

This note relates to:

  • Ubuntu 12.10
  • EZ430-F2013
  • msp430-gcc version 4.6.3
  • Eclipse Classic version 4.2.1

References:

Install Command-Line Tools

The installation of command-line tools to support the EZ430-F2013 development kit is covered in a different note. Please refer to the note Use EZ430-F2013 in Ubuntu to complete this step.

Install CDT

In Eclipse, the packages that support C/C++ development are named the C Development Toolkit, or CDT. Portions of the CDT are required to enabled a development environment for the EZ430-F2013:

  • C/C++ Development Tools
  • C/C++ Development Tools SDK
  • C/C++ Debugger Services Framework (DSF) Examples
  • C/C++ GDB Hardware Debugging

To install the CDT, in Eclipse:

Create a C project to use MSP-GCC

Create a C project:

  • “File” > “New” > “Project…” > “C/C++ / C Project”
  • Enter a project name
  • Use default location
  • Project Type: Executable > Empty Project > Linux GCC
  • Press Finish

Set up new project to use MSP-GCC:

  • Right-click on project, select “Properties”
  • Select page “C/C++ Build” > “Settings”
  • Select configuration “[ All configurations ]”
  • Select settings “Tool Settings” > “GCC C Compiler”
    • Command: msp430-gcc -mmcu=msp430f2013
  • Select settings “Tool Settings” > “GCC C Compiler” > “Includes”
    • Add include path: /usr/msp430/include
  • Select settings “Tool Settings” > “GCC C Compiler” > “Optimization”
    • Optimization Level: “Optimize for size (-Os)”
  • Select settings “Tool Settings” > “GCC C Linker”
    • Command: msp430-gcc -mmcu=msp430f2013 -Wl,-Map=${BuildArtifactFileBaseName}.map
  • Select settings “Tool Settings” > “GCC C Linker” > “Libraries”
    • Add library search path: /usr/msp430/lib
  • Select settings “Tool Settings” > “GCC Assembler”
    • Command: msp430-as
  • Select settings “Tool Settings” > “GCC Assembler” > “General”
    • Add include path: /usr/msp430/include
  • Select settings “Build Artifact”
    • Artifact type: “Executable”
    • Artifact extension: “elf”
  • Select settings “Binary Parsers”
    • select “Elf Parser”
  • Press “Apply” and “OK”

Once the project is set up correctly, it should be possible to build an image from source by right-clicking on the project and selecting “Build Project”. In the console, the output of the build should look something like the following:

Set Up Debugger Configuration

To debug the project directly from the IDE, a debugger must be configured. The following steps are used to configure a debugger to use the command-line tool “msp430-gdb”:

  • Select “Run” > “Debug Configuration…”
  • Select “GDB Hardware Debugging”
  • Press the “New” icon
  • Set name
  • Tab “Main”:
    • Project: select project
  • Tab “Debugger”:
    • GDB Command: msp430-gdb
    • Set “Use remote target”
    • JTAG Device: Generic TCP/IP
    • Host name or IP address: localhost
    • Port number: 2000
  • Tab “Startup”:
    • Reset and Delay: 3
    • Set: “Halt”
    • Initialization Commands: “monitor erase”
    • Set: “Load image”
    • Set: “Use project binary”
    • Set: “Load symbols”
    • Set: “Use project binary”
  • Tab “Common”:
    • Save as: “Shared file” (select project)
    • Display in favorite menu: “Debug”
  • Press “Apply”

Running the debugger from the IDE is the equivalent to running “msp430-gdb” at the command-line. It first requires that “mspdebug” runs to bridge to the EZ430-F2013 development kit. This can be perform from a terminal or from an Eclipse run configuration (next section).

To run the debugger, select from the menu “Run” > “Debug Configurations…”, choose the debugger create and press the button “Debug”.

Run MSPDEBUG from Eclipse

It is possible to run “mspdebug” from Eclipse using a run configuration. Here are the steps to set it up:

  • Select “Run” > “External Tools” > “External Tools Configurations…”
  • Right-click on “Program” and select “New”
  • Enter name: MSPDebug
  • Select “Main” tab:
    • Location: /usr/bin/mspdebug
    • Arguments: uif -d /dev/ttyUSB0 gdb

Once set up as an external tool, to run “mspdebug”, select “Run” > “External Tools” > “External Tools Configurations…”, click on the program called “MSPDebug” and press the “Run” button.

Conclusion

There are many short-cuts in Eclipse to run external tools and debug configurations without using the tedious menus. One of these short-cuts are located on the main tool bar. These short-cuts makes it very convenient to start “mspdebug” and “msp430-gdb”. The ability of developing and debugging using the EZ430-F2013 directly from Eclipse greatly reduces the development cycle of an image targeted for the MSP430.

1 comment so far

Add Your Comment
  1. I am running ubuntu 13.04 64 bit with msp430-gcc
    For some reason the linking stage doesn’t work if the following is executed as you have suggested

    msp430-gcc –mmcu=msp430g2553 -Wl,-Map=led.map -L/usr/msp430/lib/ ./led.o -o led.elf
    I get an error
    /usr/lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: cannot open linker script file memory.x: No such file or directory
    As a work around I gave the exact location of the memory.x like this
    msp430-gcc –mmcu=msp430g2553 -Wl,-Map=led.map -L/usr/msp430/lib/ldscripts/msp430g2553/ ./led.o -o led.elf
    This works.

    This is not an eclipse specific issue, the linking stage fails even when I run it on command line using the first syntax and works only if the second syntax is used.

    Can you throw some light on why the first syntax is not working.