User Tools

Site Tools


gnulinux:cross

This is an old revision of the document!


# Cross-compile OpenOCD on GNU/Linux for Windows

## Overview

The following was done using OpenOCD 0.8.0 and Archlinux x86_64. Target OS is Windows 7 32bits, but it should also work for 64bits versions.

## Requirements

You need a few packages. Some already exist in community or in AUR so:

  yaourt -S mingw-w64-gcc mingw-w64-libusb mingw-w64-hidapi

### LibFTDI

Download this pkgbuild, make your package and install it: pkgbuild

  makepkg
  yaourt -U ./mingw-w64-libftdi*.tar.xz

### LibUSB-compat

Download this pkgbuild, make your package and install it: pkgbuild

  makepkg
  yaourt -U ./mingw-w64-libusb-compat*.tar.xz

#### Fix

Here's the trick, you need to remove the existing usb.h from mingw-w64-headers to be able to install mingw-w64-libusb-compat. There must be a better way to fix this conflict but I didn't have much time to investigate…

## OpenOCD compilation

Get openocd-0.8.0.tar.bz2 from Sourceforge

  tar xavf openocd-0.8.0.tar.bz2
  cd openocd-0.8.0
  # Eventually apply the patches you want
  autoreconf -fiv
  mkdir build
  cd build
  HIDAPI_LIBS="-lhidapi" ../configure --build=i686-pc-linux-gnu --host=i686-w64-mingw32 --disable-shared
  make -j8

Get openocd.exe from _build/src/_

It will require the DLL files from _/usr/i686-w64-mingw32/bin/_

## Running OpenOCD

Put the executable and the DLL in the same folder. Install WinUSB drivers for you device (maybe using Zadig). And you should be able to run OpenOCD =)

/home/share/www/redox.ws/wiki/data/attic/gnulinux/cross.1427217920.txt.gz · Last modified: 2023/11/24 21:55 (external edit)