diff --git a/boards/common/blxxxpill/Makefile.include b/boards/common/blxxxpill/Makefile.include index 139555db3f..8c98133068 100644 --- a/boards/common/blxxxpill/Makefile.include +++ b/boards/common/blxxxpill/Makefile.include @@ -5,23 +5,17 @@ ifeq (dfu-util,$(PROGRAMMER)) # For older versions of the DFU bootloader, set DFU_USB_ID to 1d50:6017 DFU_USB_ID ?= 1eaf:0003 DFU_ALT ?= 2 - + DFU_USE_DFUSE = 1 # Leave some space at the beginning of the flash for the bootloader ROM_OFFSET ?= 0x2000 - # If using STM32duino bootloader, this change is necessary. # Bootloader available at # github.com/rogerclarkmelbourne/STM32duino-bootloader/tree/master/binaries ifeq (stm32duino,$(BOOTLOADER)) - FFLAGS_OPTS ?= -R - FFLAGS ?= --device $(DFU_USB_ID) \ - --alt $(DFU_ALT) \ - --download $(FLASHFILE) \ - $(FFLAGS_OPTS) - # Flashing may be easier if using a software USB reset. # Future updates may provide USB support for stm32f1 which benefits # from this software reset. + FFLAGS_OPTS += --reset endif else ifeq (openocd,$(PROGRAMMER)) diff --git a/boards/common/weact-f4x1cx/Makefile.include b/boards/common/weact-f4x1cx/Makefile.include index 5e89e89ab5..ba36e4840f 100644 --- a/boards/common/weact-f4x1cx/Makefile.include +++ b/boards/common/weact-f4x1cx/Makefile.include @@ -4,7 +4,7 @@ INCLUDES += -I$(RIOTBOARD)/common/weact-f4x1cx/include # default to flashing over USB PROGRAMMER ?= dfu-util DFU_USB_ID ?= 0483:df11 -DFU_FLAGS ?= -a 0 -s 0x08000000:leave +DFU_USE_DFUSE = 1 ROM_OFFSET ?= 0x0 # CDC ACM is available faster on STM32 diff --git a/boards/nz32-sc151/Makefile.include b/boards/nz32-sc151/Makefile.include index 292f974106..e482672d5d 100644 --- a/boards/nz32-sc151/Makefile.include +++ b/boards/nz32-sc151/Makefile.include @@ -8,3 +8,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # this board is flashed using DFU PROGRAMMER ?= dfu-util DFU_USB_ID = 0483:df11 +DFU_USE_DFUSE = 1 diff --git a/boards/pyboard/Makefile.include b/boards/pyboard/Makefile.include index 90c65adba6..83b4a93f75 100644 --- a/boards/pyboard/Makefile.include +++ b/boards/pyboard/Makefile.include @@ -8,4 +8,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # this board is flashed using DFU PROGRAMMER ?= dfu-util DFU_USB_ID = 1d50:607f -FFLAGS_OPTS = --reset +DFU_USE_DFUSE = 1 diff --git a/boards/spark-core/Makefile.include b/boards/spark-core/Makefile.include index 2af6c22969..cbce081a8e 100644 --- a/boards/spark-core/Makefile.include +++ b/boards/spark-core/Makefile.include @@ -11,3 +11,4 @@ ROM_OFFSET ?= 0x5000 # this board is flashed using DFU PROGRAMMER ?= dfu-util DFU_USB_ID = 1d50:607f +DFU_USE_DFUSE = 1 diff --git a/makefiles/tools/dfu-util.inc.mk b/makefiles/tools/dfu-util.inc.mk index 85162c9375..6ff3dc05ae 100644 --- a/makefiles/tools/dfu-util.inc.mk +++ b/makefiles/tools/dfu-util.inc.mk @@ -7,12 +7,15 @@ ROM_OFFSET ?= 0 _ROM_ADDR_WITH_OFFSET ?= $(shell printf "0x%x" $$(($(ROM_START_ADDR) + $(ROM_OFFSET)))) FLASH_ADDR ?= $(if $(ROM_OFFSET),$(_ROM_ADDR_WITH_OFFSET),$(ROM_START_ADDR)) - +DFU_USE_DFUSE ?= 0 # Optional flasher flags FFLAGS_OPTS ?= FFLAGS ?= --device $(DFU_USB_ID) \ --alt $(DFU_ALT) \ - --dfuse-address $(FLASH_ADDR):leave \ --download $(FLASHFILE) \ $(FFLAGS_OPTS) + +ifeq ($(DFU_USE_DFUSE),1) + FFLAGS += --dfuse-address $(FLASH_ADDR):leave +endif