<?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_(LibFTDI)_-_Pre_June_2011&amp;feed=atom&amp;action=history</id>
		<title>Compiling OpenOCD for Windows XP (LibFTDI) - 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_(LibFTDI)_-_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_(LibFTDI)_-_Pre_June_2011&amp;action=history"/>
		<updated>2013-05-26T04:40:48Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.22alpha</generator>

	<entry>
		<id>http://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_XP_(LibFTDI)_-_Pre_June_2011&amp;diff=118730&amp;oldid=prev</id>
		<title>Wmat: Adding proper categories</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_XP_(LibFTDI)_-_Pre_June_2011&amp;diff=118730&amp;oldid=prev"/>
				<updated>2012-04-18T03:07:45Z</updated>
		
		<summary type="html">&lt;p&gt;Adding proper categories&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 03:07, 18 April 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 152:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 152:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&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;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&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;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:TinCanTools]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:OpenOCD]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key elinux:diff:version:1.11a:oldid:114848:newid:118730 --&gt;
&lt;/table&gt;</summary>
		<author><name>Wmat</name></author>	</entry>

	<entry>
		<id>http://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_XP_(LibFTDI)_-_Pre_June_2011&amp;diff=114848&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_(LibFTDI)_-_Pre_June_2011&amp;diff=114848&amp;oldid=prev"/>
				<updated>2012-04-11T03:57:10Z</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 will compile [[OpenOCD]] 0.4.0 on Windows XP with the libFTDI driver library, for use with the TinCanTools Flyswatter. The executable created with this guide is compatible with Windows XP and Windows 7. 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 updated 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 for the Flyswatter==&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;
Plug the Flyswatter into your computer's USB port. The Windows Found New Hardware Wizard will appear twice, once for each interface. Click Cancel both times.&lt;br /&gt;
&lt;br /&gt;
In Windows Explorer or from the command line, navigate to '''\libusb-win32-bin-1.2.2.0\bin''' and run '''inf-wizard.exe'''. Click Next from the first screen. You should see a menu with two devices, Flyswatter (Interface 1) and Flyswatter (Interface 0). Select Flyswatter (Interface 1) and click Next twice. You will be prompted to save a .inf file to your hard drive. Click Save. On the next screen, click Install Now. You may see a warning that the driver has not been digitally signed by Microsoft. Click Yes to install anyway.&lt;br /&gt;
&lt;br /&gt;
Now repeat this process for Flyswatter (Interface 0). If the install is successful, you will see two new devices listed in the Device Manager ('''Control Panel &amp;gt; System &amp;gt; Hardware tab &amp;gt; Device Manager''') under the heading &amp;quot;libusb-win32 devices&amp;quot; labeled Flyswatter (Interface 0) and Flyswatter (Interface 1).&lt;br /&gt;
&lt;br /&gt;
==Downloading and Editing libFTDI==&lt;br /&gt;
&lt;br /&gt;
libFTDI is an open source FTDI driver you will need to compile [[OpenOCD]]. Download libftdi-0.18 from http://www.intra2net.com/en/developer/libftdi/download.php, and extract it to '''C:\cygwin\home'''.&lt;br /&gt;
[[File:Ftdi-win32-fix.png|thumb|Editing ftdi.c]]&lt;br /&gt;
Navigate to '''\libftdi-0.18\src''' and open the file '''ftdi.c''' in a text editor. Find the line reading:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;#ifdef __WIN32__&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(This line should appear only once in the file.) Delete the two underscores following '''__WIN32''', so that the line reads:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;#ifdef __WIN32&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without this change, libFTDI [[OpenOCD]] will compile but will be unable to interact with the Flyswatter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compiling and Installing libFTDI==&lt;br /&gt;
&lt;br /&gt;
Open the Cygwin command line interface. The default installation will create a shortcut in your start menu, '''Start Menu &amp;gt; All Programs &amp;gt; Cygwin &amp;gt; Cygwin Bash Shell'''. In the Cygwin command line navigate to the folder where you extracted the libFTDI source.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;cd /home/libftdi-0.18&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Compile with the following commands. Run the first and wait for it to finish, then run the next, and so on:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Cygwin or Windows Explorer, navigate to '''C:\cygwin\home\libftdi-0.18\src\.libs''', find the file '''libftdi.a''', and copy it to '''C:\cygwin\lib'''.&lt;br /&gt;
&lt;br /&gt;
Now compile libFTDI again, but this time compile it to run without Cygwin.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;cd /home/libftdi-0.18&lt;br /&gt;
 make distclean&lt;br /&gt;
 ./configure 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;&lt;br /&gt;
 make&lt;br /&gt;
 make install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go to  '''C:\cygwin\home\libftdi-0.18\src\.libs''' again, and copy the new '''libftdi.a''' to '''C:\cygwin\lib\mingw'''. Then go to '''C:\cygwin\home\libftdi-0.18\src''', find the file '''ftdi.h''' and copy it to '''C:\cygwin\usr\include\mingw'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Cygwin Changes May 2011, Part 2==&lt;br /&gt;
&lt;br /&gt;
Remember the symbolic links you created before? If your most recent Cygwin update was between May 1 and June 1, 2011, you will need to create an additional symbolic link to '''libftdi.a'''. Navigate to '''/usr/i686-pc-mingw32''' and create the link now. (If you most recently updated Cygwin before May 1 or after June 1, 2011, you can skip this step.)&lt;br /&gt;
&lt;br /&gt;
 cd /usr/i686-pc-mingw32/lib&lt;br /&gt;
 ln -s /usr/lib/mingw/libftdi.a .&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;
 ./configure --disable-werror --enable-ft2232_libftdi CC=&amp;quot;gcc-3 -mno-cygwin -L/usr/lib/mingw -L/usr/lib/w32api &lt;br /&gt;
       -I/usr/include/mingw -I/usr/include/w32api&amp;quot;&lt;br /&gt;
&lt;br /&gt;
(Type the above all in one line.)&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>