1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #11192 from aabadie/pr/tools/dfu

boards: include common dfu logic where applicable
This commit is contained in:
Francisco 2020-03-12 09:05:32 +01:00 committed by GitHub
commit 3153a86551
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 33 deletions

View File

@ -1,11 +1,15 @@
INCLUDES += -I$(RIOTBOARD)/common/blxxxpill/include
# For older versions of the DFU bootloader, set DFU_USB_ID to 1d50:6017 and
# uncomment the DFU_FLAGS line
DFU_USB_ID ?= 1eaf:0003
#DFU_FLAGS ?= -s 0x08002000:leave
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
STLINK_VERSION ?= 2
# Leave some space at the beginning of the flash for the bootloader
ROM_OFFSET ?= 0x2000
else ifeq (openocd,$(PROGRAMMER))
STLINK_VERSION ?= 2
endif
# Setup of programmer and serial is shared between STM32 based boards
include $(RIOTMAKE)/boards/stm32.inc.mk

View File

@ -5,15 +5,9 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# set the default id
ID ?= 0483:df11
FLASHER = dfu-util
DEBUGGER = # dfu-util has no debugger
RESET ?= # dfu-util has no support for resetting the device
FLASHFILE ?= $(BINFILE)
FFLAGS = -d $(ID) -a 0 -s 0x08000000:leave -D $(FLASHFILE)
# this board is flashed using DFU
DFU_USB_ID = 0483:df11
include $(RIOTMAKE)/tools/dfu.inc.mk
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

View File

@ -9,5 +9,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
include $(RIOTMAKE)/tools/serial.inc.mk
# this board is flashed using DFU
DFU_ARGS += --alt 0 -s 0x8000000
DFU_USB_ID = 1d50:607f
FFLAGS_OPTS = --reset
include $(RIOTMAKE)/tools/dfu.inc.mk

View File

@ -3,15 +3,13 @@ PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
include $(RIOTMAKE)/tools/serial.inc.mk
FLASHER = dfu-util
DEBUGGER = # spark core has no debugger
RESET ?= # dfu-util has no support for resetting the device
FLASHFILE ?= $(BINFILE)
FFLAGS = -d 1d50:607f -a 0 -s 0x08005000:leave -D $(FLASHFILE)
# Skip the space needed by the embedded bootloader
ROM_OFFSET ?= 0x5000
# this board is flashed using DFU
DFU_USB_ID = 1d50:607f
include $(RIOTMAKE)/tools/dfu.inc.mk
# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk

View File

@ -46,15 +46,7 @@ ifeq (dfu-util,$(PROGRAMMER))
ifeq (,$(DFU_USB_ID))
$(error DFU_USB_ID is not set)
endif
# Skip the space needed by the embedded bootloader
ROM_OFFSET ?= 0x2000
FLASHER = dfu-util
DEBUGGER = # no debugger
RESET ?= # dfu-util has no support for resetting the device
FLASHFILE ?= $(BINFILE)
DFU_FLAGS ?= -a 2
FFLAGS = -d $(DFU_USB_ID) $(DFU_FLAGS) -D $(FLASHFILE)
include $(RIOTMAKE)/tools/dfu.inc.mk
endif
ifeq (stm32flash,$(PROGRAMMER))

View File

@ -2,7 +2,17 @@ DFU ?= dfu-util
FLASHER ?= $(DFU)
FLASHFILE ?= $(BINFILE)
FFLAGS ?= -D $(FLASHFILE) --reset $(DFU_ARGS)
DFU_ALT ?= 0
ROM_OFFSET ?= 0
RESET ?= $(DFU)
RESET_FLAGS ?= $(DFU_ARGS) -t $(DFU_DEVICE_TYPE)
_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))
# Optional flasher flags
FFLAGS_OPTS ?=
FFLAGS ?= --device $(DFU_USB_ID) \
--alt $(DFU_ALT) \
--dfuse-address $(FLASH_ADDR):leave \
--download $(FLASHFILE) \
$(FFLAGS_OPTS)