aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/stm32f1.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-11-24 11:15:22 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-11-25 10:15:58 -0500
commit2b7d0bba428b573c7f9a3291cff6a1dc9da700ff (patch)
treeeb6c61a38021a3697ac8d3f51322f55abee64ad0 /src/stm32/stm32f1.c
parent790d48b46c40eae63e96ce3dc7975e5a37290931 (diff)
downloadkutter-2b7d0bba428b573c7f9a3291cff6a1dc9da700ff.tar.gz
kutter-2b7d0bba428b573c7f9a3291cff6a1dc9da700ff.tar.xz
kutter-2b7d0bba428b573c7f9a3291cff6a1dc9da700ff.zip
stm32: Add option to disable SWD on GigaDevice STM32F103 clones
Tested by @FotoFieber. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/stm32f1.c')
-rw-r--r--src/stm32/stm32f1.c9
1 files changed, 7 insertions, 2 deletions
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();
}