Instructions how to build dfu-util on OS X

Fixing the malloc issue was easy, just change the included headers to:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include “dfuse_mem.h”

But the sscanf issue is harder to solve since it doesn’t support m as a conversion specifier.

So you replaced malloc.h by stdlib.h. I will fix that, it is probably the correct way on Linux as well.
EDIT: And the delimiters of course, fixed, thanks.

Can you try using the “a” modifier where I had used the “m” modifier?

Thanks a lot for investigating these issues!

PS: According to the scanf man page, “a” and “m” are GNU C library extensions, but “m” should be included in POSIX.1. But until Mac OS X catches up with POSIX.1 we might have to allocate a buffer ourselves.

Huh, a means floating point. I think it is best to change this to a strchr call and then a manual malloc.

“a[” is different from “a” :slight_smile: Anyway, I have changed it to simple “[” and manual allocation. Please find the fix in git.

Sorry, forgot to post that it works just hunky-dory!

dfu-util 0.4

(C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
(C) 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY

dfu-util does currently only support DFU version 1.0

Opening DFU USB device... ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Runtime Interface...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Opening USB Device...
Found Runtime: [0483:df11] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash  /0x08000000/12*001Ka,116*001Kg"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 1024
Dfu suffix version 11a
Warning: File product ID 0000 does not match device df11
DfuSe interface name: "Internal Flash  "
file contains 1 DFU images
parsing DFU image 1
image for alternate setting 0, (2 elements, total size = 34967)
parsing element 1, address = 0x0800c000, size = 32330
parsing element 2, address = 0x08013e4c, size = 2621
done parsing DfuSe file

Greetings,

Trying to install BenF from OSX, followed the instructions from the first post on this page. Worked fine through:

./autogen.sh
./configure --libdir=/opt/local/lib --includedir=/opt/local/include
make

When I tried to make, I got:
make: *** No targets specified and no makefile found. Stop.

Here’s a listing of the directory:

Base:dfuse-dfu-util martin$ ls
COPYING TODO configure.ac
ChangeLog aclocal.m4 doc
DEVICES.txt autogen.sh m4
Makefile.am autom4te.cache src
Makefile.in config.h.in www
README config.log
SPEC-differences.txt configure

I loaded the apple XCode package and the command line toolkits before installing macports.

I’m not a total unix/linux newbie, but by no means a veteran. Any help appreciated. Or would it just be easier to find someone with a PC and use their machine for the firmware upgrade?

Regards,
Martin

Try the instructions here:
seeedstudio.com/wiki/index.p … e=Dfu-util
Verified working just now.

This thread is obsolete now that the code changes have ben upstreamed.

Tomwid,

I tried the instructions there, followed them as close to the letter as I could. One small issue, on the:

sudo port install libusb-devel
I got a message saying “Please do not install this port as it has been replaced by libusb.”

So I installed the libusb port (as well as git-core), and everything seemed to go fine until the make command. Here’s the last part of my output:
(whitespace added after paste here for ease of reading.)

Base:dfu-util martin$ ./configure --libdir=/opt/local/lib --includedir=/opt/local/include
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… m4/install-sh -c -d
checking for gawk… no
checking for mawk… no
checking for nawk… no
checking for awk… awk
checking whether make sets $(MAKE)… yes
checking whether to enable maintainer-specific portions of Makefiles… no
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking for style of include used by make… GNU
checking dependency style of gcc… gcc3
./configure: line 3332: syntax error near unexpected token USB,' ./configure: line 3332: PKG_CHECK_MODULES(USB, libusb-1.0 >= 1.0.0,’

Base:dfu-util martin$ ls -1
COPYING
ChangeLog
DEVICES.txt
Makefile.am
Makefile.in
README
SPEC-differences.txt
TODO
aclocal.m4
autogen.sh
autom4te.cache
config.h.in
config.log
configure
configure.ac
device-logs
doc
m4
src
www

Base:dfu-util martin$ make
make: *** No targets specified and no makefile found. Stop.
Base:dfu-util martin$

I don’t know how to proceed - my suspicion is that it’s some small fiddly bit I need to set/unset properly, but I don’t know where to start looking. Perhaps one of you local experts can either tell me what’s up, or ask me for output/directories/etc., to figure out what the problem is.

Regards,
Martin

Are you using the latest code from cgit.openezx.org/dfu-util/ ? The last commit is a fix for libusb detection on Mac OS X. It was obviously not needed some time ago, I am not sure what has changed. If it breaks for you /with/ this change, try without (use the 0.6 source instead).

Tormod,

Not sure how to answer that question. I followed the instructions at <http://www.seeedstudio.com/wiki/index.p … e=Dfu-util>, including the line:

git clone git://git.openezx.org/dfu-util

I assume this would call up the latest version. How would I modify the git command to get the 0.6 source? The only differences from the seedstudio wiki were that libusb-devel seems to have been replaced by libusb. Don’t know if this would break anything.

I’m gonna try this all on my laptop instead of my older desktop machine. Perhaps that will help. If not, perhaps we should take this discussion to e-mail (unless you all think having it here might help someone else down the line.)

Regards,
Martin

In your existing git repository, run “git checkout v0.6”. To get back to latest git again, run “git checkout master”.

Please report back here. You are most probably not the only one who will experience this issue :slight_smile: