From 3484a7b3f63a325fe7265d7928a9cbfd4da53a4e Mon Sep 17 00:00:00 2001 From: "S.J.R. van Schaik" Date: Wed, 20 Dec 2017 21:30:11 +0100 Subject: [PATCH] shell: jtag: add command to enable/disable JTAG --- source/main.c | 4 ++++ source/platform/stm32f1/gpio.c | 3 ++- source/shell/Makefile | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/main.c b/source/main.c index 7d7de53..e064854 100644 --- a/source/main.c +++ b/source/main.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +46,9 @@ struct cmd user_cmds[] = { struct cmd admin_cmds[] = { { "echo", shell_echo }, +#ifdef STM32F1 + { "jtag", shell_jtag }, +#endif { "buzzer", shell_buzzer }, { "led", shell_led }, { "reset", shell_alarm }, diff --git a/source/platform/stm32f1/gpio.c b/source/platform/stm32f1/gpio.c index c8bba8f..31b04e2 100644 --- a/source/platform/stm32f1/gpio.c +++ b/source/platform/stm32f1/gpio.c @@ -30,7 +30,8 @@ int gpio_init(void) GPIO1); /* Set up GPIOs for timers. */ - gpio_primary_remap(0, AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP1); + gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, + AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP1); gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_TIM2_PR1_CH1_ETR); diff --git a/source/shell/Makefile b/source/shell/Makefile index 259a215..0129c31 100644 --- a/source/shell/Makefile +++ b/source/shell/Makefile @@ -11,3 +11,7 @@ obj-y += source/shell/mufs.o obj-y += source/shell/progress.o obj-y += source/shell/rtc.o obj-y += source/shell/version.o + +ifeq (${TARGET},stm32f1) +obj-y += source/shell/jtag.o +endif