From a9d436e77fd3945643c4fb1eee4f22c310e94b26 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 3 Jan 2019 15:06:35 -0800 Subject: WIP make riscv work with -rtos hwthread. Change-Id: I37bb16291fa87a83f21e5fd8bad53492a4d69425 --- src/target/riscv/riscv.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.1