Sei sulla pagina 1di 4

http://www.bitsbythepound.com/setup-development-environment-for-ez430-f2013-usingeclipse-in-ubuntu-461.html 2013 02.

10

Setup development environment for EZ430-F2013 using Eclipse in Ubuntu


Author: jpfiset / Category: General / Tags: no tag / Add Comment 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: Use EZ430-F2013 in Ubuntu A Step by Step Guide To MSP430 Programming under Linux 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: 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-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 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 Parsers o 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: 00:00:00 **** Build of configuration Debug for project XXX **** make all Building file: ../main.c Invoking: GCC C Compiler msp430-gcc -mmcu=msp430f2013 -I/usr/msp430/include -Os -g3 -Wall -c -fmessagelength=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.c" Finished building: ../main.c Building target: xxx.elf Invoking: GCC C Linker msp430-gcc -mmcu=msp430f2013 -Wl,-Map=xxx.map -L/usr/msp430/lib -o "xxx.elf"

./main.o Finished 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 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: o Project: select project Tab Debugger: o GDB Command: msp430-gdb o Set Use remote target o 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 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: 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 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.

Potrebbero piacerti anche