SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
#146584
hi everyone,

the last days i tried to get my openocd-usb-adapter working. because it was quite tricky and there are only a few howto's i decided to create this thread from beginner (linux novice) for beginner :techie-typing: . (using latest git-version)

my adapter uses the FT2232D and was bought from embedded-projects.net (In-Circuit ICprog OpenOCD).
the manufacturer doesn't earned a price for support :whistle: ;) ...

there are two ways to get this thing work with openocd:
- using the opensource library libftdi, e.g. "libftdi-0.20.tar.gz"
- using the closed source driver library from ftdichip.com, e.g. "libftd2xx1.1.0.tar.gz"

at first i tried the closed source variant and got following error:
Code: Select all
Warn : Unable to open FTDI Device tried: 'Dual RS232' and 'Dual RS232 A'
Error: unable to open ftdi device: device not opened
Error: ListDevices: 2
Error: 0: "Dual RS232 A"
Error: 1: "Dual RS232 B"
in procedure 'init'
i think there will be a way to get this driver work, but before spending further more time, i tried the open source library:

when you use ubuntu linux or similar, you can use apt-get install libftdi-dev and apt-get install openocd and are nearly finished.

when you are using another one (without apt-get :shifty: ), follow this steps:
  • Download libftdi as tar.gz and extract (http://www.intra2net.com/en/developer/l ... .20.tar.gz), then run:
    Code: Select all
    ./configure
    /make
    /make install
    
  • the libraries(/links) "libftdi.so", "libftdi.so.1" and "libftdi.so.1.20.0" occur in /usr/local/lib,
    but the openocd-setup needs them in /usr/lib --> copy the three files to /usr/lib
  • get openocd-git repository clone by
    Code: Select all
    git clone http://repo.or.cz/r/openocd.git
    (needs only port 80 ;) )
  • if you use a modern linux, you can skip this point...
    the openocd git-repository from june 2012 requires autoconf 2.60!
    my ultra cutting edge centos 5.8 only uses autoconf 2.59 and the yum package manager doesn'nt want to upgrade --> so install newer version manually:
    - download a package from http://rpm.pbone.net/index.php3/stat/4/ ... h.rpm.html or another one for your linux-version.
    - yum install [package].rpm
    - rename /usr/bin/autoconf or delete (backup before)
    - rename or copy /usr/bin/autoconf2.6x to /usr/bin/autoconf
    - now the autoconf command has the right content, but the linux doesn't know ;) ---> skip test:
    - change first line from configure.ac in git repository from "AC_PREREQ(2.60)" to "AC_PREREQ(2.59)"
  • run following commands in the downloaded git repository:
    Code: Select all
    ./bootstrap
    ./configure --enable-ft2232_libftdi --disable-werror
    make -i
    make install -i
    
    (the --disable-werror flag don't let warnings throw errors during make; the "-i" is dirty (ignore errors), but if not using this, some error like "remove 'openocd.info'" occurs)
    thats it :) !
  • now you have to use the right configure-file for the usb-adapter (save it e.g. as "interface.cfg"):
    Code: Select all
    interface ft2232
    ft2232_device_desc "Dual RS232 A"
    ft2232_layout oocdlink
    ft2232_vid_pid 0x0403 0x6010
    adapter_khz 4
    adapter_nsrst_delay 200
    jtag_ntrst_delay 200
    
  • the following answer comes from the usb-adapter with this self-built openocd:
    Code: Select all
    [root@toshiba OpenOCD]# openocd -f interface.cfg
    Open On-Chip Debugger 0.6.0-dev-00599-ga21affa-dirty (2012-06-25-23:31)
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.sourceforge.net/doc/doxygen/bugs.html
    Info : only one transport option; autoselect 'jtag'
    4 kHz
    adapter_nsrst_delay: 200
    jtag_ntrst_delay: 200
    Info : clock speed 4 kHz
    Warn : There are no enabled taps.  AUTO PROBING MIGHT NOT WORK!!
    Error: JTAG scan chain interrogation failed: all zeroes
    Error: Check JTAG interface, timings, target power, etc.
    Error: Trying to use configured scan chain anyway...
    Error: IR capture error at bit 0, saw 0x00 not 0x...3
    Warn : Bypassing JTAG setup events due to errors
    Warn : gdb services need one or more targets defined
    
    i think thats ok, if no further hardware is connected. ("Error: JTAG scan chain interrogation failed: all zeroes"...:P)
a nice feature of the opensource libftdi library are the examples. they run with my adapter with a small change in the source files:
change the PID from 0x6001 to 0x6010 and the VID to 0x0403 (if necessary). run make and e.g. "./find_all" to run the local executable.


i hope this thread helped somebody getting started with this nice opensource programmer :).
as i wrote in the beginning, i am new to linux. maybe the howto is not complete or inaccurate, but at my laptop it worked fine (centos 5.8 ).

regards
flo