dfu-util on Win32
xavier.pianet at lusis.fr
Wed Oct 31 19:33:31 CET 2007
To continue on the subject i posted a patch on the pyusb sourceforge
site for the small modifications i made.
The diff works for version 0.4.1 or for the latest cvs files.
I can now switch back and forth from runtime to dfu mode.
I can also upload a partition from neo to local file.
download is implemented but not tested yet.
It all fits in 3 files that are still 'work in progress' but maybe it
could be interesting for comments/remarks.
dfu.py -> the core class, collected from dfu.c and putted in a more
sam7dfu.py -> just extends the DFU class withe do_upload, do_download
methods that works on file instead of raw buffers. I wonder what is sam7
specific in sam7dfu.c, i guess i will merge it in dfu.py
dfu_util.py -> the main program, dfu capable device enumeration, and some
If someone is interested i'm not sure of where to put the files ? idealy
they could end up in a python directory in the dfu_util source tree
Still one thing i would like to know, is how to send commands to the
device in runtime mode.
Xavier Pianet a écrit :
> Hi Jim, Harald,
> A little update on that subject.
> Jim Huang a écrit :
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> Xavier Pianet 提到:
>>> Hi there,
>>> There was a thread 2 months ago ( dfu-util on Win32 [was: dfu-util on
>>> Mac OS X] ).
>>> What is the status of the port ?
>> hi Xavier,
>> openmoko internal has a working Win32 dfu-util based on Cygwin. But it
>> doesn't work well for another MinGW native porting. I was working on
>> that two months ago, but gave up for a while.
> I first started to go this way using dfu_util version 3300 and after
> stumbeling on that post
> i managed to get it to claim interface after calling
> usb_set_configuration, but after the usb_reset it crashes on me, and
> there one thing i dislike, it's to debug under cygwin. And i was not
> willing to modify libusb in a first run (as explained in the post)...
> I'm not sure of my compile options because the configure step of
> dfu_utils blocks on PKG_CHECK_MODULES(USB, libusb >= 0.1.4,, so i
> commented out that part and added LIBS = -lusb in the generated
> src/makefile by hand
> After a little disapointment, i decided to go a radically different
> way .... Python with pyusb which is a wrapper over libusb.
> I managed to recompile pyusb-0.4.1 under both cygwin with python2.5.1
> and stock windows python2.4 from Active state ( i think it compiles
> OOTB under linux).
> I made a few patches to pyusb-0.4.1 to get Device.devnum and
> Interface.iInterface properties under python to ease the port of
> dfu-util code to python.
> I will try to submit them for inclusion in the trunk of pyusb ASAP,
> but can publish them somewhere else in the mean time.
> so right now i have 2 modules, dfu.py that is a python port of dfu.c,
> dfu.h and usb_dfu.h, and dfu_util.py which is a agregation of things i
> first needed from main.c
> i still have work to port sam7dfu.c but it should be manageable...
> Up to now, i can iterate_dfu_devices, claim the interface, get the
> status (dfu_get_status), dfu_detach, reset and see the neo going into
> DFU mode.
> Once it works i will 'objectize' it a little so that it can be used in
> a more friendly way as a cmd line tool.
> Once all is well it should be easy to make a small GUI on top of that,
> it could be neat, and hopefully cross platform too :-)
>>> Is there a place where we can find a .inf file for use of the CDC_ACM
>>> under windows.
>> libusb-win32 ships a neat GUI tool to do that.
> Thanks for the tip, it works and at least the usb device under uboot
> appears now under usbenum in windows using libusb version 0.1.12.1
> Do someone know how to use the serial com with the inf file made by
> I would like to use the same python tool to speak to the device ala cu
> -l /dev/ttyACM0
>> - -jserv
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.6 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>> -----END PGP SIGNATURE-----
More information about the openmoko-uboot