Saturday, September 22, 2012

OpenOCD 0.6.0 release 32bit Windows binary using libusbx 1.0.13

http://code.google.com/p/picusb/downloads/detail?name=openocd_0.6.0_mingw32.zip

OpenOCD 0.6.0
Release date: 7 September 2012
build date: 22 September 2012
build system: Windows XP SP3
compiler: GCC 4.7.0 (MinGW.org), 32bit only

Libraries used (32bit)
libftdi-0.20
libusb-win32-1.2.6.0
libusbx-1.0.13

Build commands used:

LDFLAGS="-lusb-1.0" ../configure --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 \
--disable-shared --disable-werror

Drive installation.
1) ST-Link V2: use the driver from ST (winusb based)

2) libusb-1.0 drivers are required for:
- ST-LINK V1
- J-Link
- FTDI FTx232 adapters when using config files from
interface/ftdi/ subfolder (mpsse engine)

You can install libusb-1.0 drivers using Zadig software from
the libwdi project
https://sourceforge.net/projects/libwdi/files/zadig/

You can choose to use winusb.sys, libusb0.sys, or libusbk.sys.
In general, they should perform the same but Winusb.sys
support in libusbx 1.0.13 may be more mature than libusb0.sys
and libusbk.sys.

For ST-Link V1 and J-Link, you may want to use the libusb-win32
filter driver since you can keep the existing vendor driver.

For FTx232 adapters (USB composite device), you can not use
the filter driver since libusbx 1.0.13 does not support
the filter driver for USB Composite device.

3) Other USB JTAG debuggers including FTDI FTx232 adapters when
not using config files from interface/ftdi/ subfolder (not using
the new mpsse engine)

Use Zadig to install libusb-win32 drivers (device driver or
filter driver)

Saturday, June 2, 2012

OpenOCD 0.6.0 development Windows binary snapshot for testing

I've packaged two Windows binary snapshots for those who are interested in testing the upcoming OpenOCD 0.6.0 release.

Download: http://code.google.com/p/picusb/downloads/list

One of the download is for the new mpsse patch series which use libusb-1.0 asynchronous API to speed up the speed of FTDI based adapters. The other is the regular git version. Compared to 0.5.0, the improvement in 0.6.0 is very significant, both in terms of new support (like ST-Link) and performance.

libftdi-0.20 Windows MinGW 32bit binary for download

Here is the unofficial libftdi-0.20 binary for download.
http://code.google.com/p/picusb/downloads/list, the file name is libftdi_0.20_devkit_mingw32_08April2012.zip .

They are built under Windows with MinGW. So if you have some difficulties building libftdi-0.20 from source for Windows, you may want to try out the binary I built.

libusb-1.0 and libusbx in OpenBSD ports and NetBSD pkgsrc now

libusb-1.0.9 and libusbx-1.0.11 have OpenBSD/NetBSD support. Now libusb-1.0 and libusb-compat are OpenBSD's ports system. NetBSD's pkgsrc system (okay, pkgsrc is not only for NetBSD) now has both libusb-1.0.9 and libusbx-1.0.11, it also has libusb-compat as well.

On the other hand, at least for the faster moving libusbx, OpenBSD/NetBSD are behind the other supported OS (Linux, Mac OS X and Windows). Hopefully the OpenBSD/NetBSD users can jump in and bridge the gap.

Take note FreeBSD has its own libusb-1.0/libusb-0.1 wrapper on top of its own libusb20 library.

Sunday, April 15, 2012

OpenBSD, NetBSD and libusb-1.0

There is OpenBSD support in libusb.git. Since NetBSD and OpenBSD should have quite similar USB codes, I think that it should work under NetBSD as well.
Therefore I tried the following dirty patch to enable libusb-1.0 experimental support for NetBSD using the OpenBSD backend.
Take note FreeBSD has its own libusb-1.0 implementation which should be more mature than the OpenBSD backends of libusb-1.0 which is very recent.
diff --git a/configure.ac b/configure.ac
index ebbc107..71aad37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,17 @@ case $host in
       AC_CHECK_HEADERS([poll.h])
       AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
       ;;
