From 871107e67f2fbbd9f5debc96784a05f3b45f04d7 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 5 Jun 2020 15:53:04 +0200 Subject: [PATCH] boards/weact-f411ce: enable automatic reset to bootloader --- boards/weact-f411ce/Makefile.dep | 6 ++++++ boards/weact-f411ce/Makefile.include | 4 ++++ boards/weact-f411ce/doc.txt | 24 ++++++++++++++---------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/boards/weact-f411ce/Makefile.dep b/boards/weact-f411ce/Makefile.dep index d06654049c..3d936007a6 100644 --- a/boards/weact-f411ce/Makefile.dep +++ b/boards/weact-f411ce/Makefile.dep @@ -6,6 +6,12 @@ ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) USEMODULE += stdio_cdc_acm endif +ifneq (,$(filter stdio_cdc_acm,$(USEMODULE))) + # The Mask-ROM bootloader provides USB-DFU capability + FEATURES_REQUIRED += bootloader_stm32 + USEMODULE += usb_board_reset +endif + ifneq (,$(filter mtd,$(USEMODULE))) USEMODULE += mtd_spi_nor endif diff --git a/boards/weact-f411ce/Makefile.include b/boards/weact-f411ce/Makefile.include index 6b9cef1eb3..520cd052eb 100644 --- a/boards/weact-f411ce/Makefile.include +++ b/boards/weact-f411ce/Makefile.include @@ -6,5 +6,9 @@ DFU_USB_ID ?= 0483:df11 DFU_FLAGS ?= -a 0 -s 0x08000000:leave ROM_OFFSET ?= 0x0 +# CDC ACM is available faster on STM32 +TERM_DELAY ?= 1 + # Setup of programmer and serial is shared between STM32 based boards include $(RIOTMAKE)/boards/stm32.inc.mk +include $(RIOTMAKE)/tools/usb_board_reset.mk diff --git a/boards/weact-f411ce/doc.txt b/boards/weact-f411ce/doc.txt index eedf7b9002..263fe04a64 100644 --- a/boards/weact-f411ce/doc.txt +++ b/boards/weact-f411ce/doc.txt @@ -36,21 +36,25 @@ It is available on sites like AliExpress for less than 4€. ## Flashing the device The device comes with a bootloader that allows flashing via `dfu-util`. -There are two buttons on the board labeled `BOOT0` and `NRST`. - - - Press and hold down `NRST` to reset the CPU - - Press `BOOT0` while keeping `NRST` held down - - Release `NRST`, afterwards release `BOOT0` - -The board will now show up as `0483:df11` - `STM32 BOOTLOADER` and will accept -firmware using the DFU protocol. - -You can upload your RIOT-firmware by typing +If RIOT is already running on the board, you can upload your RIOT-firmware by typing ``` make BOARD=weact-f411ce flash ``` +RIOT will make sure to enter the bootloader automatically. + +If RIOT crashed or you have the plain board with the stock firmware, you have to enter +the bootloader manually. + +There are two buttons on the board labeled `BOOT0` and `NRST`. + + - Hold down `BOOT0` + - Shortly press `NRST` to reset the CPU while keeping `BOOT0` held down + +The board will now show up as `0483:df11` - `STM32 BOOTLOADER` and will accept +firmware using the DFU protocol. + *Note:* You need to have write permissions to the device. On Linux you could add yourself to the `plugdev` group and store the following as `/etc/udev/rules.d/99-weact-f411ce.rules`: