Merge pull request #15555 from dylad/pr/makefiles/dfu_optionnal_dfuse

boards: move DfuSe specific argument at board level
This commit is contained in:
Alexandre Abadie 2020-12-09 14:08:50 +01:00 committed by GitHub
commit b801d57f0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 12 deletions

View File

@ -5,23 +5,17 @@ ifeq (dfu-util,$(PROGRAMMER))
# For older versions of the DFU bootloader, set DFU_USB_ID to 1d50:6017 # For older versions of the DFU bootloader, set DFU_USB_ID to 1d50:6017
DFU_USB_ID ?= 1eaf:0003 DFU_USB_ID ?= 1eaf:0003
DFU_ALT ?= 2 DFU_ALT ?= 2
DFU_USE_DFUSE = 1
# Leave some space at the beginning of the flash for the bootloader # Leave some space at the beginning of the flash for the bootloader
ROM_OFFSET ?= 0x2000 ROM_OFFSET ?= 0x2000
# If using STM32duino bootloader, this change is necessary. # If using STM32duino bootloader, this change is necessary.
# Bootloader available at # Bootloader available at
# github.com/rogerclarkmelbourne/STM32duino-bootloader/tree/master/binaries # github.com/rogerclarkmelbourne/STM32duino-bootloader/tree/master/binaries
ifeq (stm32duino,$(BOOTLOADER)) 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. # Flashing may be easier if using a software USB reset.
# Future updates may provide USB support for stm32f1 which benefits # Future updates may provide USB support for stm32f1 which benefits
# from this software reset. # from this software reset.
FFLAGS_OPTS += --reset
endif endif
else ifeq (openocd,$(PROGRAMMER)) else ifeq (openocd,$(PROGRAMMER))

View File

@ -4,7 +4,7 @@ INCLUDES += -I$(RIOTBOARD)/common/weact-f4x1cx/include
# default to flashing over USB # default to flashing over USB
PROGRAMMER ?= dfu-util PROGRAMMER ?= dfu-util
DFU_USB_ID ?= 0483:df11 DFU_USB_ID ?= 0483:df11
DFU_FLAGS ?= -a 0 -s 0x08000000:leave DFU_USE_DFUSE = 1
ROM_OFFSET ?= 0x0 ROM_OFFSET ?= 0x0
# CDC ACM is available faster on STM32 # CDC ACM is available faster on STM32

View File

@ -8,3 +8,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# this board is flashed using DFU # this board is flashed using DFU
PROGRAMMER ?= dfu-util PROGRAMMER ?= dfu-util
DFU_USB_ID = 0483:df11 DFU_USB_ID = 0483:df11
DFU_USE_DFUSE = 1

View File

@ -8,4 +8,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# this board is flashed using DFU # this board is flashed using DFU
PROGRAMMER ?= dfu-util PROGRAMMER ?= dfu-util
DFU_USB_ID = 1d50:607f DFU_USB_ID = 1d50:607f
FFLAGS_OPTS = --reset DFU_USE_DFUSE = 1

View File

@ -11,3 +11,4 @@ ROM_OFFSET ?= 0x5000
# this board is flashed using DFU # this board is flashed using DFU
PROGRAMMER ?= dfu-util PROGRAMMER ?= dfu-util
DFU_USB_ID = 1d50:607f DFU_USB_ID = 1d50:607f
DFU_USE_DFUSE = 1

View File

@ -7,12 +7,15 @@ ROM_OFFSET ?= 0
_ROM_ADDR_WITH_OFFSET ?= $(shell printf "0x%x" $$(($(ROM_START_ADDR) + $(ROM_OFFSET)))) _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)) FLASH_ADDR ?= $(if $(ROM_OFFSET),$(_ROM_ADDR_WITH_OFFSET),$(ROM_START_ADDR))
DFU_USE_DFUSE ?= 0
# Optional flasher flags # Optional flasher flags
FFLAGS_OPTS ?= FFLAGS_OPTS ?=
FFLAGS ?= --device $(DFU_USB_ID) \ FFLAGS ?= --device $(DFU_USB_ID) \
--alt $(DFU_ALT) \ --alt $(DFU_ALT) \
--dfuse-address $(FLASH_ADDR):leave \
--download $(FLASHFILE) \ --download $(FLASHFILE) \
$(FFLAGS_OPTS) $(FFLAGS_OPTS)
ifeq ($(DFU_USE_DFUSE),1)
FFLAGS += --dfuse-address $(FLASH_ADDR):leave
endif