Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
10
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
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.