+*-netbsd*)
+       AC_DEFINE(OS_OPENBSD, 1, [OpenBSD backend])
+       AC_SUBST(OS_OPENBSD)
+       AC_MSG_RESULT([OpenBSD])
+       backend="openbsd"
+       threads="posix"
+       THREAD_CFLAGS="-pthread"
+       PC_LIBS_PRIVATE="-pthread"
+       AC_CHECK_HEADERS([poll.h])
+       AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
+       ;;
 *-mingw*)
       AC_MSG_RESULT([Windows])
       backend="windows"
And indeed it seems to work under NetBSD (tested with a NetBSD 5.1 VirtualBox VM under Mac OS X Lion)
localhost$ sudo ./listdevs
04d8:fa2e (bus 0, device 2)
I also tested libusb-pbatard's xusb example.
localhost$ sudo ./xusb -d 04d8:fa2e

Opening device...
speed: Unknown

Reading device descriptor:


Reading device descriptor:
           length: 18
     device class: 0
              S/N: 3
          VID:PID: 04D8:FA2E
        bcdDevice: 0001
  iMan:iProd:iSer: 1:2:3
         nb confs: 1

Reading configuration descriptors:
            nb interfaces: 1
             interface[0]: id = 0
interface[0].altsetting[0]: num endpoints = 2
  Class.SubClass.Protocol: 00.00.00
      endpoint[0].address: 01
          max packet size: 0020
         polling interval: 00
      endpoint[1].address: 81
          max packet size: 0020
         polling interval: 00
interface[0].altsetting[1]: num endpoints = 2
  Class.SubClass.Protocol: 00.00.00
      endpoint[0].address: 01
          max packet size: 0040
         polling interval: 00
      endpoint[1].address: 81
          max packet size: 0040
         polling interval: 00

Claiming interface 0...

Reading string descriptors:
  String (0x01): "Travis Robinson"
  String (0x02): "Benchmark Device"
  String (0x03): "LUSBW1"

Releasing interface 0...
Closing device...

Saturday, March 10, 2012

Mac Mini 2011 Impression

My 3-year old Acer Desktop (running Windows Vista, Windows 7, Ubuntu Linux and Arch Linux) died in the end of 2011 and I decided to try Mac OS X instead as my main home desktop. The cheapest option from Apple is Mac Mini 2011 and I chose to buy the cheapest option at S$788 ( http://www.apple.com/sg/macmini/ ).

The spec is fine for me, Intel Core i5 2.3GHz, 2GB DDR3 RAM, 500GB 5400rpm HDD, built-in Intel HD3000 graphics, 802.11n WiFi, Bluetooth, Gigabit Ethernet, Thunderbolt, Firewire 800, USB 2.0, HDMI, SDXC Card Slot. I use it with a 20 inch Compaq monitor (resolution 1600 x 900), an Acer keyboard and a Logitech wireless USB mouse. The 4 USB ports are not enough for me so I use a USB hub as well. A cheap web camera is also attached. I also use a 1TB external USB HDD (Western Digital Mybook Essential) as the backup disk using Time Machine.

The weakest link is the 2GB DDR3 RAM which I intend to upgrade soon. Mac OS X Lion is 64bit and it seems to require more ram than Windows 7 x64. USB 3.0 would be nice but we may have to wait for next-generation Intel chipset with USB 3.0 built-in.

I have no problems with the Mac Mini so far after 3 months of use other than than the occasional slow response which I hope to fix after upgrading the RAM.

Under Windows and Linux, I usually use Firefox as the main Internet browser with Chrome as the backup. But with this Mac Mini, I tend to use Safari more often.

I have no problem to build applications (e.g.: libusb, libftdi, OpenOCD, pyusb, etc) with Mac Homebrew since I am familiar with the terminal environment under Linux and Windows (Cygwin/MSys).

MPlayerX and VLC are the two main video player for me. iTune is also used occasionally.

I have Microsoft Office for Mac 2011 installed but I am not using it very often.

The App Store for Mac is quite convenient, however not many apps are available for Mac OS X compared to iOS ( I have an iPad 2).

Edit: upgraded to 8GB RAM (4GB x 2) and now it funs much more smooth. I also installed VirtualBox and then quite a few VMs (Windows and Linux) and they work fine. Good thing is that USB seems to work fine as well under VirtualBox.