How to build OpenOCD for windows

Open source ARM Debugger

Moderator: phalanx

How to build OpenOCD for windows

Postby mifi » Sun Jun 22, 2008 6:16 am

Hello,

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

An other build instruction can be found at the piconomic
project here: http://piconomic.berlios.de/build_openocd.html

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

2)
In case you want to build openocd for the FT2232 interface,
you need the driver from FTDI too. Which can be found here:
http://www.ftdichip.com/Drivers/D2XX.htm

I assumed you have installed cygwin and downloaded the ftdi driver.
Extract the ftdi driver in the following directory /home/openocd.
This will create an extra folder inside /home/openocd called:

"CDM 2.04.06 WHQL Certified"

I do not like the spaces in the name here, please rename this
folder too "ftd2xx":

/home/openocd/ftd2xx

3)
Now we need the opencd source, change into /home/openocd and
use the following svn command:

Code: Select all
svn checkout svn://svn.berlios.de/openocd/trunk trunk


Now the openocd source will be loaded and stored in the
folder "trunk". You will now have two folders under /home/openocd like:

/home/openocd/trunk
/home/openocd/ftd2xx

4)
Change into /home/openocd/trunk. Here we will build openocd
for a FT2232 interface now.

Type in the following commands:

Code: Select all
./bootstrap


If you want to build a cygwin based openocd type now:

Code: Select all
./configure --enable-maintainer-mode --disable-werror --disable-shared --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=/home/openocd/ftd2xx


but if you want to build a mingw based openocd type:
Code: Select all
./configure --enable-maintainer-mode --disable-werror --disable-shared --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=/home/openocd/ftd2xx CC="gcc -mno-cygwin"


In case you want to create a debug version of OpenOCD you must add the following line to the configure command:

CFLAGS="-O0 -g -Wall"

The new command will look like for a cygwin debug build:

Code: Select all
./configure --enable-maintainer-mode --disable-werror --disable-shared --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=/home/openocd/ftd2xx CFLAGS="-O0 -g -Wall"


and here the command for a mingw debug build:

Code: Select all
./configure --enable-maintainer-mode --disable-werror --disable-shared --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=/home/openocd/ftd2xx CC="gcc -mno-cygwin" CFLAGS="-O0 -g -Wall"


After the configure step OpenOCD can be build with the
following command:

Code: Select all
make


The executable "openocd.exe" will be created in the following folder:

/home/openocd/trunk/src

Even you can build the html docs with:

Code: Select all
make html


The pdf of the documentation can be build with:

Code: Select all
make pdf


but here you must have tex installed too.


Best regards,

Michael
Last edited by mifi on Sun Aug 30, 2009 2:51 am, edited 5 times in total.
mifi
 
Posts: 193
Joined: Mon Jun 26, 2006 12:44 pm

Postby mifi » Wed Jun 25, 2008 1:05 pm

Hello,

here comes more information in case you want to build openocd for a interface which need libusb or libftdi.
(Tested with SVN version 2348 of OpenOCD)

First of all you must download libusb-win32 which can be found here:
http://sourceforge.net/projects/libusb-win32/files/

You need the libusb-win32-device-bin-0.1.12.2.tar.gz packages. Please extract this file into a temp
file. A new folder will be created called: libusb-win32-device-bin-0.1.12.2

Now copy the file libusb-win32-device-bin-0.1.12.2\include\usb.h

to the following directories:

c:\cygwin\usr\include
c:\cygwin\usr\include\mingw

Even you must copy the library libusb-win32-device-bin-0.1.12.2\lib\gcc\libusb.a

to the following directories:

c:\cygwin\lib
c:\cygwin\lib\mingw

Thanks to Spen for the mingw hint!

Now you are able to build a interface which need libusb, but now we want to prepare your cygwin
for libftdi too. Therefore download the libftdi source from this location:
http://www.intra2net.com/opensource/ftdi/

You need the libftdi-0.16.tar.gz file here. Download this file and extract it into the following folder
under cygwin /home/openocd. This will create a new folder like:

/home/openocd/libftdi-0.16

Now we want to build a cygwin and mingw version. First we will start with cygwin. Change in the new
folder libftdi-0.16 and use the following command:

Code: Select all
./configure


This will configure the libftdi packages. After this you can build the libftdi library with the following command:

Code: Select all
make


The make process will produce some errors, but don't panic. The library should be created and you can find
the libftdi.a file in the following folder /home/openocd/libftdi-0.16/src/.libs

Copy the libftdi.a to the following directories:

c:\cygwin\lib

Now we want to build the mingw version. Therefore we must cleanup the libftdi folder first.
Change into the /home/openocd/libftdi folder and type the following command:

Code: Select all
make distclean


But now use the following command to configure:

Code: Select all
./configure CC="gcc -mno-cygwin"


After this you can build it with:

Code: Select all
make


The same as before, the make process will produce some errors, but the library libftdi.a can be found in
the following folder /home/openocd/libftdi-0.16/src/.libs

Copy the libftdi.a to the following folder:

