a Virtual Robotix Network Team

I ordered the Olimex USB-OCD-H and it will arrive tomorrow, so I am preparing myself for some challenges. My goal is to jtag / debug one of the early ChibiOS multipilot examples, something simple. 


Does anyone have the OpenOCD-GDB startup/debug/flash scripts and external tools configuration data (Initialization commands for Eclipse for isntance) appropriate for the STM32 that is being used on Multipilot32? I am going to use Yagarto at least for now, because all the tutorials I printed/read do so, and that is what I currently have working. 


Is there any anomilies with installing the FTDI Olimex drivers for OpenOCD 0.4, that any of you have encountered? I came a crossed some forum threads that said not to install the FTD2xxx driver.  






Views: 6290

Reply to This

Replies to This Discussion

ok, i verified, that when you see this:

F:\toolchain\OpenOCD>openocd -f /interface/olimex-arm-usb-ocd.cfg -f /target/stm
32.cfg -c "init"
Open On-Chip Debugger 0.5.0-dev (2010-10-28-22:42)
Licensed under GNU GPL v2
For bug reports, read
Info : only one transport option; autoselect 'jtag'
1000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
Error: unable to open ftdi device: device not found
Command handler execution failed
in procedure 'init'



then you have the wrong driver installed.


When my Jtag is not plugged into usb I get the following error:

Your error is slightly different than mine. Yes, this is probably indicative of a misconfigured/inproper driver.


As far as "not working in Eclipse" (from your earlier post), are you meaning adding OpenOCD as an external tool? I believe all this does is launch OpenOCD within a sort of command prompt within eclipse. Here is a screenshot of the settings:

 This is a screenshot of it running OpenOCD from "External Tools" within Eclipse. Note: you cannot have it already running when you do this.

Again, the two screenshots above depict running OpenOCD from within Eclipse, but does not pertain to debuggin in any way. I am trying to figure that part out.


Something you can try when OpenOCD is running from a command prompt (or from the Eclipse console):


Open a new cmd prompt and type in: "telnet localhost 4444". Telnet should make a connection to OpenOCD. You will see this in both cmd prompts that are open.


You should be able to connect to OpenOCD and run commands from the telnet prompt (in another cmd prompt that is). You can type help to get a list of commands. The OpenOCD documentation is full of good reading BTW.




In the telnet prompt type in "scan_chain". You should see some tap information. Exactly what this is I have not figured out as of yet, but will eventually get there. I sort of know, but don't want to mislead anyone.



Jim T.





Here's Roberto's MP32TESTPROGRAM from many weeks ago, it implements the ChibiOS rtos. The screenshot below depicts a breakpoint in the thread that prints data. I single stepped this multiple times, cleared the breakpoint, etc:

Here are some screen shots of the debug config - it is actually fairly simple, once I read the OpenOCD manual and re-read the "Using Eclipse" guide from the ChibiOS site. My setup is almost the same except Yagarto must have renamed their elf GDB Debugger. I had to use "arm-none-eabi-gdb.exe" (depicted 2 pics below):

In the run Commands the entire entry is:

monitor soft_reset_halt 

monitor wait_halt 

monitor poll

monitor flash probe 0

monitor stm32x mass_erase 0

monitor flash write_bank 0 MP32TESTPROGRAM.bin 0

monitor soft_reset_halt

symbol-file MP32TESTPROGRAM.elf

thbreak main



I have some more to figure out, like how to pass the <program>.bin to OpenOCD and the GDB debugger via a variable, and some other things. I havn't tested multiple breakpoints (I think I can only do two until I figure out RAM debugging.



If you are using the Olimex ARM-USB-OCD-H (and quite possibly the ARM-USB-OCD) in this environment:

VMware Workstation (Windows7 Host, XP Guest)



Make sure you enable/use high speed usb port, otherwise you are going to consistently blue screen Windows when you attempt to flash. This is independent of Eclipse or Yagarto.



Jim T



Hi Jim,


Great work !!!

Can you please provide the pin mapping for Olimex connector ?


I found one reseller here and I'm eager to use it ;)




yagarto went from the elf format to the none eabi.

the elf format is obsolete - none eabi is the future.

this is where the different names do come from.

the object format is different - you cannot mix the two formats.

in case you have elf object libraries, the old format, you must re-compile them.


i still prefer code red tech or segger - i miss the swd support.

once worked with swo you will never miss it again.



yesterday i received my own OLIMEX ARM-USB-OCD and i tried to follow your guideline.
I hadn't a CD rom inside package, but only a link reference to the site for a download of open ocd and drivers.
1th problem: when I install drivers of Olimex, i haven't a virtual serial port.. It's necessary?
2nd problem. When I try to connect to JTAG, using eclipse, it gives me some errors about file CFG of commands.
Please give me info about which file CFG i have to use.

Great Work JIM :)



Hi Jim,


I have bought an OLIMEX ARM-USB-OCD.

Drivers Installation seem OK

Could you provide the pin-to-pin between the MP32 connector and the OLIMEX 20 pin cable (I don't want to destroy both) ?



Cyrille, I have this information in detail. I hope I can attach them here!

Credit goes to Jim for figuring this out! Thanks

Thanks Jan, this confirms the pin-to-pin description that I find in the web.


Use OpenOCD with ECLIPSE is not a trivial task, and I spent time despite the great work of Jim (thanks Jim).

I succeeded 1) to program MP32 with OLIMEX ARM-USB-OCD, and 2) to debug. Below some details, screenshots (purist don't be afraid...)


Config :

  • YAGARTO GNU ARM Toolchain (GCC 4.6.2, GDB 7.3.1)
  • ChibiOS


How to Program with OLIMEX ARM-USB-OCD




Build your code, a .elf is generated. Run OPENOCD_Programmer. The Program will be download the MP32.


How to debug with OLIMEX ARM-USB-OCD

When I use the "Jim debug config", I obtain the message below :

"Remote 'g' packet reply is too long : ...",  I have asked google to have some tips... So I have lokked for other config : see below


1) Create an external tool for GDB



 2) Debug configuration



 In the Init Commands paste:

set complaints 1
set output-radix 16
set input-radix 16
set prompt (arm-gdb)
target remote localhost:3333
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
set remote hardware-watchpoint-limit 4
set remote hardware-breakpoint-limit 6
monitor reset
monitor sleep 200
monitor poll
monitor soft_reset_halt
monitor stm32x unlock 0
monitor stm32x mass_erase 0
monitor flash write_image E:\Projet\UAV\Programmes\Sources\chibios\MP32-OPENOCD\MP32-OPENOCD\MP32_OPENOCD.elf
monitor reset
monitor poll
break main



3) Debug your program

Run as External toolk OPENOCD_GDB

Then run the debug (here MP32-OPENOCD Default(1))

This tab with "no source available for ..." will appear, you must to click Resume (F8), then the debbuger will stop a the start of the main prog. Click again on Resume and the debugger will stop on your first breakpoint.






© 2022   Created by Roberto Navoni.   Powered by

Badges  |  Report an Issue  |  Terms of Service