Free Eclipse ARM GCC OpenOCD Toolchain for Windows – Part 4: GDB / OpenOCD Debugger

In this part of the tutorial we will be setting up eclipse to launch a full debug session where the processor can be flashed with the application, and ran. Once this part is successfully completed you will be able to set breakpoints and view memory, just like any expensive toolchain. This part of the tutorial was the most difficult for me to get right. Hopefully you will have fewer problems than I did.


  1. Part 1: Introduction
  2. Part 2: ARM GCC
  3. Part 3: Eclipse IDE
  4. Part 4: GDB / OpenOCD Debugger

Download OpenOCD

Start by downloading OpenOCD from Freddie Chopin’s website by following the link below.


Once you’ve downloaded OpenOCD, extract the 7zip file. Next, add the extracted OpenOCD folder to the ARMTC folder. Below is what my ARMTC folder now looks like.


Now, as we did for the ARMGCC, add the path to the OpenOCD bin folder to your PATH environment variable. If you are not sure how to do this, refer back to the Part 2 post. My path to OpenOCD is:


Now test the path to OpenOCD by typing the command below in the command window.

openocd-0.7.0 -v

You should get results similar to what is shown below.


Install the Olimex ARM JTAG

Now we need to install the drivers for the Olimex JTAG device. I used the instructions for installing the drivers that are contained in the README file in the OlimexODS drivers folder. Start by plugging in your JTAG device. You should then be prompted to either automatically install the drivers, or provide a location. Choose install from a specific location, and if you have downloaded the OlimexODS, choose the olimex-libusb- folder contained in the drivers folder. If you don’t have OlimexODS, the navigate to the OpenOCD drivers folder, extract the libusb-win32_ft2232_driver-120229 zip file, and point the driver installer to this folder. I recommend using the drivers provided by Olimex, if you can, since I haven’t tried the drivers provided by OpenOCD. Please comment if you have successfully used the OpenOCD FT232 drivers with the Olimex JTAG device.

Next, we can further test OpenOCD by launching it from a command window. Open a new command window in the main folder of the project. My path is shown below.


Now, enter the command shown below adapting wherever necessary to match your project configuration. The results I got are shown below. If the image is too small to see in your browser window, the click it to open to full size.

openocd-0.7.0 -f C:\ARM\openocd-0.7.0\scripts\interface\olimex-arm-usb-tiny-h.cfg -f project.cfg


As you can see, this failed for me. The version of OpenOCD that I downloaded didn’t have the olimex_stm32_e407.cfg file. To get this to work, I had to copy this file from the OlimexODS folder tree, and paste it in to my OpenOCD scripts/boards folder. After copying the script in to my OpenOCD directory, I tried the command again. Below is the result.


This time you can see that OpenOCD was successfully launched. The last line tells you that you have 6 breakpoints and 4 watchpoints.

Also, windows will likely ask if you want to allow access to OpenOCD. I went ahead and gave it full access.


Now we will integrate OpenOCD, GDB, and Eclipse. If it isn’t already running, start Eclipse and select the workspace that we created in part 3.

Install GDB Hardware Debugging Plugin

Click Help then Install New Software.



In the Work with text box, select Kepler. Wait for the options to load in the Name box. Once the Name box is populated, expand the Mobile and Device Development category. place a check next to C/C++ GDB Hardware Debugging, and click next.


Once again click Next.


Accept the license agreement, and click finish.


Restart Eclipse.


Configure GDB Client

At this point, we will configure the GDB client. Start by clicking the down arrow next to the bug symbol, then click Debug Configurations.


Start by giving this configuration a unique name in the Name text box. Click the radio button next to Disable auto build.


In the Debugger tab, change the GDB Command to arm-none-eabi-gdb. Ensure that Generic TCP/IP is selected for the JTAG Device, and that the Host name is localhost. Type 3333 for the Port number.


In the Startup tab, ensure that Reset and Halt are not checked. Enter monitor reset halt in the Initialization Commands text box. Ensure that the Load image and Load symbols boxes are checked.


Also in the Startup tab, ensure that the remaining boxes are unchecked. Unless you know of any run commands that would be useful, then it should be safe to leave this text box empty.


There should be nothing to do in the Source tab.


