From 139707c5c032a4eab9815b7878c98aad6b29431f Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Wed, 18 Jul 2018 23:20:26 +0200 Subject: [PATCH] cortexm/detach: Add a dummy transaction after cleaning DHCSR. This replaces the seemingly superflous swdptap_seq_out() at the end of adiv5_swdp_low_access() needed to continue after detach. --- src/target/cortexm.c | 2 ++ 1 file changed, 2 insertions(+) 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 };