From af76da96a3a68946a46ee6927f6b4570de00d1ac Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 18 Dec 2025 14:59:36 +1100 Subject: [PATCH] stm32: Default to --connect-under-reset if flashing via deploy-stlink. (Can be overridden by setting STFLASH variable.) Generalises the change from 6b13e6c4987c6fd103847e7b36a3f0fcd0ff42d9 to all stm32 boards. As we're resetting the target to flash it anyway, it shouldn't hurt to put the target into reset before trying to connect. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton --- ports/stm32/Makefile | 2 +- ports/stm32/boards/NUCLEO_H723ZG/mpconfigboard.mk | 1 - ports/stm32/boards/NUCLEO_H743ZI/mpconfigboard.mk | 1 - ports/stm32/mboot/Makefile | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index b43f284b1a..c0bf4be32e 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -72,7 +72,7 @@ PYDFU ?= $(TOP)/tools/pydfu.py DFU_UTIL ?= dfu-util BOOTLOADER_DFU_USB_VID ?= 0x0483 BOOTLOADER_DFU_USB_PID ?= 0xDF11 -STFLASH ?= st-flash +STFLASH ?= st-flash --connect-under-reset OPENOCD ?= openocd OPENOCD_CONFIG ?= boards/openocd_stm32f4.cfg diff --git a/ports/stm32/boards/NUCLEO_H723ZG/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_H723ZG/mpconfigboard.mk index 56f30c42bd..fcb235c868 100644 --- a/ports/stm32/boards/NUCLEO_H723ZG/mpconfigboard.mk +++ b/ports/stm32/boards/NUCLEO_H723ZG/mpconfigboard.mk @@ -26,5 +26,4 @@ MICROPY_HW_ENABLE_ISR_UART_FLASH_FUNCS_IN_RAM = 1 FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py # Flash tool configuration -STFLASH = st-flash --connect-under-reset OPENOCD_CONFIG = boards/openocd_stm32h7_dual_bank.cfg diff --git a/ports/stm32/boards/NUCLEO_H743ZI/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_H743ZI/mpconfigboard.mk index da991c5879..0f528939c9 100644 --- a/ports/stm32/boards/NUCLEO_H743ZI/mpconfigboard.mk +++ b/ports/stm32/boards/NUCLEO_H743ZI/mpconfigboard.mk @@ -26,5 +26,4 @@ MICROPY_HW_ENABLE_ISR_UART_FLASH_FUNCS_IN_RAM = 1 FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py # Flash tool configuration -STFLASH = st-flash --connect-under-reset OPENOCD_CONFIG = boards/openocd_stm32h7_dual_bank.cfg diff --git a/ports/stm32/mboot/Makefile b/ports/stm32/mboot/Makefile index 7226dd353f..c049017734 100755 --- a/ports/stm32/mboot/Makefile +++ b/ports/stm32/mboot/Makefile @@ -54,7 +54,7 @@ DFU=$(TOP)/tools/dfu.py PYDFU ?= $(TOP)/tools/pydfu.py BOOTLOADER_DFU_USB_VID ?= 0x0483 BOOTLOADER_DFU_USB_PID ?= 0xDF11 -STFLASH ?= st-flash +STFLASH ?= st-flash --connect-under-reset OPENOCD ?= openocd OPENOCD_CONFIG ?= boards/openocd_stm32f4.cfg