<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://elinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_XP_(FTD2XX)_-_Pre_June_2011&amp;feed=atom&amp;action=history</id>
		<title>Compiling OpenOCD for Windows XP (FTD2XX) - Pre June 2011 - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_XP_(FTD2XX)_-_Pre_June_2011&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_XP_(FTD2XX)_-_Pre_June_2011&amp;action=history"/>
		<updated>2013-05-21T14:59:13Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21alpha</generator>

	<entry>
		<id>http://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_XP_(FTD2XX)_-_Pre_June_2011&amp;diff=114878&amp;oldid=prev</id>
		<title>Wmat: Porting TinCanTools wiki content.</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_XP_(FTD2XX)_-_Pre_June_2011&amp;diff=114878&amp;oldid=prev"/>
				<updated>2012-04-11T04:00:32Z</updated>
		
		<summary type="html">&lt;p&gt;Porting TinCanTools wiki content.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;''This guide is out of date. Because of the recent addition of a cross-compiler to Cygwin, these instructions apply only to a user with Cygwin already installed and last updated before June 2, 2011. An up-to-date guide will be available soon. For an up-to-date guide to an alternative libFTDI build, see [[Compiling OpenOCD for Windows XP (LibFTDI)]].''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This guide will compile [[OpenOCD]] 0.4.0 for Windows XP with the FTD2XX driver library, for use with the TinCanTools Flyswatter. The process is identical on 32 and 64 bit versions of Windows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Installing Cygwin==&lt;br /&gt;
&lt;br /&gt;
Download and install Cygwin 1.7.8-1 from http://www.cygwin.com. Cygwin provides a GNU development environment for Windows, which will allow you to compile [[OpenOCD]] using the GNU Compiler Collection (GCC). You will not need Cygwin to run [[OpenOCD]]. The Cygwin installer is available at http://cygwin.com/install.html.&lt;br /&gt;
[[File:Cygwinsetup.png|thumb|Installing Cygwin Packages]]&lt;br /&gt;
In the Cygwin installer you will be prompted to select additional packages to install. Install the following optional packages, found under the Devel heading:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 autoconf&lt;br /&gt;
 automake&lt;br /&gt;
 gcc-core&lt;br /&gt;
 gcc-g++&lt;br /&gt;
 libtool&lt;br /&gt;
 libusb-1.0&lt;br /&gt;
 libusb-win32&lt;br /&gt;
 libusb-devel&lt;br /&gt;
 make&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Cygwin Changes May 2011==&lt;br /&gt;
&lt;br /&gt;
Until June 1, 2011, Cygwin is undergoing changes to improve its support for Windows cross-compilation. If you have downloaded or update Cygwin since May 1, 2011, you will need to make some changes to make the GCC C compiler support the '''-mno-cygwin''' flag. If you last updated Cygwin before May 1, 2011 or after June 1, 2011, you should skip this section.&lt;br /&gt;
&lt;br /&gt;
Open the Cygwin command line interface. The default Cygwin install places a shortcut in '''Start Menu &amp;gt; All Programs &amp;gt; Cygwin &amp;gt; Cygwin Bash Shell'''. Navigate to '''/usr/i686-pc-mingw32/lib'''.&lt;br /&gt;
&lt;br /&gt;
 cd /usr/i686-pc-mingw32/lib&lt;br /&gt;
&lt;br /&gt;
That directory contains several symbolic links. Redirect them by typing the following. Hit Return after typing each line. The loop will not execute until you type the last line and hit Return. Be sure to include the trailing period at the end of the third line.&lt;br /&gt;
&lt;br /&gt;
 for f in *.o ; do&lt;br /&gt;
 rm -f $f&lt;br /&gt;
 ln -fs /usr/lib/mingw/$f .&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
If you do not do this, every time you try to compile with the '''-mno-cygwin''' flag you will see this error:&lt;br /&gt;
 &lt;br /&gt;
 configure: error: C compiler cannot create executables&lt;br /&gt;
&lt;br /&gt;
For more information and alternative solutions, see this article: http://cygwin.com/ml/cygwin-announce/2011-04/msg00015.html. Refer to this more in-depth article if you see the above error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Installing libusb==&lt;br /&gt;
&lt;br /&gt;
Libusb is a usb driver library you will need to communicate with the Flyswatter. You will need a newer version of libusb than the one distributed through the Cygwin installer, and you will need libusb for Windows as well. Download libusb-win32-1.2.4.0 from http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/libusb-win32-bin-1.2.4.0.zip/download. Open the zip archive and extract the contents to '''C:\cygwin\home'''.&lt;br /&gt;
&lt;br /&gt;
Navigate to the folder '''\libusb-win32-bin-1.2.2.0\lib\gcc'''. Copy the file '''libusb.a''' to '''C:\cygwin\lib''' and '''C:\cygwin\lib\mingw'''.&lt;br /&gt;
&lt;br /&gt;
Navigate to '''\libusb-win32-bin-1.2.2.0\include'''. Copy the file '''usb.h''' to '''C:\cygwin\usr\include''' and '''C:\cygwin\usr\include\mingw'''.&lt;br /&gt;
&lt;br /&gt;
==Installing FTD2XX==&lt;br /&gt;
&lt;br /&gt;
Download version 2.08.14 of the D2XX Windows drivers from http://www.ftdichip.com/Drivers/D2XX.htm. Direct link is here: http://www.ftdichip.com/Drivers/CDM/CDM20814_WHQL_Certified.zip. Extract the contents to '''C:\cygwin\home\ftd2xx'''.&lt;br /&gt;
&lt;br /&gt;
In Windows Explorer, open the ftd2xx folder and find the file '''ftd2xx.h'''. Copy this file to '''C:\cygwin\usr\include''' and '''C:\cygwin\usr\include\mingw'''.&lt;br /&gt;
[[File:Ftd2xxinstall.png|thumb|The Found New Hardware Wizard]]&lt;br /&gt;
Navigate to '''C:\cygwin\home\ftd2xx\i386''' and find the file ftd2xx.lib. Copy it, rename the copy '''ftd2xx.a''' and move the new file to '''C:\cygwin\usr\local\lib'''.&lt;br /&gt;
&lt;br /&gt;
Plug the Flyswatter into your computer's USB port. The Windows Found New Hardware Wizard should appear. Choose &amp;quot;No, not this time&amp;quot; to decline to connect to Windows Update. On the next screen, choose &amp;quot;Install from a list of specific location.&amp;quot; On the third screen, choose &amp;quot;Search for the best drivers in these locations,&amp;quot; check &amp;quot;Include this location in the search,&amp;quot; and enter '''C:\cygwin\home\ftd2xx.'''&lt;br /&gt;
&lt;br /&gt;
Click Next. Windows should find and install the FTDI drivers. If you see a warning that the drivers have not passed Windows Logo testing, choose &amp;quot;Install Anyway.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The Found New Hardware Wizard should appear twice. The second time the wizard appears, repeat the process exactly as above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compiling OpenOCD==&lt;br /&gt;
&lt;br /&gt;
Download the [[OpenOCD]] 0.4.0 source from http://prdownload.berlios.de/openocd/openocd-0.4.0.zip and extract it to '''C:\cygwin\home\openocd-0.4.0'''. In the Cygwin command line interface, navigate to your '''openocd-0.4.0''' directory.&lt;br /&gt;
&lt;br /&gt;
 cd /home/openocd-0.4.0&lt;br /&gt;
&lt;br /&gt;
Compile [[OpenOCD]] with the following commands:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;./configure --disable-werror --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=../ftd2xx &lt;br /&gt;
        CC=&amp;quot;gcc-3 -mno-cygwin -L/usr/lib/mingw -L/usr/lib/w32api -I/usr/include/mingw -I/usr/include/w32api&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Type the above all one one line. Note that &amp;quot;../ftd2xx&amp;quot; is the path to your ftd2xx directory. You may need to change this argument if you extracted ftd2xx to a different location. You may use either a relative path, as above, or an absolute path, such as '''C:\cygwin\home\ftd2xx'''. The argument '''--with-ftd2xx-win32-zipdir''' should be used even on 64 bit Windows XP. &lt;br /&gt;
&lt;br /&gt;
Finish compiling as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;make&lt;br /&gt;
 make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Preparing to Run OpenOCD==&lt;br /&gt;
&lt;br /&gt;
Navigate to '''C:\cygwin\home\openocd-0.4.0\src''' to find '''openocd.exe'''. The executable can be run from the Windows command line and does not require Cygwin.&lt;br /&gt;
&lt;br /&gt;
You can run openocd from '''C:\cygwin\home\openocd-0.4.0\src''', but you may encounter problems with configuration files. For a more in-depth discussion of these issues, see [[OpenOCD Config File Paths]]. This guide recommends that you create a new folder containing OpenOCD and its config files. Go to '''Start Menu &amp;gt; My Computer''' and open your '''C:''' drive. Right-click anywhere in the '''C:''' drive window and select '''New &amp;gt; Folder'''. Rename the new folder '''openocd'''.&lt;br /&gt;
&lt;br /&gt;
In another Windows Explorer window, open '''C:\cygwin\home\openocd-0.4.0\tcl'''. Click and drag to select all the contents of the folder. Right-click on any file and select Copy. Open '''C:\openocd''', right-click anywhere, and select Paste.&lt;br /&gt;
&lt;br /&gt;
Now go to '''C:\cygwin\home\openocd-0.4.0\src''' and copy '''openocd.exe''' to '''C:\openocd'''. The folder should now contain the following files and folders:&lt;br /&gt;
&lt;br /&gt;
 board&lt;br /&gt;
 chip&lt;br /&gt;
 cpld&lt;br /&gt;
 cpu&lt;br /&gt;
 openocd.exe&lt;br /&gt;
 interface&lt;br /&gt;
 target&lt;br /&gt;
 test&lt;br /&gt;
 bitsbytes.tcl&lt;br /&gt;
 memory.tcl&lt;br /&gt;
 mmr_helpers.tcl&lt;br /&gt;
 readable.tcl&lt;br /&gt;
&lt;br /&gt;
You can now run [[OpenOCD]] from '''C:\openocd'''. To get started running OpenOCD, see [[Running OpenOCD on Windows]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Installing LibUSB Device Filters==&lt;br /&gt;
&lt;br /&gt;
If the configure command above halts with an error stating that it is unable to compile and run a test program, or if '''openocd.exe''' compiles successfully but cannot open the FTDI device, you may need to install a [[libusb Device Filter]].&lt;/div&gt;</summary>
		<author><name>Wmat</name></author>	</entry>

	</feed>