add reset utility for flashing using DFU
This commit is contained in:
parent
57f3b45f83
commit
7274d7e3df
15
Makefile
15
Makefile
@ -18,7 +18,7 @@
|
||||
# be silent per default, but 'make V=1' will show all compiler calls.
|
||||
ifneq ($(V),1)
|
||||
Q := @
|
||||
NULL := 2> /dev/null
|
||||
NULL := 1> /dev/null 2> /dev/null
|
||||
endif
|
||||
|
||||
# the final binary name (without extension)
|
||||
@ -94,6 +94,9 @@ OOCD ?= openocd
|
||||
OOCD_INTERFACE ?= stlink-v2
|
||||
OOCD_TARGET ?= stm32f1x
|
||||
|
||||
# which USB CDC ACM port is used bu the device, so we can reset it
|
||||
ACMPORT = /dev/ttyACM0
|
||||
|
||||
# board specific USB DFU bootloader
|
||||
BOOTLOADERS = STM32duino-bootloader
|
||||
BOOTLOADER = $(BOOTLOADERS)/STM32F1/binaries/generic_boot20_pa1.bin
|
||||
@ -135,7 +138,6 @@ list: $(BINARY).list
|
||||
$(Q)size $(@)
|
||||
|
||||
%.o: %.c
|
||||
@#printf " CC $(*).c\n"
|
||||
$(Q)$(CC) $(CFLAGS) $(ARCH_FLAGS) -o $(@) -c $(<)
|
||||
|
||||
clean:
|
||||
@ -156,9 +158,14 @@ flash-swd: $(BINARY).hex
|
||||
$(info flashing $(<) using SWD)
|
||||
$(Q)$(OOCD) --file interface/$(OOCD_INTERFACE).cfg --file target/$(OOCD_TARGET).cfg --command "init" --command "reset init" --command "flash write_image erase $(<)" --command "reset" --command "shutdown" $(NULL)
|
||||
|
||||
flash-dfu: $(BINARY).bin
|
||||
# reset device by setting the data width to 5 bis on the USB CDC ACM port
|
||||
reset:
|
||||
$(Q)stty --file /dev/ttyACM0 115200 raw cs5
|
||||
$(Q)sleep 0.5
|
||||
|
||||
flash-dfu: $(BINARY).bin reset
|
||||
$(info flashing $(<) using DFU)
|
||||
$(Q)dfu-util --device 1eaf:0003 --cfg 1 --intf 0 --alt 2 --reset --download $(<)
|
||||
$(Q)dfu-util --device 1eaf:0003 --cfg 1 --intf 0 --alt 2 --reset --download $(<) $(NULL)
|
||||
|
||||
.PHONY: clean elf bin hex srec list bootloader flash flash-swd flash-dfu
|
||||
.SECONDARY:
|
||||
|
Loading…
Reference in New Issue
Block a user