In the Common tab, place a check next to Debug so that this configuration will be added to the favorites menu.


Click the Apply button, then the Close button for now.

OpenOCD Server Launcher

Now we will set up a way to launch OpenOCD from Eclipse. Do this by clicking the down arrow next to the External Tools icon, then select External Tools Configurations.


In the Location text box of the main tab, add the path to the OpenOCD executable adapting where necessary to fit your project.


To add the project location as the working directory, click the Variables tab, scroll down to projcet_loc, and click Ok.

Add the line below to your arguments list.

-f ../scripts/interface/olimex-arm-usb-tiny-h.cfg -f project.cfg


The refresh tab should already be set up.


In the build tab, ensure that the Build before launch check box is empty.


The Environment tab should already be properly set.


In the common tab, ensure that a check is added next to the option to display this configuration in the external tools menu.


When you are finished, click Apply and then Close.

Launch OpenOCD Server

Click the down arrow next to the external tools icon, and then click on the OpenOCD Server Launcher that we created in the previous steps.


In the console window you should be able to see someting similar to what is shown below where it tells you how many breakpoints, and how many watch points you have available.


Launch GDB Client

Now it is time to actually run the test program on the board. Ensure that your JTAG is connected to your computer through USB, that the JTAG is properly connected to your board, and that the target board is powered. Launch the GDB client by clicking the down arrow next to the debug symbol and clicking on the newly created launch configuration.


At this point the application should be loaded, and the processor should be halted. Next, click the resume button.


This will start the application and you should be seeing the LED blinking. Once you are done screaming like a girl with excitement, because you have made what at one point felt like the impossible, actually happen, click the suspend button to stop the processor.


Now add break points by double clicking the area to the left of the delay lines as shown below. Once you’ve added the break points repeadedly click the resume button. This should alternately stop on each break point  toggling the status of the LED on and off at each break point.



This brings us to a stopping point in the tutorial series. When developing with the ARM GCC, Eclipse, and OpenOCD it seems like there are unlimited possibilities, but also just as many pitfalls. Hopefully we can share information, and make this process easier in the future.

 Zylin Alternative GDB Client

Alternatively you can install the Zylin Eclipse Plugin. I have used this one successfully in the past, but wasn’t able to get it to work with this version of Eclipse. To add the Zylin Eclipse plugin. Start by clicking the Help tab, and selecting Install New Software.


Paste the address of the Zylin update site below in to the work with text box, and click the add button.


Type Zylin in the name text box of the resulting Add Repository dialog and click OK.


Once the plugin loads, push the Select All Button, and click next


Click next on the Install Details dialog.


Accept the license, and click Next.


Click Ok to the warning about unsigned content.  Next, you will be prompted to restart eclipse. Click Ok, and allow Eclipse to restart. When Eclipse restarts, once again select the workspace from Part 3, and click OK.

Now we need to create a new debug configuratoin. Click the down arrow to the right of the bug symbol and select Debug Configurations as is shown below.


In the resulting debug configurations dialog, double click the Zylin Embedded Debug (Native) option.


This creates a new debug configuration. In the main tab, rename your debug configuration to whatever you want. I just changed the word Default to Debug.


In the debugger tab, ensure that the Embedded GDB debugger is selected. Change the name of the GDB debugger to arm-none-eabi-gdb. Also, ensure that the GDB command file text box is blank.


Add the Initialize commands below to the commands tab.

  • target remote localhost:3333
  • monitor reset halt
  • monitor wait_halt
  • monitor sleep 100
  • monitor poll
  • monitor flash write_image erase main.bin 0x08000000

Add the run commands below.

  • monitor soft_reset_halt
  • monitor wait_halt
  • monitor poll
  • thbreak main
  • continue


I didn’t change anything in the Source or Environment tabs.



In the Common tab, check the box to add this to the debug favorites menu. Be sure to click the apply button, and then the close button.


If you click the down arrow next to the bug symbol, you should be able to see the new debug configuration.



  1. Part 1: Introduction
  2. Part 2: ARM GCC
  3. Part 3: Eclipse IDE
  4. Part 4: GDB / OpenOCD Debugger

