This was starting to seriously bug me and as I had made a fool of myself earlier I spent another hour tracking it down, since I had one working example I want to know what the issue was. (&*)_&^% apple has a old broken version of aclocal in /usr/bin. And my path on the systems that failed had it before the newer version in /opt/local/bin where port installs its wares. With the path changed it works now perfectly. And I feel pretty stupid, but it is resolved.
You probably figured it out, but just to clear this up: The upload command generates a raw memory dump from the device, which probably got written over your original dfu file. BTW, the latest git version should refuse to overwrite an existing file, but I am not sure what you have. So if you tried later to download this file it would have no dfu or dfuse header information and you will see a “signature” error.
When you specify an address for downloading, you force it into “raw” download mode instead of dfuse file mode. So if you in this case use a dfu file, the dfu/dfuse header information in the file will be copied over as well, which will break. The “real” firmware code will be shifted and all addresses will be wrong.
For future versions, I think dfu-util should be able to detect whether it is talking to a dfuse device, and then switch automatically to dfuse communication mode and expect a dfuse file (unless an advanced user wants to download a raw binary file to it). So –dfuse default will not be needed, and –dfuse address might be renamed to avoid confusion.
PS. I can tell you that you are not the first one to get confused by upload/download on microcontrollers
Yeah I had figured out that part, but I am still losing.
delete all copies of 3.32 redownload the commands seem to work after several tries.
Unfortunately Lib splash screen shows up with mangled App version, and runtime is a grayed line on the right with 3 tiny yellow dots, and one larger yellow blotch on the 2 chat position from the bottom. no graphing no characters, no lines. other than the grid lines. Also about the same height from the bottom is a grayed line the size of a text line that goes from left to almost the right. I have reloaded both several times and see the same result.
dfu-util does currently only support DFU version 1.0
Opening USB Device 0x0483:0xdf11…
Claiming USB DFU Runtime Interface…
Determining device status: state = dfuDNLOAD-IDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Found Runtime: [0x0483:0xdf11] devnum=4, cfg=0, intf=0, alt=0, name="@Internal Flash /0x08000000/12001Ka,116001Kg"
Claiming USB DFU Interface…
Setting Alternate Setting #0 …
Determining device status: state = dfuDNLOAD-IDLE, status = 0
aborting previous incomplete transfer
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
file contains 1 DFU images
parsing DFU image 1
image for alternate setting 0, (2 elements, total size = 28363)
parsing element 1, address = 0x0800c000, size = 25850
Erasing page at address 0x0800c000, 1k page starting at 0x0800c000
Setting address pointer to 0x0800c000
Wrote 1024 bytes at 0x0800c000
Erasing page at address 0x0800c400, 1k page starting at 0x0800c400
Setting address pointer to 0x0800c400
Wrote 1024 bytes at 0x0800c400
Erasing page at address 0x0800c800, 1k page starting at 0x0800c800
Setting address pointer to 0x0800c800
Wrote 1024 bytes at 0x0800c800
Erasing page at address 0x0800cc00, 1k page starting at 0x0800cc00
Setting address pointer to 0x0800cc00
Wrote 1024 bytes at 0x0800cc00
Erasing page at address 0x0800d000, 1k page starting at 0x0800d000
Setting address pointer to 0x0800d000
Wrote 1024 bytes at 0x0800d000
Erasing page at address 0x0800d400, 1k page starting at 0x0800d400
Setting address pointer to 0x0800d400
Wrote 1024 bytes at 0x0800d400
Erasing page at address 0x0800d800, 1k page starting at 0x0800d800
Setting address pointer to 0x0800d800
Wrote 1024 bytes at 0x0800d800
Erasing page at address 0x0800dc00, 1k page starting at 0x0800dc00
Setting address pointer to 0x0800dc00
Wrote 1024 bytes at 0x0800dc00
Erasing page at address 0x0800e000, 1k page starting at 0x0800e000
Setting address pointer to 0x0800e000
Wrote 1024 bytes at 0x0800e000
Erasing page at address 0x0800e400, 1k page starting at 0x0800e400
Setting address pointer to 0x0800e400
Wrote 1024 bytes at 0x0800e400
Erasing page at address 0x0800e800, 1k page starting at 0x0800e800
Setting address pointer to 0x0800e800
Wrote 1024 bytes at 0x0800e800
Erasing page at address 0x0800ec00, 1k page starting at 0x0800ec00
Setting address pointer to 0x0800ec00
Wrote 1024 bytes at 0x0800ec00
Erasing page at address 0x0800f000, 1k page starting at 0x0800f000
Setting address pointer to 0x0800f000
Wrote 1024 bytes at 0x0800f000
Erasing page at address 0x0800f400, 1k page starting at 0x0800f400
Setting address pointer to 0x0800f400
Wrote 1024 bytes at 0x0800f400
Erasing page at address 0x0800f800, 1k page starting at 0x0800f800
Setting address pointer to 0x0800f800
Wrote 1024 bytes at 0x0800f800
Erasing page at address 0x0800fc00, 1k page starting at 0x0800fc00
Setting address pointer to 0x0800fc00
Wrote 1024 bytes at 0x0800fc00
Erasing page at address 0x08010000, 1k page starting at 0x08010000
Setting address pointer to 0x08010000
Wrote 1024 bytes at 0x08010000
Erasing page at address 0x08010400, 1k page starting at 0x08010400
Setting address pointer to 0x08010400
Wrote 1024 bytes at 0x08010400
Erasing page at address 0x08010800, 1k page starting at 0x08010800
Setting address pointer to 0x08010800
Wrote 1024 bytes at 0x08010800
Erasing page at address 0x08010c00, 1k page starting at 0x08010c00
Setting address pointer to 0x08010c00
Wrote 1024 bytes at 0x08010c00
Erasing page at address 0x08011000, 1k page starting at 0x08011000
Setting address pointer to 0x08011000
Wrote 1024 bytes at 0x08011000
Erasing page at address 0x08011400, 1k page starting at 0x08011400
Setting address pointer to 0x08011400
Wrote 1024 bytes at 0x08011400
Erasing page at address 0x08011800, 1k page starting at 0x08011800
Setting address pointer to 0x08011800
Wrote 1024 bytes at 0x08011800
Erasing page at address 0x08011c00, 1k page starting at 0x08011c00
Setting address pointer to 0x08011c00
Wrote 1024 bytes at 0x08011c00
Erasing page at address 0x08012000, 1k page starting at 0x08012000
Setting address pointer to 0x08012000
Wrote 1024 bytes at 0x08012000
Erasing page at address 0x08012400, 1k page starting at 0x08012400
Setting address pointer to 0x08012400
Wrote 250 bytes at 0x08012400
parsing element 2, address = 0x080124fc, size = 2497
Setting address pointer to 0x080124fc
Wrote 1024 bytes at 0x080124fc
Erasing page at address 0x080128fc, 1k page starting at 0x08012800
Setting address pointer to 0x080128fc
Wrote 1024 bytes at 0x080128fc
Erasing page at address 0x08012cfc, 1k page starting at 0x08012c00
Setting address pointer to 0x08012cfc
Wrote 449 bytes at 0x08012cfc
DSO%20BenF%20Firmware%20v3 rich$
dfu-util does currently only support DFU version 1.0
Opening USB Device 0x0483:0xdf11…
Claiming USB DFU Runtime Interface…
Determining device status: state = dfuIDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Found Runtime: [0x0483:0xdf11] devnum=4, cfg=0, intf=0, alt=0, name="@Internal Flash /0x08000000/12001Ka,116001Kg"
Claiming USB DFU Interface…
Setting Alternate Setting #0 …
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
file contains 1 DFU images
parsing DFU image 1
image for alternate setting 0, (1 elements, total size = 13740)
parsing element 1, address = 0x08004000, size = 13732
Erasing page at address 0x08004000, 1k page starting at 0x08004000
Setting address pointer to 0x08004000
Wrote 1024 bytes at 0x08004000
Erasing page at address 0x08004400, 1k page starting at 0x08004400
Setting address pointer to 0x08004400
Wrote 1024 bytes at 0x08004400
Erasing page at address 0x08004800, 1k page starting at 0x08004800
Setting address pointer to 0x08004800
Wrote 1024 bytes at 0x08004800
Erasing page at address 0x08004c00, 1k page starting at 0x08004c00
Setting address pointer to 0x08004c00
Wrote 1024 bytes at 0x08004c00
Erasing page at address 0x08005000, 1k page starting at 0x08005000
Setting address pointer to 0x08005000
Wrote 1024 bytes at 0x08005000
Erasing page at address 0x08005400, 1k page starting at 0x08005400
Setting address pointer to 0x08005400
Wrote 1024 bytes at 0x08005400
Erasing page at address 0x08005800, 1k page starting at 0x08005800
Setting address pointer to 0x08005800
Wrote 1024 bytes at 0x08005800
Erasing page at address 0x08005c00, 1k page starting at 0x08005c00
Setting address pointer to 0x08005c00
Wrote 1024 bytes at 0x08005c00
Erasing page at address 0x08006000, 1k page starting at 0x08006000
Setting address pointer to 0x08006000
Wrote 1024 bytes at 0x08006000
Erasing page at address 0x08006400, 1k page starting at 0x08006400
Setting address pointer to 0x08006400
Wrote 1024 bytes at 0x08006400
Erasing page at address 0x08006800, 1k page starting at 0x08006800
Setting address pointer to 0x08006800
Wrote 1024 bytes at 0x08006800
Erasing page at address 0x08006c00, 1k page starting at 0x08006c00
Setting address pointer to 0x08006c00
Wrote 1024 bytes at 0x08006c00
Erasing page at address 0x08007000, 1k page starting at 0x08007000
Setting address pointer to 0x08007000
Wrote 1024 bytes at 0x08007000
Erasing page at address 0x08007400, 1k page starting at 0x08007400
Setting address pointer to 0x08007400
Wrote 420 bytes at 0x08007400
DSO%20BenF%20Firmware%20v3 rich$
This has now happened, and I have updated garden.seeedstudio.com/index.php?title=Dfu-util with the new syntax. As you can see there, the new code uses libusb 1.0. It would be nice if someone on Mac OS X can confirm that the build instructions are correct.
BTW, this code will soon go into the official dfu-tool version 0.5, so that it will be available through normal distributions.
dfu-util does currently only support DFU version 1.0
Opening DFU USB device… ID 0483:df11
Claiming USB DFU Runtime Interface…
Determining device status: state = dfuIDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Found Runtime: [0x0483:0xdf11] devnum=4, cfg=0, intf=0, alt=0, name="@Internal Flash /0x08000000/12001Ka,116001Kg"
Claiming USB DFU Interface…
Setting Alternate Setting #0 …
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Device returned transfer size 1024
bytes_per_hash=705
Copying data from PC to DFU device
Starting download: [##################################################] finished!
state(7) = dfuMANIFEST, status(0) = No error condition is present
unable to read DFU status[/code]
No, this must be wrong. The new code uses libusb-1.0 and can not use the old API and the libusb-compat library from macports is not needed. Please make sure you check out the dfuse-libusb-1.0 branch and that it is up to date.
$ ./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 whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for USB... yes
checking for usb_path2devnum in -lusbpath... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking usbpath.h usability... no
checking usbpath.h presence... no
checking for usbpath.h... no
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for working memcmp... yes
checking for memset... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing depfiles commands
$ make
make all-recursive
Making all in src
CC main.o
CC dfu_load.o
CC dfuse.o
CC dfuse_mem.o
dfuse_mem.c:22:20: error: malloc.h: No such file or directory
dfuse_mem.c: In function ‘add_segment’:
dfuse_mem.c:33: warning: implicit declaration of function ‘malloc’
dfuse_mem.c:33: warning: incompatible implicit declaration of built-in function ‘malloc’
dfuse_mem.c: In function ‘free_segment_list’:
dfuse_mem.c:72: warning: implicit declaration of function ‘free’
dfuse_mem.c: In function ‘parse_memory_layout’:
dfuse_mem.c:95: warning: unknown conversion type character ‘m’ in format
dfuse_mem.c:95: warning: format ‘%n’ expects type ‘int *’, but argument 3 has type ‘char **’
dfuse_mem.c:95: warning: too many arguments for format
dfuse_mem.c:95: warning: unknown conversion type character ‘m’ in format
dfuse_mem.c:95: warning: format ‘%n’ expects type ‘int *’, but argument 3 has type ‘char **’
dfuse_mem.c:95: warning: too many arguments for format
dfuse_mem.c:111: warning: unknown conversion type character ‘m’ in format
dfuse_mem.c:111: warning: format ‘%n’ expects type ‘int *’, but argument 6 has type ‘char **’
dfuse_mem.c:111: warning: too many arguments for format
dfuse_mem.c:111: warning: unknown conversion type character ‘m’ in format
dfuse_mem.c:111: warning: format ‘%n’ expects type ‘int *’, but argument 6 has type ‘char **’
dfuse_mem.c:111: warning: too many arguments for format
make[2]: *** [dfuse_mem.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
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.
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
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?
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$ 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.
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).
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.)