Date:2015-05-20 11:56:15 (4 years 5 months ago)
Author:Stefan Schmidt
Commit:3ebd17f9e66469063446ad41442540c22d701a14
Message: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.
Files: atusb/fw/Makefile (4 diffs)

Change Details

atusb/fw/Makefile
2828#OBJDUMP = $(AVR_PREFIX)objdump
2929SIZE = $(AVR_PREFIX)size
3030
31USB_ID = 20b7:1540
31# BCD notion is 0xJJMM with JJ being major and MM being minor. Thus 0x0020 is
32# version 0.2 */
33USB_BCD_VERSION = 0020
34USB_VENDOR_ID = 20b7
35USB_PRODUCT_ID = 1540
36USB_ID = $(USB_VENDOR_ID):$(USB_PRODUCT_ID)
3237
3338OBJS = atusb.o board.o board_app.o sernum.o spi.o descr.o ep0.o \
3439       dfu_common.o usb.o app-atu2.o mac.o
...... 
8085        $(BUILD) $(OBJCOPY) -j .text -j .data -O binary $< $@
8186        @echo "build #`cat .version`, `ls -l $@`"
8287
88%.dfu: %.bin
89        cp $(NAME).bin $(NAME).dfu
90        dfu-suffix -a $(NAME).dfu -d 0x$(USB_BCD_VERSION) \
91          -p 0x$(USB_PRODUCT_ID) -v 0x$(USB_VENDOR_ID)
92
8393%.hex: %.elf
8494        $(BUILD) $(OBJCOPY) -j .text -j .data -O ihex $< $@
8595        @echo "Size: `$(SIZE) -A boot.hex | sed '/Total */s///p;d'` B"
...... 
8797# ----- Cleanup ---------------------------------------------------------------
8898
8999clean:
90        rm -f $(NAME).bin $(NAME).elf
100        rm -f $(NAME).bin $(NAME).elf $(NAME).dfu
91101        rm -f $(OBJS) $(OBJS:.o=.d)
92102        rm -f boot.hex boot.elf
93103        rm -f $(BOOT_OBJS) $(BOOT_OBJS:.o=.d)
...... 
177187        ssh $(HOST) avrdude -F -p $(CHIP) -c nanonote_atusb \
178188          -U flash:r:mcu.bin:r
179189
180dfu: $(NAME).bin
181        dfu-util -d $(USB_ID) -D $(NAME).bin
190dfu: $(NAME).dfu
191        dfu-util -d $(USB_ID) -D $(NAME).dfu
182192
183193update: $(NAME).bin
184194        -atrf-reset -a

Archive Download the corresponding diff file



interactive