Configure Eclipse
How to install and configure Eclipse properly in order to debug with OpenOCD.
This tutorial will go over how to do in-circuit debugging with OpenOCD via JTAG.
Page
2
of
3.
We'll need to set up our project and several tools in Eclipse to streamline our debugging experience. First, open up the version of Eclipse that you just installed.
Eclipse provides a nice way for us to fire up these processes at the click of a button, but of course there's a little setup involved. We're already set up to build new code, so we'll move on to uploading our new code to the board.

The OpenOCD - upload tool configuration
Fire Up the OpenOCD Daemon

The OpenOCD - debug configuration
New Project
We need to set up a new project in Eclipse to debug our program. Follow the steps in the Eclipse how-to to set up your project. This should get you to a point where you can compile new firmware versions.External Tools
The way that our debugging will generally work is:- Build new code that we want to test
- Upload our newly compiled code to the board
- Start the OpenOCD daemon - this will wait for connections from a GDB debug session running in Eclipse, and send those debug messages to the board via our ARM-USB-OCD JTAG device.
- Start our debug session in Eclipse and step around through the code.
Eclipse provides a nice way for us to fire up these processes at the click of a button, but of course there's a little setup involved. We're already set up to build new code, so we'll move on to uploading our new code to the board.
Upload New Code via ARM-USB-OCD
In your project, click the little arrow on the right-hand side of the External Tools icon in the menu bar, and select External Tools...- Create a New Configuration, and name it whatever you like. I've chosen OpenOCD - upload to distinguish it from the OpenOCD - debug configuration that we'll create in just a moment.
- In Location, specify the path to your openocd tool
- In Working Directory, specify the path to the directory with the OpenOCD scripts
- In Arguments, specify that OpenOCD should use the makeController-uploadFirmware.cfg configuration script
- Click the Common tab, and check the box in Display in Favorites Menu to add this configuration to the menu bar for easy access
- Click Close
The OpenOCD - upload tool configuration
Fire Up the OpenOCD Daemon
- Open the External Tools menu item again
- Create a New Configuration, and name it whatever you like. I've chosen OpenOCD - debug.
- In Location, specify the path to your openocd tool
- In Working Directory, specify the path to the directory with the OpenOCD scripts
- In Arguments, specify that OpenOCD should use the makeController-debug.cfg configuration script
- Click the Common tab, and check the box in Display in Favorites Menu to add this configuration to the menu bar for easy access
- Click Close
The OpenOCD - debug configuration
If you want to test out the debugger, click the External Tools icon in the menu bar and select OpenOCD - debug. You should get some output in the Console that looks like:

The Debug Main tab

The Debugger tab

The Commands tab
We're all set.
Info: openocd.c:82 main(): Open On-Chip Debugger (2006-10-12 18:00 CEST)The OpenOCD daemon is now sitting there waiting for a debug session to start up.
Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too
Set Up the Debug Session
To set this up, click on the little arrow next to the bug icon in the menu bar, and select Debug...- Create a new Embedded debug (Native) configuration, and name it whatever you like. I've simply chosen heavy.
- In Project, click Browse and select your current project
- In C/C++ Application, click Search Project... and select the heavy.elf file. You need to have already built the project once in order to create heavy.elf.
The Debug Main tab
- Click the Debugger tab
- Leave the Stop on startup checkbox checked
- In GDB debugger, select the YAGARTO arm-elf-gdb executable
- Clear out the GDB command file field
The Debugger tab
- Click the Commands tab
- Copy and paste the following commands into the Commands text field:
target remote localhost:3333The commands tab should look like:
monitor reset
monitor wait 500
monitor soft_reset_halt
monitor arm7_9 force_hw_bkpts enable
The Commands tab
- Finally, select the Common tab, and check the Debug checkbox within Display in favorites menu
We're all set.

