stm32: Add option to disable SWD on GigaDevice STM32F103 clones

Tested by @FotoFieber.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2021-11-24 11:15:22 -05:00
parent 790d48b46c
commit 2b7d0bba42
2 changed files with 17 additions and 2 deletions

View File

@@ -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();
}