Setup Development Environment for EZ430-F2013 Using Eclipse in Ubuntu

Embed Size (px)

Citation preview

  • 7/30/2019 Setup Development Environment for EZ430-F2013 Using Eclipse in Ubuntu

    1/4

    http://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.html

    201302.10

    Setup development environment forEZ430-F2013 using Eclipse in Ubuntu

    Author:jpfiset / Category: General / Tags: no tag / Add CommentThis note explains how to set up Eclipse for developing images for theEZ430-F2013. This note assumes that the development environment isset 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: Use EZ430-F2013 in Ubuntu

    A Step by Step Guide To MSP430 Programming under Linux

    Install Command-Line ToolsThe installation of command-line tools to support the EZ430-F2013development kit is covered in a different note. Please refer to the note

    Use EZ430-F2013 in Ubuntu to complete this step.Install CDTIn Eclipse, the packages that support C/C++ development are namedthe C Development Toolkit, or CDT. Portions of the CDT are required toenabled 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:

    Help > Install New Software Add a repository. Name: Eclipse CDT. Location:

    http://download.eclipse.org/tools/cdt/releases/juno Select the packages mentioned above.

    Create a C project to use MSP-GCCCreate a C project:

    File > New > Project > C/C++ / C Project

    http://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.htmlhttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.htmlhttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.htmlhttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.htmlhttp://www.bitsbythepound.com/author/jpfisethttp://www.bitsbythepound.com/author/jpfisethttp://www.bitsbythepound.com/category/generalhttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.html#respondhttp://www.bitsbythepound.com/use-ez430-f2013-in-ubuntu-450.htmlhttp://www.43oh.com/2010/11/a-step-by-step-guide-msp430-programming-under-linux/http://www.bitsbythepound.com/use-ez430-f2013-in-ubuntu-450.htmlhttp://download.eclipse.org/tools/cdt/releases/junohttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.htmlhttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.htmlhttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.htmlhttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.htmlhttp://www.bitsbythepound.com/author/jpfisethttp://www.bitsbythepound.com/category/generalhttp://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-using-eclipse-in-ubuntu-461.html#respondhttp://www.bitsbythepound.com/use-ez430-f2013-in-ubuntu-450.htmlhttp://www.43oh.com/2010/11/a-step-by-step-guide-msp430-programming-under-linux/http://www.bitsbythepound.com/use-ez430-f2013-in-ubuntu-450.htmlhttp://download.eclipse.org/tools/cdt/releases/juno
  • 7/30/2019 Setup Development Environment for EZ430-F2013 Using Eclipse in Ubuntu

    2/4

    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

    o Command: msp430-gcc -mmcu=msp430f2013

    Select settings Tool Settings > GCC C Compiler > Includes

    o Add include path: /usr/msp430/include

    Select settings Tool Settings > GCC C Compiler > Optimization

    o Optimization Level: Optimize for size (-Os)

    Select settings Tool Settings > GCC C Linker

    o Command: msp430-gcc -mmcu=msp430f2013 -Wl,-Map=${BuildArtifactFileBaseName}.map

    Select settings Tool Settings > GCC C Linker > Libraries

    o Add library search path: /usr/msp430/lib

    Select settings Tool Settings > GCC Assembler

    o Command: msp430-as

    Select settings Tool Settings > GCC Assembler > General

    o Add include path: /usr/msp430/include

    Select settings Build Artifact

    o Artifact type: Executable

    o Artifact extension: elf

    Select settings Binary Parserso select Elf Parser

    Press Apply and OK

    Once the project is set up correctly, it should be possible to build animage from source by right-clicking on the project and selecting BuildProject. In the console, the output of the build should look somethinglike the following:00:00:00 **** Build of configuration Debug for project XXX ****make allBuilding file: ../main.c

    Invoking: GCC C Compilermsp430-gcc -mmcu=msp430f2013 -I/usr/msp430/include -Os -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.c"Finished building: ../main.cBuilding target: xxx.elfInvoking: GCC C Linkermsp430-gcc -mmcu=msp430f2013 -Wl,-Map=xxx.map -L/usr/msp430/lib -o "xxx.elf"

  • 7/30/2019 Setup Development Environment for EZ430-F2013 Using Eclipse in Ubuntu

    3/4

    ./main.oFinished building target: xxx.elf

    00:00:00 Build Finished (took 166ms)Set Up Debugger Configuration

    To debug the project directly from the IDE, a debugger must beconfigured. The following steps are used to configure a debugger to usethe command-line tool msp430-gdb:

    Select Run > Debug Configuration

    Select GDB Hardware Debugging

    Press the New icon

    Set name

    Tab Main:

    o Project: select project

    Tab Debugger:

    o GDB Command: msp430-gdb

    o Set Use remote targeto JTAG Device: Generic TCP/IP

    o Host name or IP address: localhost

    o Port number: 2000

    Tab Startup:

    o Reset and Delay: 3

    o Set: Halt

    o Initialization Commands: monitor erase

    o Set: Load image

    o Set: Use project binary

    o Set: Load symbols

    o Set: Use project binary Tab Common:

    o Save as: Shared file (select project)

    o Display in favorite menu: Debug

    Press Apply

    Running the debugger from the IDE is the equivalent to runningmsp430-gdb at the command-line. It first requires that mspdebugruns to bridge to the EZ430-F2013 development kit. This can be performfrom 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 buttonDebug.Run MSPDEBUG from EclipseIt 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

  • 7/30/2019 Setup Development Environment for EZ430-F2013 Using Eclipse in Ubuntu

    4/4

    Select Main tab:

    o Location: /usr/bin/mspdebug

    o 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 theprogram called MSPDebug and press the Run button.ConclusionThere are many short-cuts in Eclipse to run external tools and debugconfigurations without using the tedious menus. One of these short-cutsare located on the main tool bar. These short-cuts makes it veryconvenient to start mspdebug and msp430-gdb. The ability ofdeveloping and debugging using the EZ430-F2013 directly from Eclipsegreatly reduces the development cycle of an image targeted for theMSP430.