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
This commit is contained in:
Tim Newsome 2018-05-17 16:24:27 -07:00
parent 7079e0ca7d
commit 022b6e7707
1 changed files with 3 additions and 0 deletions

View File

@ -1334,6 +1334,9 @@ int wait_for_authbusy(struct target *target, uint32_t *dmstatus)
static void deinit_target(struct target *target) static void deinit_target(struct target *target)
{ {
LOG_DEBUG("riscv_deinit_target()"); LOG_DEBUG("riscv_deinit_target()");
dmi_write(target, DMI_DMCONTROL, 0);
riscv_info_t *info = (riscv_info_t *) target->arch_info; riscv_info_t *info = (riscv_info_t *) target->arch_info;
free(info->version_specific); free(info->version_specific);
/* TODO: free register arch_info */ /* TODO: free register arch_info */