From 2b7d0bba428b573c7f9a3291cff6a1dc9da700ff Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 24 Nov 2021 11:15:22 -0500 Subject: stm32: Add option to disable SWD on GigaDevice STM32F103 clones Tested by @FotoFieber. Signed-off-by: Kevin O'Connor --- src/stm32/stm32f1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/stm32/stm32f1.c') diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c index 88500165..77faad72 100644 --- a/src/stm32/stm32f1.c +++ b/src/stm32/stm32f1.c @@ -257,8 +257,13 @@ armcm_main(void) // Disable JTAG to free PA15, PB3, PB4 enable_pclock(AFIO_BASE); - stm32f1_alternative_remap(AFIO_MAPR_SWJ_CFG_Msk, - AFIO_MAPR_SWJ_CFG_JTAGDISABLE); + if (CONFIG_STM32F103GD_DISABLE_SWD) + // GigaDevice clone can't enable PA13/PA14 at runtime - enable here + stm32f1_alternative_remap(AFIO_MAPR_SWJ_CFG_Msk, + AFIO_MAPR_SWJ_CFG_DISABLE); + else + stm32f1_alternative_remap(AFIO_MAPR_SWJ_CFG_Msk, + AFIO_MAPR_SWJ_CFG_JTAGDISABLE); sched_main(); } -- cgit v1.2.3-70-g09d2