c:\cygwin\lib\mingw

Copy now the header file /home/openocd/libftdi-0.16/src/ftdi.h
to the following directories:

c:\cygwin\usr\include
c:\cygwin\usr\include\mingw

Thanks to Spen again who give me the hint for the separate cygwin/mingw build of libftdi.

Now you are able to build a interface which need libusb and libftdi. We will check this and build the FT2232
interface with libusb and libftdi. Therefore delete your trunk folder from the first post:

/home/openocd/trunk

and download a new fresh source again. Change into /home/openocd and use the following svn command:

Code: Select all
svn checkout svn://svn.berlios.de/openocd/trunk trunk


The same procedure as before.

Change into /home/openocd/trunk. Here we will build openocd
for a FT2232 interface now. Type in the following commands:

Code: Select all
./bootstrap


Remember we want to build a libusb and libftdi FT2232 interface now, therefore use the following
configure command for cygwin based openocd:

Code: Select all
./configure --enable-maintainer-mode --disable-werror --disable-shared --enable-ft2232_libftdi


but if you want to build a mingw based openocd type:

Code: Select all
./configure --enable-maintainer-mode --disable-werror --disable-shared --enable-ft2232_libftdi CC="gcc -mno-cygwin"


In case you want to create a debug version of OpenOCD you must add the following line to the configure command:

CFLAGS="-O0 -g -Wall"

After the configure step OpenOCD can be build with the
following command:

Code: Select all
make


The executable "openocd.exe" will be created in the following folder:

/home/openocd/trunk/src


Best regards,

Michael

PS: Post #1 and #2 was updated to support the SVN version 2348.
Last edited by mifi on Wed Jul 08, 2009 9:17 am, edited 5 times in total.
mifi
 
Posts: 193
Joined: Mon Jun 26, 2006 12:44 pm

Re:(How to build OpenOCD for windows)-no rule to make FTD2XX

Postby slava » Sat Jun 28, 2008 12:26 am

I tried to follow everything and get following mostly at the end

Make[3] No rule to make target '/home/openocd/ftd2xx/FTD2XX.lib', needed by 'openocd.exe'. Stop.
Any advise?
Last edited by slava on Thu Jul 03, 2008 6:07 pm, edited 2 times in total.
slava
 
Posts: 13
Joined: Tue Jun 17, 2008 10:08 am
Location: East Coast USA

Postby mifi » Sat Jun 28, 2008 12:31 am

Hello Slava,

>You must now copy the file "ftd2xx.lib" from
>/home/openocd/ftd2xx/i386 or /home/openocd/ftd2xx/amd64
>depending from your architecture into the following folder:
>
>/home/openocd/ftd2xx

Have you done this?

Regards,

Michael
mifi
 
Posts: 193
Joined: Mon Jun 26, 2006 12:44 pm

Postby slava » Sat Jun 28, 2008 12:40 am

[quote="mifi"]Hello Slava,

>You must now copy the file "ftd2xx.lib" from
>/home/openocd/ftd2xx/i386 or /home/openocd/ftd2xx/amd64
>depending from your architecture into the following folder:
>/home/openocd/ftd2xx
Have you done this?

Yes - I did
C:\OpenOCD\ftd2xx\ftd2xx.lib is in place
Last edited by slava on Thu Jul 03, 2008 6:08 pm, edited 2 times in total.
slava
 
Posts: 13
Joined: Tue Jun 17, 2008 10:08 am
Location: East Coast USA

Postby mifi » Sat Jun 28, 2008 12:46 am

Hello Slava,


>C:\OpenOCD\ftd2xx\ftd2xx.lib is in place
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

Regards,

Michael
mifi
 
Posts: 193
Joined: Mon Jun 26, 2006 12:44 pm

Postby slava » Sat Jun 28, 2008 12:58 am

[quote="mifi"]Hello Slava,
>C:\OpenOCD\ftd2xx\ftd2xx.lib is in place
>NO, this is the wrong place!
This helped - make finished - means my fault
I realized that directory for openocd should be exactely in /home/openocd
Last edited by slava on Thu Jul 03, 2008 6:06 pm, edited 1 time in total.
slava
 
Posts: 13
Joined: Tue Jun 17, 2008 10:08 am
Location: East Coast USA

missing xscale/debug_handler.bin

Postby slava » Sun Jun 29, 2008 12:45 pm

removed
Last edited by slava on Sun Jun 29, 2008 5:23 pm, edited 1 time in total.
slava
 
Posts: 13
Joined: Tue Jun 17, 2008 10:08 am
Location: East Coast USA

Postby mifi » Sun Jun 29, 2008 1:17 pm

Hello,

please do not post OpenOCD problems or errors here.
Create a new thread, this thread should be only for
build purpose of OpenOCD.

Best regards,

Michael
mifi
 
Posts: 193
Joined: Mon Jun 26, 2006 12:44 pm

how to add support of samsung flash ?

Postby slava » Thu Jul 03, 2008 5:05 pm

found in src\flash directory sources that samsung flash is supported and files for it. How can I include support of samsung flash?
found in flash.c list of supported drivers
flash_driver_t *flash_drivers[] =
{
&lpc2000_flash, &cfi_flash, &at91sam7_flash,
&str7x_flash, &str9x_flash, &stellaris_flash,
&str9xpec_flash, &stm32x_flash,
&tms470_flash, &ecosflash_flash,
&lpc288x_flash, &ocl_flash,
NULL,
};

saw in some conference instruction for old release
flash_driver_t *flash_drivers[] =
{
@@ -60,6 +61,7 @@

+ &s3c2410a_flash,
NULL,
};

But this is outdated and openocd has other function in current package - different files and funcs
How can I build with samsung flash support ? Or any support
for NAND flash not descirbed in documentation?
slava
 
Posts: 13
Joined: Tue Jun 17, 2008 10:08 am
Location: East Coast USA

Postby solitude » Mon Nov 24, 2008 2:33 am

Hello Slava,
>C:\OpenOCD\ftd2xx\ftd2xx.lib is in place
>NO, this is the wrong place!
This helped - make finished - means my fault
I realized that directory for openocd should be exactely in /home/openocd


Please dear its a section only for make a open OCD so don't disturb us. lol
My suggest is mifi that we describe our problem also in this thread than this tutorial will be complete. Which person face any problem post in this thread than this make a complete thread.
solitude
 
Posts: 2
Joined: Mon Nov 24, 2008 12:43 am

Postby Bool » Sat Jan 03, 2009 4:05 am

I have problem with build openocd revision 1297 with libftdi mingw based.
When I use command:
Code: Select all
./configure --enable-ft2232_libftdi CC="gcc -mno-cygwin"


I get error:
Code: Select all
checking Build & Link with libftdi...... configure: error: Cannot build & run test program using libftdi


I can build without any problems revision 717 mingw based and revision 1297 with Cygwin based.
Bool
 
Posts: 6
Joined: Sat Sep 02, 2006 7:45 am

Postby mifi » Sat Apr 04, 2009 7:50 am

Hello Bool,

take a look at the first post. I have added a new part to solve
the "Cannot build...." error.

The trick is to copy the ftd2xx.lib file inside the i386/amd64 folder to
libftd2xx.a

Best regards,

Michael
mifi
 
Posts: 193
Joined: Mon Jun 26, 2006 12:44 pm

openOCD revision 2431 windows vista cygwin

Postby JoeEE » Tue Jun 30, 2009 1:20 pm

Mifi,

I am starting to build openOCD revision 2431 on my windows vista laptop.

I got the latest "free as in beer" version of the FTDI library

I even got svn to nicely download all the source into cygwin,
but beyond that the "./bootstap" and the "./congfigure" commands were bombing.

See attached .pdf to see how they bombed. I will send this to
who ever provides email that allows attachements.

Or see my post at:
https://lists.berlios.de/pipermail/openocd-development/2009-June/008984.html
Or .pdf at
[url] https://lists.berlios.de/pipermail/open ... t-0001.pdf



Thanks for any assistance,

Joe
JoeEE
 
Posts: 13
Joined: Sat Jun 20, 2009 4:43 pm
Location: San Diego Ca

Help on compile/make openOCD, cygwin

Postby JoeEE » Wed Jul 01, 2009 7:33 am

I took another shot at attempting to compile my own version
of openOCD with ftd2xx. Both attemps on my work laptop (Vista)
and my home PC (XP) resulted in identical failure.

>>> This is important and relates,
to a bunch of people who would like to be able to succesfully use
openOCD with ftd2xx, right now <<<<

[url]http://forum.sparkfun.com/viewtopic.php?t=16172[\url]

Fact of the matter is we can not get the compile to work and get stuck
trying to use the unix like commands "./bootstrap" and "./configure"

One nice and impressive thing is that subversion was able to
properly download all the source files for openOCD, so we are almost
there.

This is a plea for help.

Here is an excerpt from openOCDs own website, that indicates
they may admit that using cygwin is not easy. It would sure help
if someone would come to our rescue and prove to us that it can
be done:

============================================
Building OpenOCD from a repository requires a recent version of the GNU
autotools (autoconf >= 2.59 and automake >= 1.9). For building on
Windows, you have to use Cygwin. Make sure that your @env{PATH}
environment variable contains no other locations with Unix utils (like
UnxUtils) - these can't handle the Cygwin paths, resulting in obscure
dependency errors. This was an observation gathered from the logs of
one user; please correct us if this is wrong.
Ref bottom of page here:
[url]http://svn.berlios.de/svnroot/repos/openocd/trunk/README[\url]
===========================================

It seem this statement is saying "We have not figured it out yet, either"
So the community is still looking for more help.

I think there is someone out there who is more unix savy than us
that can get us un-stuck. Cygwin is unix, mostly.


Sincerely,
Joe
JoeEE
 
Posts: 13
Joined: Sat Jun 20, 2009 4:43 pm
Location: San Diego Ca

Next

Return to OpenOCD

Who is online

Users browsing this forum: No registered users and 2 guests