more sophisticated ways for updating the atusb firmware

Werner Almesberger werner at almesberger.net
Thu May 12 04:54:20 EDT 2011


Stefan Schmidt wrote:
> Have you considered using the standard DFU method to signal a firmware
> upgrade during normal operation?

I approached DFU from the other end: how can I replace a firmware
(application) that no longer cooperates ? That's how I came up with
running the DFU-capable boot loader for a few seconds before
jumping to the real application.

The reset-to-DFU approach for bringing up DFU is only incidental:
since I already have the "unbrickable" boot loader with DFU, this
is merely a simple way for getting there.

> I know you must have read the spec thats why I wonder why you wrote
> the tools to do these steps outside of DFU.

I didn't write these tools specifically for getting into DFU mode.
atrf-reset's original purpose is to just reset whatever is there,
i.e., the transceiver and/or the MCU. usbwait is intended for
manufacturing use. It just happens to also help with the timing
issue in resetting into the boot loader.

> Any problems you did run
> into? From a dfu-util point of view I want to support such setups and
> therefor would be interested if you did run into problems.

I didn't run into any problems, I just never tried to use/implement
that mode. There may be more atrocities in my DFU implementation. I
just did whatever it takes for dfu-util to be happy with it. So
dfu-util is my de facto DFU standard :-)

If there's anything you think I really ought to fix, particularly in
the boot loader, please let me know.

Ah, and now that you mention it ... there actually is a bug I ran
into ;-) Patch attached.

Thanks,
- Werner

---------------------------------- cut here -----------------------------------

diff --git a/src/main.c b/src/main.c
index e9f4ef3..c9806b3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -380,7 +380,7 @@ static int usb_get_extra_descriptor(usb_dev_handle *udev, unsigned char type,
 	cbuf = malloc(conflen);
 	ret = usb_get_descriptor(udev, USB_DT_CONFIG, index, cbuf, conflen);
 	if (ret < conflen) {
-		fprintf(stderr, "Warning: failed to retrieve complete"
+		fprintf(stderr, "Warning: failed to retrieve complete "
 			"configuration descriptor\n");
 		conflen = ret;
 	}




More information about the discussion mailing list


interactive