aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-01-03 15:06:35 -0800
committerTim Newsome <tim@sifive.com>2019-01-03 15:06:35 -0800
commita9d436e77fd3945643c4fb1eee4f22c310e94b26 (patch)
tree91612394cfa56c6be82a28189dbe27ada77a4cb7
parent07369295127cf93af062ed48242d8267a931e771 (diff)
downloadriscv-openocd-a9d436e77fd3945643c4fb1eee4f22c310e94b26.zip
riscv-openocd-a9d436e77fd3945643c4fb1eee4f22c310e94b26.tar.gz
riscv-openocd-a9d436e77fd3945643c4fb1eee4f22c310e94b26.tar.bz2
WIP make riscv work with -rtos hwthread.
Change-Id: I37bb16291fa87a83f21e5fd8bad53492a4d69425
-rw-r--r--src/target/riscv/riscv.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 1c89e6d..0ec2049 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -856,8 +856,28 @@ static int old_or_new_riscv_resume(
int handle_breakpoints,
int debug_execution
){
- RISCV_INFO(r);
LOG_DEBUG("handle_breakpoints=%d", handle_breakpoints);
+ if (target->smp) {
+ struct target_list *targets = target->head;
+ int result = ERROR_OK;
+ while (targets) {
+ struct target *t = targets->target;
+ riscv_info_t *r = riscv_info(t);
+ if (r->is_halted == NULL) {
+ if (oldriscv_resume(t, current, address, handle_breakpoints,
+ debug_execution) != ERROR_OK)
+ result = ERROR_FAIL;
+ } else {
+ if (riscv_openocd_resume(t, current, address,
+ handle_breakpoints, debug_execution) != ERROR_OK)
+ result = ERROR_FAIL;
+ }
+ targets = targets->next;
+ }
+ return result;
+ }
+
+ RISCV_INFO(r);
if (r->is_halted == NULL)
return oldriscv_resume(target, current, address, handle_breakpoints, debug_execution);
else
@@ -1938,9 +1958,10 @@ int riscv_xlen_of_hart(const struct target *target, int hartid)
return r->xlen[hartid];
}
+extern struct rtos_type riscv_rtos;
bool riscv_rtos_enabled(const struct target *target)
{
- return target->rtos != NULL;
+ return target->rtos && target->rtos->type == &riscv_rtos;
}
int riscv_set_current_hartid(struct target *target, int hartid)