diff --git a/src/target/cortexm.c b/src/target/cortexm.c index 86e46fd..cbd769b 100644 --- a/src/target/cortexm.c +++ b/src/target/cortexm.c @@ -413,6 +413,8 @@ void cortexm_detach(target *t) /* Disable debug */ target_mem_write32(t, CORTEXM_DHCSR, CORTEXM_DHCSR_DBGKEY); + /* Add some clock cycles to get the CPU running again.*/ + target_mem_read32(t, 0); } enum { DB_DHCSR, DB_DCRSR, DB_DCRDR, DB_DEMCR };