https://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_7_(FTD2XX)_-_Pre_June_2011&feed=atom&action=historyCompiling OpenOCD for Windows 7 (FTD2XX) - Pre June 2011 - Revision history2024-03-19T11:59:02ZRevision history for this page on the wikiMediaWiki 1.31.0https://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_7_(FTD2XX)_-_Pre_June_2011&diff=118736&oldid=prevWmat: Adding proper categories2012-04-18T03:08:40Z<p>Adding proper categories</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 03:08, 18 April 2012</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l134" >Line 134:</td>
<td colspan="2" class="diff-lineno">Line 134:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>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]].</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>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]].</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:TinCanTools]]</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:OpenOCD]]</ins></div></td></tr>
<!-- diff cache key elinux:diff::1.12:old-114794:rev-118736 -->
</table>Wmathttps://elinux.org/index.php?title=Compiling_OpenOCD_for_Windows_7_(FTD2XX)_-_Pre_June_2011&diff=114794&oldid=prevWmat: Porting TinCanTools wiki content.2012-04-11T03:50:43Z<p>Porting TinCanTools wiki content.</p>
<p><b>New page</b></p><div>''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 7 (LibFTDI)]].''<br />
<br />
<br />
<br />
This guide will compile [[OpenOCD]] 0.4.0 for Windows 7 with the FTD2XX driver library, for use with the TinCanTools Flyswatter. The process is identical on 32 and 64 bit versions of Windows.<br />
<br />
<br />
==Configuring Windows 7==<br />
<br />
[[OpenOCD]] uses a command line interface and accepts commands from a telnet client. To use [[OpenOCD]] in Windows 7 you will need to enable the 'Run' command and telnet client. See [[Configuring Windows 7 for OpenOCD]].<br />
<br />
<br />
==Installing Cygwin==<br />
<br />
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.<br />
[[File:Cygwinsetup_win7.png|thumb|Installing Cygwin Packages]]<br />
In the Cygwin installer you will be prompted to select additional packages to install. Install the following optional packages, found under the Devel heading:<br />
<br />
<code><br />
autoconf<br />
automake<br />
gcc-core<br />
gcc-g++<br />
libtool<br />
libusb-1.0<br />
libusb-win32<br />
libusb-devel<br />
make<br />
</code><br />
<br />
<br />
<br />
==Cygwin Changes May 2011==<br />
<br />
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.<br />
<br />
Open the Cygwin command line interface. The default Cygwin install places a shortcut in '''Start Menu > All Programs > Cygwin > Cygwin Bash Shell'''. Navigate to '''/usr/i686-pc-mingw32/lib'''.<br />
<br />
cd /usr/i686-pc-mingw32/lib<br />
<br />
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.<br />
<br />
for f in *.o ; do<br />
rm -f $f<br />
ln -fs /usr/lib/mingw/$f .<br />
done<br />
<br />
If you do not do this, every time you try to compile with the '''-mno-cygwin''' flag you will see this error:<br />
<br />
configure: error: C compiler cannot create executables<br />
<br />
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.<br />
<br />
<br />
==Installing libusb==<br />
<br />
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'''.<br />
<br />
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'''.<br />
<br />
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'''.<br />
<br />
<br />
==Installing FTD2XX==<br />
<br />
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'''.<br />
<br />
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'''.<br />
[[File:Ftd2xxinstall_win7.png|thumb|Installing FTD2XX]]<br />
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'''.<br />
<br />
Plug the Flyswatter into your computer's USB port. Install FTD2XX as follows:<br />
<br />
* Open the '''Control Panel'''.<br />
* If the '''View By''' dropdown menu in the upper right shows '''Category''', change it to '''Large Icons''' or '''Small Icons'''.<br />
* Click '''System'''.<br />
* Click '''Device Manager''' on the left.<br />
* Find the '''Flyswatter''' devices. There should be two of them.<br />
* Right click the first '''Flyswatter''' device and select '''Update Driver Software'''.<br />
* Choose '''Browse my computer for driver software'''.<br />
* Click '''Browse'''.<br />
* Navigate to '''C:/cygwin/home/ftd2xx'''.<br />
* Click '''OK.''' The panel should now look like the screenshot to the right.<br />
* Click '''Next''' and wait for the install to complete.<br />
* Repeat the process for the other '''Flyswatter''' device.<br />
<br />
<br />
==Compiling OpenOCD==<br />
<br />
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.<br />
<br />
cd /home/openocd-0.4.0<br />
<br />
Compile [[OpenOCD]] with the following commands:<br />
<br />
<code>./configure --disable-werror --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=../ftd2xx <br />
CC="gcc-3 -mno-cygwin -L/usr/lib/mingw -L/usr/lib/w32api -I/usr/include/mingw -I/usr/include/w32api"</code><br />
<br />
Type the above all one one line. Note that "../ftd2xx" 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 7. <br />
<br />
Finish compiling as follows:<br />
<br />
<code>make<br />
make install</code><br />
<br />
<br />
==Preparing to Run OpenOCD==<br />
<br />
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.<br />
<br />
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 > My Computer''' and open your '''C:''' drive. Right-click anywhere in the '''C:''' drive window and select '''New > Folder'''. Rename the new folder '''openocd'''.<br />
<br />
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.<br />
<br />
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:<br />
<br />
board<br />
chip<br />
cpld<br />
cpu<br />
openocd.exe<br />
interface<br />
target<br />
test<br />
bitsbytes.tcl<br />
memory.tcl<br />
mmr_helpers.tcl<br />
readable.tcl<br />
<br />
You can now run [[OpenOCD]] from '''C:\openocd'''. To get started running OpenOCD, see [[Running OpenOCD on Windows]].<br />
<br />
<br />
==Installing LibUSB Device Filters==<br />
<br />
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]].</div>Wmat