SparkFun Forums 

Where electronics enthusiasts find answers.

#96063
Hi all,

I found the solution to the problem I encountered and reported in the previous post.
The steps here are for compiling openocd on PC without the USB driver/JTAG deive installed.

1. ./bootstrap did not work and is ok.
2. ./configure will work only if I do the following.
If you are using the libusb+libftdi combo, for this to work (./configure) you need to be sure that libusb0.dll is in the same directory as configure IF YOU DON'T NEED TO HAVE THE REAL USB DEVICE driver installed. So I copied libusb0.dll from
/home/openocd/libusb-win32-device-bin-0.1.12.2/bin/libusb0.dll to
/home/openocd/openocd-0.4.0/ in my case.
Then you run the ./configure .... as in mifi post.


We can do the same for the FTDI supplied driver. The key point is the ftd2xx.dll as above. In this case I copied ftd2xx.dll from
/home/openocd/ftd2xx/i386/ftd2xx.dll to
/home/openocd/openocd-0.4.0/

(Note that I unzipped a fresh set of files to /openocd-0.4.0/ for the second run to build openocd for ftd2xx.dll after I built openocd for libusb+libftdi in the first run.)

I still can't get bootstrap to work. I hope someone can throw some light on this. Anyway, it does not really matter as I managed to build openocd.exe . :)

I hope mifi can update his 2 excellent post to include those mentioned steps for those of us who don't have the REAL USB device installed to able to compile.

Thank you very much.

Best regards,
aukcspore.
By bobbinz
#96141
@aukcspore:

Try converting the bootstrap file to Unix format (use Notepad++ for example) then try running it again. I had similar problem until I did this. I believe there's a way to tell Cygwin to use Windows format, but I didn't look into this.

BBz
By riemus123
#99453
Hi,
I downloaded the latest source from git.
Then I did the
Code: Select all
./bootstrap
, and
Code: Select all
./configure --enable-maintainer-mode
. But when I then run
Code: Select all
make
, the following error occurs:
Code: Select all
make[6]: Entering directory `/home/openocd/openocd/src/jtag'
/bin/sh ../../libtool --tag=CC   --mode=link gcc -std=gnu99  -g -O2 -Wall -Wstrict-prototypes -Wformat-security -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls   -o libjtag.la  adapter.lo core.lo interface.l
o interfaces.lo tcl.lo   commands.lo ../../src/jtag/drivers/libocdjtagdrivers.la -lioperm
libtool: link: rm -fr  .libs/libjtag.lax
libtool: link: (cd .libs/libjtag.lax/libocdjtagdrivers.a && ar x "/home/openocd/openocd/src/jtag/../../src/jtag/
drivers/.libs/libocdjtagdrivers.a")
libtool: link: object name conflicts in archive: .libs/libjtag.lax/libocdjtagdrivers.a//home/openocd/openocd/src
/jtag/../../src/jtag/drivers/.libs/libocdjtagdrivers.a
make[6]: *** [libjtag.la] Error 1
make[6]: Leaving directory `/home/openocd/openocd/src/jtag'
My machine is Win XP and it is Cygwing that I am using.

