Olof Tångrot wrote:
> I need a build script,
..
> I prefer to use Linux since libusb, libftdi and openocd is more
> native on that platform.

Try this..

mkdir -p /tmp/test/src || exit 1
cd /tmp/test/src
git clone git://git.libusb.org/libusb.git
git clone git://developer.intra2net.com/libftdi-1.0
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
cd libusb && ./autogen.sh --prefix=/tmp/test && make install && cd ..
export LIBUSB_1_0_CFLAGS=/tmp/test/include
export LIBUSB_1_0_LIBS=/tmp/test/lib
cd libftdi-1.0 && ../openocd/bootstrap && ./configure \
--prefix=/tmp/test --disable-libftdipp --disable-python-binding \
--without-examples && make install && cd ..
export CFLAGS="-I/tmp/test/include -I/tmp/test/include/libusb-1.0"
export LDFLAGS=-L/tmp/test/lib
cd openocd && sed -i '/LIBS=.*-lusb"/s,-lusb,-lusb-1.0,' configure.in &&
sed -i '/^FTDI2232LIB =.*-lusb$/s, -lusb,,' src/Makefile.am &&
./bootstrap && ./configure --prefix=/tmp/test --enable-maintainer-mode \
--disable-doxygen-html --disable-parport-ppdev --enable-ft2232_libftdi && \
make install && cd ..
cd ..
bin/openocd -f share/openocd/scripts/interface/olimex-arm-usb-tiny-h.cfg \
-f share/openocd/scripts/target/lpc2148.cfg

It works here. You need autotools installed. You will get verbose
debug output from libusb-1.0 when running this openocd. Worst case it
is so verbose that it disrupts some timing requirements and makes the
JTAG communication fail. In that case, rebuild libusb-1.0 without
debugging. (See what autogen.sh does and replicate that, but without
the debug flag. Don't forget --prefix.)

The libusb-1.0 dir in CFLAGS is a workaround for a bug in how libftdi
uses libusb-1.0. libftdi should do #include <libusb-1.0/libusb.h> but
does #include <libusb.h> which is wrong. This forces all libftdi
users to mess with include paths, to add the directory that libftdi
happened to be built with, and this is clearly *not* how things are
supposed to work. libftdi should be fixed.

The two seds are neccessary since OpenOCD assumes that libftdi is
built against libusb-0.1. I'm not sure about the best fix for the
configure.in test, but for build time libtool will always do the
right thing if -lusb is simply removed from src/Makefile.am.


//Peter
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to