原创 How to build openocd for windows(2)

2008-10-30 12:48 4626 11 8 分类: MCU/ 嵌入式

Hello,


here comes more information in case you want to build openocd
for a interface which need libusb or libftdi.

First of all
you must download libusb-win32 which can be found here:

http://sourceforge.net/project/showfiles.php?group_id=78138&package_id=79216&release_id=495011


You need the libusb-win32-device-bin-0.1.12.1.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.1

Now
copy the file libusb-win32-device-bin-0.1.12.1\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.1\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.13.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.13

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




Code:



./configure






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




Code:



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.13/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:



make distclean






But now use the
following command to configure:




Code:



./configure CC="gcc
-mno-cygwin"






After this you can
build it with:




Code:



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.13/src/.libs

Copy the libftdi.a to
the following folder:

c:\cygwin\lib\mingw

Copy now
the header file /home/openocd/libftdi-0.13/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:



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:



./bootstrap






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




Code:



./configure
--enable-ft2232_libftdi






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




Code:



./configure
--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:



make






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


/home/openocd/trunk/src

Now you have all the tools
and information to build an openocd version for windows, e.g:


- FT2232, ftd2xx :
./configure --enable-ft2232_ftd2xx
--with-ftd2xx=/home/openocd/ftd2xx

- FT2232, libusb &
libftdi : ./configure --enable-ft2232_libftdi
- PRESTO,
ftd2xx: ./configure --enable-presto_ftd2xx
--with-ftd2xx=/home/openocd/ftd2xx

- J-Link, libusb :
./configure --enable-jlink
- Parport with giveio:
./configure --enable-parport --enable-parport_giveio




Best regards,


Michael


PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
11
关闭 站长推荐上一条 /3 下一条