11 thoughts on “Free Eclipse ARM GCC OpenOCD Toolchain for Windows – Part 4: GDB / OpenOCD Debugger

  1. I’ve got a $10 altera usb-blaster clone (jtag) from ebay that should be compatible with openocd, would love to give a try for software debugging!

    What board(s) do you recommend that works out of the box with OpenOcd or UrJtag (not sure the difference).

    The ones I’ve I’ve seen don’t have a jtag connector (raspberry pi, pandaboard, cubie, ODROID-U2, udoo , CooperKit, EzSBC, NanoPC Radxa Rock, AM335x* etc).

    The beaglebone black has a usb jtag “EMULATOR” (??) as well as provisions for a standard jtag header… unfortunately, it seems most people would use that header with TI’s CCS (baremetal compiler instead of the gnu compiler), so getting it work with Eclipse and OpenOCD might be an uphill battle!


    1. Ben,

      Thanks for the comment. I would be interested in hearing about your results using the USB blaster for software debug. I see that there is already an interface script for it, but you may need some kind of adapter to get the pinout to work with a microcontroller (still not sure if this JTAG would work with a microcontroller though).

      The only board that I would feel 100% comfortable recommending as being compatible with the Olimex JTAG and OpenOCD used in this post would be the board that was used in this tutorial series since it is the only one that I have used myself with this toolchain. However, the Olimex JTAG should work out of the box with any ARM board that has the 20 pin ARM JTAG connector. The trick is just calling OpenOCD with the right script for the JTAG and the target processor.

      I would assume that the Olimex JTAG could be used with the Beagle Bone Black board with the adapter that you posted a link to. It looks to me like you would need to connect the Olimex JTAG to the adapter and then the adapter to the BBB. Then you would just need to start OpenOCD with the Olimex JTAG interface script, and the am335x target script.

      Hopefully this answers your questions. Feel free to let me know if you need me to be more specific on anything.

      Best regards,

      1. Thanks Michael!

        I’ll post back as I make some headway! I’ve ordered the Olimex board and a STM32F4 Discovery board*.

        If I get really stuck, there’s a commercial package (VisualGDB) that seems to simplify some of the configurations settings for OpenOCD and Arm:

        I know the ST Micro’s STM32F4 discovery board has been replaced with the new mbed capable Nucelo-STM32F401 line, but decided for the older one since there’s now linux support!

  2. I was going out of my tiny mind until I found you articles.

    One thing I’m not sure of is what the project.cfg file does (when launching OpenOCD), I’m using the TivaWare LaunchPad development board and can’t find any cfg file in the examples. Could you possibly show the content of the file? My setup works perfectly without it.

    Thanks for the great set of articles.

    Best regards,

    1. Steve,

      I’m glad that my posts could help you. I have also found that many aspects of working with ARM microcontrollers seemed to cause me to lose my mind.

      Below are the entire contents of the project.cfg file. The main purpose of this file is to give you a project specific script for OpenOCD similar to a linker script. This project doesn’t have much of a script though. All it does, for now, is to locate the script which initializes the the processor.

      # Find the board config file in the scripts/board/ directory

      gdb_memory_map enable
      gdb_flash_program enable

      source [find scripts/board/olimex_stm32_e407.cfg]

      Feel free to let me know if you need me to be more specific on anything.

      Glad to hear from you,

  3. For my stm32ldiscovery in OpenOCD 8.0.0 it will say:
    Can’t find scripts/board/olimex_stm32_e407.cfg

    But it’s there.

    So now i run it like this (after copying the scripts/board/stm32ldiscovery.cfg to the project folder):
    openocd-x64-0.8.0.exe -f .\stm32ldiscovery.cfg

    1. Hi Nikolay,

      go to project.cfg in your project folder. Than, change a path from:

      source [find scripts/board/olimex_stm32_e407.cfg]


      source [find C:/ARMTC/openocd-0.8.0/scripts/board/olimex_stm32_e407.cfg]

  4. I have a degree in computer engineering, and soon graduating in Music Technology and get a PhD in Computational Neuroscience. This is the most complicated thing I’ve seen in my life. Thanks for the tutorial. I just wonder

    C++ code -> Assembly -> transfer assembly to microcontroller. Why all these steps?????

Leave a Reply

Your email address will not be published. Required fields are marked *