Any pointers?
By Ales
#100224
Hello,
I tried to compile OpenOCD for win32 with FTDI's drivers, but I stuck on error with 'undefined references' to functions from usb.h. This is output from terminal:
Code: Select all
libtool: link: i586-mingw32msvc-ranlib .libs/libopenocd.a
libtool: link: rm -fr .libs/libopenocd.lax .libs/libopenocd.lax
libtool: link: ( cd ".libs" && rm -f "libopenocd.la" && ln -s "../libopenocd.la" "libopenocd.la" )
i586-mingw32msvc-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -I../src -I../src   -mno-cygwin -D__USE_MINGW_ANSI_STDIO -I/home/ales/comp/openocd/ftdi2xx -Wall -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
mv -f .deps/main.Tpo .deps/main.Po
/bin/bash ../libtool --tag=CC   --mode=link i586-mingw32msvc-gcc -std=gnu99  -mno-cygwin -D__USE_MINGW_ANSI_STDIO -I/home/ales/comp/openocd/ftdi2xx -Wall -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror  -L/home/ales/comp/openocd/ftdi2xx/i386 -o openocd.exe main.o libopenocd.la -lftd2xx
libtool: link: i586-mingw32msvc-gcc -std=gnu99 -mno-cygwin -D__USE_MINGW_ANSI_STDIO -I/home/ales/comp/openocd/ftdi2xx -Wall -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -o openocd.exe main.o  -L/home/ales/comp/openocd/ftdi2xx/i386 ./.libs/libopenocd.a -lws2_32 -lftd2xx
./.libs/libopenocd.a(arm-jtag-ew.o):arm-jtag-ew.c:(.text+0x111c): undefined reference to `_usb_init'
./.libs/libopenocd.a(arm-jtag-ew.o):arm-jtag-ew.c:(.text+0x117e): undefined reference to `_usb_claim_interface'
./.libs/libopenocd.a(arm-jtag-ew.o):arm-jtag-ew.c:(.text+0x11a0): undefined reference to `_usb_close'
./.libs/libopenocd.a(arm-jtag-ew.o):arm-jtag-ew.c:(.text+0x12bc): undefined reference to `_usb_bulk_write'
./.libs/libopenocd.a(arm-jtag-ew.o):arm-jtag-ew.c:(.text+0x12f4): undefined reference to `_usb_bulk_read'
./.libs/libopenocd.a(usb_common.o):usb_common.c:(.text+0x82): undefined reference to `_usb_find_busses'
./.libs/libopenocd.a(usb_common.o):usb_common.c:(.text+0x87): undefined reference to `_usb_find_devices'
./.libs/libopenocd.a(usb_common.o):usb_common.c:(.text+0x8c): undefined reference to `_usb_get_busses'
./.libs/libopenocd.a(usb_common.o):usb_common.c:(.text+0xc8): undefined reference to `_usb_open'
collect2: ld returned 1 exit status
make[4]: *** [openocd.exe] Error 1
make[4]: Leaving directory `/home/ales/comp/openocd/oocd/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/ales/comp/openocd/oocd/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/ales/comp/openocd/oocd/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ales/comp/openocd/oocd'
make: *** [all] Error 2
ales@pc1:~/comp/openocd/oocd$
I compiled at linux Ubuntu (this is my first experience with linux) and with following .configure options (mostly collected somewhere on the net and readme's):
Code: Select all
./configure --build=i686-pc-linux --host=i586-mingw32msvc --enable-maintainer-mode --disable-shared --enable-arm-jtag-ew --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=/home/ales/comp/openocd/ftdi2xx CC=i586-mingw32msvc-gcc CFLAGS=-mno-cygwin CPP=i586-mingw32msvc-cpp
usb.h is placed in /usr/include and /usr/i586-mingw32msvc/include
usblib.a is placed in /usr/lib and /usr/i586-mingw32msvc/lib

If it can be helpful, config.log is in attachment.

Please, can anybody tell me what is wrong or how to fix it? I tried to copy usb.h and usblib.a almost everywhere, but it seems it's not the problem. If I remove --enable-arm-jtag-ew option, I will get openocd.exe, but it's of course useless, because it doesn't have any jtag functionality.
Thanks a lot for any advice.
Ales.
You do not have the required permissions to view the files attached to this post.
By Ales
#100305
Previous post SOLVED
I'm idiot. I didn't try the --enabe-usbprog because I was thinking that's not my case (like device named Usbprog) and --enable-arm-jtag-ew (option for USB debugger by Olimex) involve all the needed USB fuctionality, but it's only support for a particular programmer/debugger, not the interface (USB, parallel). :roll:
#102520
As someone who dislikes cygwin because it tends to cause issues with my other more native development tools, is anyone interested in building OpenOCD for windows on ubuntu + mingw cross compiler? Instead of mucking around with cygwin on windows, muck around on ubuntu and use mingw to cross compile openocd for windows?

This is the route that I'm trying to take at the moment. AKA let Windows be Windows and Linux be Linux and let the cross compiler do the dirty work.

Edit: Totally appears to work.

The MinGW i386-mingw-gcc cross compiler builds without incident on ubuntu 8.04 from here

http://sourceforge.net/projects/mingw/files/

You do need to get the libusb.a and usb.h files from

http://sourceforge.net/projects/libusb-win32/files/

And because (I think) I'm using an FTDI based device the non-open source drives from here

http://www.ftdichip.com/Drivers/D2XX.htm

Grab the open ocd sources from

http://sourceforge.net/projects/openocd/

I extracted the ftdi usb drivers to openocd-0.4.0/ftd2xx/

And placed usb.h in openocd-0.4.0/ftd2xx

And libusb.a in openocd-0.4.0/ftd2xx/i386 (This seems to be in the linkers search path)
By meixner
#104235
Hello!

In case someone wants to compile openocd 0.4.0 using Mingw/MSys along the driver from FTDI. This is what worked for me:
unzip openocd-0.4.0.zip
mkdir CDM20602
cd CDM20602
unzip ../CDM20602.zip
cd ..

mkdir build
cd build
../openocd-0.4.0/configure --prefix=/c/openocd --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=../CDM20602

make
make install
- Matthias Meixner
By ernestw
#114822
To All,

Just beware with Vista and Windows 7. It seems these OS do not work well with some new hardware drivers.

Also the FTDI drivers - while they are certified you must make sure that they have the right VID and PID to match whatever debug link hardware you have,
I am using an Olimex ARM-JTAG-Tiny-H link. The VID is 15BA and the PID can be 002A or 0003 or 0004.
So you need to get the FTDI driver which has the correct VID and PID.

I am in the process of moving this project onto a Win-32 OS because of these issues.


Ernest
By ambok
#116166
NO, this is the wrong place!

Please copy it into your cygwin folder where you can use
no windows path to access it.

/home/openocd/ftd2xx


cnx nano premium
By DrDrago
#125399
Hi
I can not compile the OpenOCD with the option 'CC="gcc -mno-cygwin"'. It says:
configure: error: unrecognized option: `-mno-cygwin'
I have read somewhere that this option is removed, but I did not found a guide how to overcome it.
If I try to build it for cygwin I have the following error:
Error: unable to open ftdi device: unable to claim usb device. Make sure the def
ault FTDI driver is not in use
in procedure 'init'
But the drivers are OK, since I can use the one compiled by Olimex. I am using ARM-USB-OCD (manufactured by Olimex).
Please, help me to compile the OpenOCD, since I would like to support it by writing a code for one Cortex (ARM) which is not supported yet.

Thank you in advance
Drago
By Mehdi6
#131550
Hello,

here is a short tutorial how to build openocd for windows.
(Tested with SVN version 2348 of OpenOCD)

1)
Install cygwin, but you need some additional tools from the
development package like:

- autoconf: Wrapper scripts for autoconf commands
- automake: Wrapper scripts for automake and aclocals
- gcc: C compiler upgrade helper
- libtool: A shared library generation tool
- make: The GNU version og the 'make' utility
- subversion: A version control system
see more:
http://blog.csdn.net/jordon_ah/article/details/4396866
By slavka012
#151068
Good guide, I just would like to add this:

First, have tcl installed by the cygwin.

Second, after you start the bash, make sure PATH has nothing but /usr/bin in it. If you have some packages that might have tools with the same name in the PATH, it will give you all sorts of weird build errors. Once I removed all of those, the build went pretty smooth.