From 022b6e77076d0da828333e8d2a4a358baec5a6cc Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 17 May 2018 16:24:27 -0700 Subject: [PATCH] Disable the DM when OpenOCD exits. gdb/OpenOCD already remove all the breakpoints when exiting, so I think this is all we need to do to restore the hart to the state it was in before connecting. Issue #200. Change-Id: Ibcde7a3b68d221dd2718b8b51dfc7946350a8fcb --- src/target/riscv/riscv-013.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 00714aae7..57e31261b 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1334,6 +1334,9 @@ int wait_for_authbusy(struct target *target, uint32_t *dmstatus) static void deinit_target(struct target *target) { LOG_DEBUG("riscv_deinit_target()"); + + dmi_write(target, DMI_DMCONTROL, 0); + riscv_info_t *info = (riscv_info_t *) target->arch_info; free(info->version_specific); /* TODO: free register arch_info */