On Sun, May 20, 2012 at 10:02 AM, Xiaofan Chen <xiaof...@gmail.com> wrote: > On Sun, May 20, 2012 at 2:59 AM, Freddie Chopin <freddie_cho...@op.pl> wrote: >> W dniu 2012-05-19 04:32, Xiaofan Chen pisze: >>> I think it does not interfere with stlink. Andreas' patch does not >>> use the existing libusb-1.0 infrastructure which Peter Stuge >>> strongly dislike. >> >> I had to add libusb-1.0 lib to my toolchain to build OpenOCD with these >> patches, and it made stlink use libusb-1.0 too. > > Andreas' patch is based on libusb-1.0, so of course it will dependency > to libusb-1.0 under Windows. > > As for stlink, I think it uses libusb_common.h which can be either use > libusb-1.0 (default) or libusb-0.1. > > The configure option to use libusb-0.1 (instead of the default libusb-1.0) > for stlink and Jlink is as followed. > --enable-libusb0 Use libusb-0.1 library for USB JTAG devices
Currently J-Link and ST-Link use the existing libusb-1.0 infrastructure (libusb_common.h). There are some advantages to use libusb-win32 filter (libusb0) for J-Link and ST-Link V1 (so that the original driver can be used as well) compared to libusb-1.0/libusbx which use WinUSB. For ST-Link V2, then it is better to use libusb-1.0 since it uses WinUSB driver which works out of the box for libusb-1.0 Windows (tested with libusbx-1.0.11). On the other hand, it is possible to use the libusb-win32 filter as well. The problem is that you can only use the same option for ST-Link V1 and V2. There is another problem, the --enable-libusb0 works well with vanilla git under Windows. But with the mpsse patch there is a problem. mcuee@dellxp /c/work/openocd/mpsse/openocd/build $ ../configure --enable-maintainer-mode --enable-ftdi \ --enable-ft2232_libftdi --enable-presto_libftdi --enable-stlink \ --enable-arm-jtag-ew --enable-jlink --enable-rlink \ --enable-usbprog --enable-vsllink --enable-usb_blaster_libftdi \ --enable-remote-bitbang --enable-vsllink --enable-ulink \ --enable-osbdm --enable-opendous \ --enable-libusb0 --disable-shared --disable-werror $ make ... make[4]: Entering directory `/c/work/openocd/mpsse/openocd/build/src' /bin/sh ../libtool --tag=CC --mode=link gcc -std=gnu99 -g -O2 -D__USE_MINGW_A NSI_STDIO -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra -Wno-unus ed-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -o openocd.exe main.o libopenocd.la ../jimtcl/libjim.a -lm -lftdi -lusb libtool: link: gcc -std=gnu99 -g -O2 -D__USE_MINGW_ANSI_STDIO -Wall -Wstrict-pro totypes -Wformat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function- cast -Wcast-align -Wredundant-decls -o openocd.exe main.o ./.libs/libopenocd.a -lws2_32 ../jimtcl/libjim.a -lftdi -lusb ./.libs/libopenocd.a(mpsse.o): In function `write_cb': c:\work\openocd\mpsse\openocd\build\src\jtag\drivers/../../../../src/jtag/driver s/mpsse.c:749: undefined reference to `libusb_submit_transfer@4' ./.libs/libopenocd.a(mpsse.o): In function `read_cb': c:\work\openocd\mpsse\openocd\build\src\jtag\drivers/../../../../src/jtag/driver s/mpsse.c:729: undefined reference to `libusb_submit_transfer@4' ./.libs/libopenocd.a(mpsse.o): In function `string_descriptor_equal': ... The problem is that "-lusb-1.0" is not appended for the mpsse option. Not so sure if this is the exciting problem with the configure script or the problem with the mpsse patch or even the MinGW/Msys environment. The following configure option works. LDFLAGS="-lusb-1.0" ../configure --enable-maintainer-mode --enable-ftdi \ --enable-ft2232_libftdi --enable-presto_libftdi --enable-stlink \ --enable-arm-jtag-ew --enable-jlink --enable-rlink \ --enable-usbprog --enable-vsllink --enable-usb_blaster_libftdi \ --enable-remote-bitbang --enable-vsllink --enable-ulink \ --enable-osbdm --enable-opendous \ --enable-libusb0 --disable-werror /bin/sh ../libtool --tag=CC --mode=link gcc -std=gnu99 -g -O2 -D__USE_MINGW_A NSI_STDIO -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra -Wno-unus ed-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -lusb-1.0 -o op enocd.exe main.o libopenocd.la ../jimtcl/libjim.a -lm -lftdi -lusb libtool: link: gcc -std=gnu99 -g -O2 -D__USE_MINGW_ANSI_STDIO -Wall -Wstrict-pro totypes -Wformat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function- cast -Wcast-align -Wredundant-decls -o openocd.exe main.o ./.libs/libopenocd.a c:/mingw/lib/libusb-1.0.dll.a -lws2_32 ../jimtcl/libjim.a -lftdi -lusb -Lc:/mingw/lib -Lc:/mingw/lib -- Xiaofan ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel