Last active
May 22, 2016 13:15
-
-
Save cjmeyer/4599885 to your computer and use it in GitHub Desktop.
Bash: Build OpenOCD with JLink support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/sh | |
# | |
# Build script to cross-compile OpenOCD with MinGW on Mint Linux (FTDI, JLINK, TI-ICDI, OSBDM). | |
# | |
# 7zip | |
# curl | |
# git | |
# MinGW-W64 | |
# libtool | |
# Automake | |
# texinfo | |
# | |
mkdir -p libusbx-1.0.14-win | |
git clone "git://git.code.sf.net/p/openocd/code" openocd-git | |
echo "Downloading D2XX..." | |
curl -L "http://www.ftdichip.com/Drivers/CDM/CDM%202.08.24%20WHQL%20Certified.zip" -o CDM_20824.zip | |
echo "Downloading libusb-win32..." | |
curl -L "http://downloads.sourceforge.net/project/libusb-win32/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip" -o libusb-win32-bin-1.2.6.0.zip | |
echo "Downloading libusbx-1.0.14-win..." | |
curl -L "http://downloads.sourceforge.net/project/libusbx/releases/1.0.14/Windows/libusbx-1.0.14-win.7z" -o libusbx-1.0.14-win/libusbx-1.0.14-win.7z | |
echo "Unpacking D2XX..." | |
unzip -uo -qq CDM_20824.zip -d CDM_20824 | |
echo "Unpacking libusb-win32..." | |
unzip -uo -qq libusb-win32-bin-1.2.6.0.zip | |
echo "Unpacking libusbx-1.0.14-win..." | |
cd libusbx-1.0.14-win | |
p7zip -d libusbx-1.0.14-win.7z | |
cd .. | |
echo "Installing D2XX..." | |
cp CDM_20824/ftd2xx.h /usr/i686-w64-mingw32/include | |
cp CDM_20824/i386/ftd2xx.lib /usr/i686-w64-mingw32/lib/ftd2xx.a | |
echo "Installing libusb-win32..." | |
cp libusb-win32-bin-1.2.6.0/lib/gcc/libusb.a /usr/i686-w64-mingw32/lib | |
cp libusb-win32-bin-1.2.6.0/include/lusb0_usb.h /usr/i686-w64-mingw32/include | |
echo "Installing libusbx-1.0.14-win..." | |
cp libusbx-1.0.14-win/MinGW32/dll/* /usr/i686-w64-mingw32/lib | |
cp libusbx-1.0.14-win/MinGW32/static/* /usr/i686-w64-mingw32/lib | |
cp -r libusbx-1.0.14-win/include/libusbx-1.0 /usr/i686-w64-mingw32/include/libusbx-1.0 | |
ln -s /usr/i686-w64-mingw32/include/libusbx-1.0 /usr/i686-w64-mingw32/include/libusb-1.0 | |
cd openocd-git | |
./bootstrap | |
cd .. | |
mkdir -p openocd-build | |
echo "Configuring OpenOCD..." | |
cd openocd-build | |
../openocd-git/configure \ | |
--enable-maintainer-mode \ | |
--build=i686-pc-cygwin \ | |
--host=i686-w64-mingw32 \ | |
--disable-werror \ | |
--disable-shared \ | |
--enable-ft2232_ftd2xx \ | |
--with-ftd2xx-win32-zipdir=../CDM_20824 \ | |
--enable-jlink \ | |
--enable-ti-icdi \ | |
--enable-osbdm \ | |
--prefix=$(pwd)/../openocd-install | |
echo "Building OpenOCD..." | |
make | |
echo "Installing OpenOCD..." | |
make install | |
cd ../openocd-install | |
cp ../libusbx-1.0.14-win/MinGW32/dll/*.dll ./bin | |
cp ../CDM_20824/i386/ftd2xx.dll ./bin | |
echo "Cleaning OpenOCD install directory..." | |
cp -r share/openocd/contrib contrib | |
cp -r share/openocd/scripts scripts | |
rm -rf share | |
rm -rf lib | |
cd .. | |
echo "Copying OpenOCD checkout information to install directory..." | |
cp openocd-git/NEWS* openocd-install | |
cp openocd-git/BUGS openocd-install | |
cp $0 openocd-install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment