diff --git a/source/hic_hal/atmel/sam3u2c/DAP_config.h b/source/hic_hal/atmel/sam3u2c/DAP_config.h index bb39b9aa4..1aadd54b0 100644 --- a/source/hic_hal/atmel/sam3u2c/DAP_config.h +++ b/source/hic_hal/atmel/sam3u2c/DAP_config.h @@ -401,14 +401,22 @@ __STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit) } } #else -__STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit) +extern uint8_t swd_init_debug(void); +extern uint8_t swd_write_memory(uint32_t address, uint8_t *data, uint32_t size); +__STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit) { - if (bit & 1) { - PIN_nRESET_PORT->PIO_SODR = PIN_nRESET; - - } else { - PIN_nRESET_PORT->PIO_CODR = PIN_nRESET; - } + if (bit & 1) + { + PIN_nRESET_PORT->PIO_SODR = PIN_nRESET; + } + else + { + PIN_nRESET_PORT->PIO_CODR = PIN_nRESET; + + swd_init_debug(); + uint32_t swd_mem_write_data = 0x05FA0000 | 0x4; + swd_write_memory(0xE000ED0C, (uint8_t *)&swd_mem_write_data, 4); + } } #endif ///@} diff --git a/source/hic_hal/stm32/stm32f103xb/DAP_config.h b/source/hic_hal/stm32/stm32f103xb/DAP_config.h index ce250bccc..bdc1b0a8f 100644 --- a/source/hic_hal/stm32/stm32f103xb/DAP_config.h +++ b/source/hic_hal/stm32/stm32f103xb/DAP_config.h @@ -416,15 +416,20 @@ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN(void) - 1: release device hardware reset. */ // TODO - sw specific implementation should be created - -__STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit) +extern uint8_t swd_init_debug(void); +extern uint8_t swd_write_memory(uint32_t address, uint8_t *data, uint32_t size); +__STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit) { - if (bit & 1) + if (bit & 1) nRESET_PIN_PORT->BSRR = nRESET_PIN; else nRESET_PIN_PORT->BRR = nRESET_PIN; -} + swd_init_debug(); + uint32_t swd_mem_write_data = 0x05FA0000 | 0x4; + swd_write_memory(0xE000ED0C, (uint8_t *)&swd_mem_write_data, 4); + } +} //************************************************************************************************** /** \defgroup DAP_Config_LEDs_gr CMSIS-DAP Hardware Status LEDs