From fcd9f6aab7e0c90a07bc60efafc0375c89cf97c5 Mon Sep 17 00:00:00 2001 From: Max Chan Date: Thu, 22 Nov 2018 01:31:14 +0800 Subject: [PATCH 1/2] Ignore the macOS crap --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c43db80..912bf30 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,7 @@ GTAGS *.map # ignore local makefile settings -src/local.mk \ No newline at end of file +src/local.mk + +# Ignore macOS crap +.DS_Store From 85bb13eed9e96dc7f1cb031a68f0fda9ef381663 Mon Sep 17 00:00:00 2001 From: Max Chan Date: Thu, 22 Nov 2018 01:33:28 +0800 Subject: [PATCH 2/2] Made RESET and LED optional. --- src/stm32f042/DAP/CMSIS_DAP_hal.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/stm32f042/DAP/CMSIS_DAP_hal.h b/src/stm32f042/DAP/CMSIS_DAP_hal.h index 54d6060..b35a40d 100644 --- a/src/stm32f042/DAP/CMSIS_DAP_hal.h +++ b/src/stm32f042/DAP/CMSIS_DAP_hal.h @@ -149,39 +149,51 @@ static __inline uint32_t PIN_SWCLK_TCK_IN (void) { } static __inline uint32_t PIN_nRESET_IN (void) { +#if defined(nRESET_GPIO_PORT) && defined(nRESET_GPIO_PIN) return (GPIO_IDR(nRESET_GPIO_PORT) & nRESET_GPIO_PIN) ? 0x1 : 0x0; +#else + return 1; +#endif } static __inline void PIN_nRESET_OUT (uint32_t bit) { +#if defined(nRESET_GPIO_PORT) && defined(nRESET_GPIO_PIN) if (bit & 0x1) { GPIO_BSRR(nRESET_GPIO_PORT) = nRESET_GPIO_PIN; } else { GPIO_BRR(nRESET_GPIO_PORT) = nRESET_GPIO_PIN; } +#endif } static __inline void LED_CONNECTED_OUT (uint32_t bit) { +#if defined(LED_CON_GPIO_PORT) && defined(LED_CON_GPIO_PIN) if ((bit & 0x1) ^ LED_OPEN_DRAIN) { gpio_set(LED_CON_GPIO_PORT, LED_CON_GPIO_PIN); } else { gpio_clear(LED_CON_GPIO_PORT, LED_CON_GPIO_PIN); } +#endif } static __inline void LED_RUNNING_OUT (uint32_t bit) { +#if defined(LED_RUN_GPIO_PORT) && defined(LED_RUN_GPIO_PIN) if ((bit & 0x1) ^ LED_OPEN_DRAIN) { gpio_set(LED_RUN_GPIO_PORT, LED_RUN_GPIO_PIN); } else { gpio_clear(LED_RUN_GPIO_PORT, LED_RUN_GPIO_PIN); } +#endif } static __inline void LED_ACTIVITY_OUT (uint32_t bit) { +#if defined(LED_ACT_GPIO_PORT) && defined(LED_ACT_GPIO_PIN) if ((bit & 0x1) ^ LED_OPEN_DRAIN) { gpio_set(LED_ACT_GPIO_PORT, LED_ACT_GPIO_PIN); } else { gpio_clear(LED_ACT_GPIO_PORT, LED_ACT_GPIO_PIN); } +#endif } static __inline void DAP_SETUP (void) { @@ -189,12 +201,14 @@ static __inline void DAP_SETUP (void) { LED_RUNNING_OUT(0); LED_CONNECTED_OUT(0); +#if defined(nRESET_GPIO_PORT) && defined(nRESET_GPIO_PIN) // Configure nRESET as an open-drain output GPIO_BSRR(nRESET_GPIO_PORT) = nRESET_GPIO_PIN; gpio_set_output_options(nRESET_GPIO_PORT, GPIO_OTYPE_OD, GPIO_OSPEED_LOW, nRESET_GPIO_PIN); gpio_mode_setup(nRESET_GPIO_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, nRESET_GPIO_PIN); +#endif } static __inline uint32_t RESET_TARGET (void) { return 0; }