From: Stefan Schmidt <stefan@datenfreihafen.org>
To: Stefan Schmidt <stefan@osg.samsung.com>,
Werner Almesberger <werner@almesberger.net>
Cc: linux-wpan@vger.kernel.org, alex.aring@gmail.com
Subject: Re: [PATCH atubs-fw 3/4] atusb/fw: Add build system support for adding a DFU suffix to the fw file
Date: Thu, 21 May 2015 10:19:30 +0200 [thread overview]
Message-ID: <555D9512.8030404@datenfreihafen.org> (raw)
In-Reply-To: <555CB8B0.7060203@osg.samsung.com>
[-- Attachment #1: Type: text/plain, Size: 800 bytes --]
Hello.
On 20/05/15 18:39, Stefan Schmidt wrote:
> Hello.
>
> On 20/05/15 18:31, Werner Almesberger wrote:
>> Stefan Schmidt wrote:
>>> DFU files need to have a valid DFU suffix which provides information
>>> about the USB vendor and product ID
>> Aah, more bureaucracy ! :)
>>
> Yup. :)
>
> Good one is this case though. The suffix add a little crc protection
> and having the ID to make sure we flash it to the right device also
> sounds good to me :)
>
>>> + dfu-suffix -a $(NAME).dfu -d 0x$(USB_BCD_VERSION) -p
>>> 0x$(USB_PRODUCT_ID) -v 0x$(USB_VENDOR_ID)
>> Would be nice to keep wc -L <= 80, though.
>
> ok, will change this tomorrow and resend. Going afk now.
>
Please find the updated patch attached. If you prefer me to resend the
whole series let me know.
regards
Stefan Schmidt
[-- Attachment #2: 0003-atusb-fw-Add-build-system-support-for-adding-a-DFU-s.patch --]
[-- Type: text/x-patch, Size: 2401 bytes --]
From f910b79aa194f9e0115bea859ede9133421ecb52 Mon Sep 17 00:00:00 2001
From: Stefan Schmidt <stefan@datenfreihafen.org>
Date: Wed, 20 May 2015 11:56:15 +0200
Subject: [PATCH atusb-fw 3/4] atusb/fw: Add build system support for adding a
DFU suffix to the fw file
DFU files need to have a valid DFU suffix which provides information about the
USB vendor and product ID it should be used for as well as same basic CRC file
integrity checking. The dfu-suffix tool can add this and got added to dfu-utils
in 0.7.
With the Makefile changes we take the original atusb-bin file, make a copy and
add the DFU suffix it before flashing.
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
---
atusb/fw/Makefile | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/atusb/fw/Makefile b/atusb/fw/Makefile
index 653cc56..086994a 100644
--- a/atusb/fw/Makefile
+++ b/atusb/fw/Makefile
@@ -28,7 +28,12 @@ OBJCOPY = $(AVR_PREFIX)objcopy
#OBJDUMP = $(AVR_PREFIX)objdump
SIZE = $(AVR_PREFIX)size
-USB_ID = 20b7:1540
+# BCD notion is 0xJJMM with JJ being major and MM being minor. Thus 0x0020 is
+# version 0.2 */
+USB_BCD_VERSION = 0020
+USB_VENDOR_ID = 20b7
+USB_PRODUCT_ID = 1540
+USB_ID = $(USB_VENDOR_ID):$(USB_PRODUCT_ID)
OBJS = atusb.o board.o board_app.o sernum.o spi.o descr.o ep0.o \
dfu_common.o usb.o app-atu2.o mac.o
@@ -80,6 +85,11 @@ boot.elf: $(BOOT_OBJS)
$(BUILD) $(OBJCOPY) -j .text -j .data -O binary $< $@
@echo "build #`cat .version`, `ls -l $@`"
+%.dfu: %.bin
+ cp $(NAME).bin $(NAME).dfu
+ dfu-suffix -a $(NAME).dfu -d 0x$(USB_BCD_VERSION) -p 0x$(USB_PRODUCT_ID) \
+ -v 0x$(USB_VENDOR_ID)
+
%.hex: %.elf
$(BUILD) $(OBJCOPY) -j .text -j .data -O ihex $< $@
@echo "Size: `$(SIZE) -A boot.hex | sed '/Total */s///p;d'` B"
@@ -87,7 +97,7 @@ boot.elf: $(BOOT_OBJS)
# ----- Cleanup ---------------------------------------------------------------
clean:
- rm -f $(NAME).bin $(NAME).elf
+ rm -f $(NAME).bin $(NAME).elf $(NAME).dfu
rm -f $(OBJS) $(OBJS:.o=.d)
rm -f boot.hex boot.elf
rm -f $(BOOT_OBJS) $(BOOT_OBJS:.o=.d)
@@ -177,8 +187,8 @@ prog-read:
ssh $(HOST) avrdude -F -p $(CHIP) -c nanonote_atusb \
-U flash:r:mcu.bin:r
-dfu: $(NAME).bin
- dfu-util -d $(USB_ID) -D $(NAME).bin
+dfu: $(NAME).dfu
+ dfu-util -d $(USB_ID) -D $(NAME).dfu
update: $(NAME).bin
-atrf-reset -a
--
2.1.0
next prev parent reply other threads:[~2015-05-21 8:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 13:18 [PATCH atubs-fw 0/4] ATUSB firmware changes towards a 0.2 release Stefan Schmidt
2015-05-20 13:18 ` [PATCH atubs-fw 1/4] Revert "atusb/fw/usb/: enable MCU reset on USB bus reset after config selection" Stefan Schmidt
2015-05-20 15:33 ` Alexander Aring
2015-05-20 16:37 ` Stefan Schmidt
2015-05-20 13:18 ` [PATCH atubs-fw 2/4] atusb/fw: Use RX_AACK_ON instead of RX_ON in the firmware Stefan Schmidt
2015-05-20 13:18 ` [PATCH atubs-fw 3/4] atusb/fw: Add build system support for adding a DFU suffix to the fw file Stefan Schmidt
2015-05-20 16:31 ` Werner Almesberger
2015-05-20 16:39 ` Stefan Schmidt
2015-05-21 8:19 ` Stefan Schmidt [this message]
2015-05-20 13:18 ` [PATCH atubs-fw 4/4] atusb/fw: Bump minor version to mark first public release Stefan Schmidt
2015-05-20 13:21 ` [PATCH atubs-fw 0/4] ATUSB firmware changes towards a 0.2 release Stefan Schmidt
2015-05-21 14:40 ` Stefan Schmidt
2015-05-21 15:39 ` Alexander Aring
2015-05-21 16:39 ` Stefan Schmidt
2015-05-21 20:45 ` Alexander Aring
2015-05-21 21:01 ` Alexander Aring
2015-05-22 7:58 ` Stefan Schmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=555D9512.8030404@datenfreihafen.org \
--to=stefan@datenfreihafen.org \
--cc=alex.aring@gmail.com \
--cc=linux-wpan@vger.kernel.org \
--cc=stefan@osg.samsung.com \
--cc=werner@almesberger.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.