aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-04-26 15:16:39 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-04-26 15:16:39 -0700
commit17d04aded36c454c942e4d31e3a0be41c3f4959b (patch)
tree465e1c288f4866a6b8d4aed15aeb07590bbf24de
parent9d4df3420c51e75bcc1d6162fc9cc680d6fd2481 (diff)
downloadriscv-openocd-17d04aded36c454c942e4d31e3a0be41c3f4959b.zip
riscv-openocd-17d04aded36c454c942e4d31e3a0be41c3f4959b.tar.gz
riscv-openocd-17d04aded36c454c942e4d31e3a0be41c3f4959b.tar.bz2
Keep calling the old poll on v0.11 targets
This is another thing that should be fixed correctly. Essentially this just uses the old codepath, which works for v0.11.
-rw-r--r--src/target/riscv/riscv.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index e86da05..15dfccb 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -341,6 +341,15 @@ static int oldriscv_poll(struct target *target)
return tt->poll(target);
}
+static int old_or_new_riscv_poll(struct target *target)
+{
+ RISCV_INFO(r);
+ if (r->is_halted == NULL)
+ return oldriscv_poll(target);
+ else
+ return riscv_openocd_poll(target);
+}
+
static int riscv_resume(struct target *target, int current, uint32_t address,
int handle_breakpoints, int debug_execution)
{
@@ -506,11 +515,11 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params,
LOG_ERROR(" now = 0x%08x", (uint32_t) now);
LOG_ERROR(" start = 0x%08x", (uint32_t) start);
riscv_halt(target);
- riscv_openocd_poll(target);
+ old_or_new_riscv_poll(target);
return ERROR_TARGET_TIMEOUT;
}
- int result = riscv_openocd_poll(target);
+ int result = old_or_new_riscv_poll(target);
if (result != ERROR_OK) {
return result;
}