Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions boards/common/blxxxpill/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ ifeq (dfu-util,$(PROGRAMMER))

# 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.
endif

else ifeq (openocd,$(PROGRAMMER))
STLINK_VERSION ?= 2
endif
Expand Down
13 changes: 12 additions & 1 deletion boards/common/blxxxpill/dist/openocd-128kib.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ set STOP_WATCHDOG 1
# STlink Debug clock frequency
set CLOCK_FREQ 4000

# Some revisions of the Bluepills use a CS32F103C8T6 rather than the STM32Fx
# MCU, which has a different CPUTAPID than the official STM32F103C8T6. As of
# 2020-04-09, no upstream support in OpenOCD has been merged. You can uncomment
# the following line as a workaround until your OpenOCD supports this option:
#set CPUTAPID 0x2ba01477

# Set the default reset option in cases where "SRST=none" is not used for make
if { ![info exists SRST_OPT] } {
set SRST_OPT srst_only
}

# use hardware reset, connect under reset
# connect_assert_srst needed if low power mode application running (WFI...)
reset_config srst_only srst_nogate connect_assert_srst
reset_config $SRST_OPT srst_nogate connect_assert_srst
set CONNECT_UNDER_RESET 1

# brutally overwriting detected flash size with 128KiB (OpenOCD > 0.10.0)
Expand Down
13 changes: 12 additions & 1 deletion boards/common/blxxxpill/dist/openocd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ set STOP_WATCHDOG 1
# STlink Debug clock frequency
set CLOCK_FREQ 4000

# Some revisions of the Bluepills use a CS32F103C8T6 rather than the STM32Fx
# MCU, which has a different CPUTAPID than the official STM32F103C8T6. As of
# 2020-04-09, no upstream support in OpenOCD has been merged. You can uncomment
# the following line as a workaround until your OpenOCD supports this option:
#set CPUTAPID 0x2ba01477

# Set the default reset option in cases where "SRST=none" is not used for make
if { ![info exists SRST_OPT] } {
set SRST_OPT srst_only
}

# use hardware reset, connect under reset
# connect_assert_srst needed if low power mode application running (WFI...)
reset_config srst_only srst_nogate connect_assert_srst
reset_config $SRST_OPT srst_nogate connect_assert_srst
set CONNECT_UNDER_RESET 1

source [find target/stm32f1x.cfg]
Expand Down
10 changes: 10 additions & 0 deletions makefiles/tools/openocd-adapters/stlink.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ ifneq (,$(DEBUG_ADAPTER_ID))
OPENOCD_ADAPTER_INIT += -c 'hla_serial $(DEBUG_ADAPTER_ID)'
endif


# Some stlink clones cannot signal reset properly,
# In this case, use SRST=none
ifneq (,$(SRST))
#Change the adapter init to it
# Use STLINK_VERSION to select which stlink version is used
OPENOCD_ADAPTER_INIT += \
-c 'set SRST_OPT $(SRST)'
endif

# if no openocd specific configuration file, check for default locations:
# 1. Using the default dist/openocd.cfg (automatically set by openocd.sh)
# 2. Using the common cpu specific config file
Expand Down