aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2017-06-15 12:43:46 -0700
committerGitHub <noreply@github.com>2017-06-15 12:43:46 -0700
commit363a0a2bf2896794120ac8387f2058cd5f65c2c5 (patch)
treee2ba89b1105b065e151d69be7a0bcbcf57027fc2
parente17f8f03b50856ce44b8dc3a48d82dd8facc513d (diff)
parentafc9eb6c470f3fae951c833d2a8585aeba65f2df (diff)
downloadriscv-openocd-363a0a2bf2896794120ac8387f2058cd5f65c2c5.zip
riscv-openocd-363a0a2bf2896794120ac8387f2058cd5f65c2c5.tar.gz
riscv-openocd-363a0a2bf2896794120ac8387f2058cd5f65c2c5.tar.bz2
Merge pull request #64 from riscv/release-fixes
Two fixes from the release branch
-rw-r--r--src/target/riscv/riscv-013.c10
-rw-r--r--src/target/riscv/riscv.c7
2 files changed, 12 insertions, 5 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index b08872d..899c098 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -542,8 +542,8 @@ static int register_write_direct(struct target *target, unsigned number,
int exec_out = riscv_program_exec(&program, target);
if (exec_out != ERROR_OK) {
- LOG_ERROR("Unable to execute program");
- return exec_out;
+ riscv013_clear_abstract_error(target);
+ return ERROR_FAIL;
}
return ERROR_OK;
@@ -575,8 +575,8 @@ static int register_read_direct(struct target *target, uint64_t *value, uint32_t
int exec_out = riscv_program_exec(&program, target);
if (exec_out != ERROR_OK) {
- LOG_ERROR("Unable to execute program");
- return exec_out;
+ riscv013_clear_abstract_error(target);
+ return ERROR_FAIL;
}
*value = 0;
@@ -679,7 +679,7 @@ static int init_target(struct command_context *cmd_ctx,
info->ac_busy_delay = 0;
target->reg_cache = calloc(1, sizeof(*target->reg_cache));
- target->reg_cache->name = "RISC-V registers";
+ target->reg_cache->name = "RISC-V Registers";
target->reg_cache->num_regs = GDB_REGNO_COUNT;
target->reg_cache->reg_list = calloc(GDB_REGNO_COUNT, sizeof(struct reg));
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index c54f087..e578b9c 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -737,6 +737,8 @@ int riscv_openocd_poll(struct target *target)
int riscv_openocd_halt(struct target *target)
{
+ RISCV_INFO(r);
+
LOG_DEBUG("halting all harts");
int out = riscv_halt_all_harts(target);
@@ -746,6 +748,11 @@ int riscv_openocd_halt(struct target *target)
}
register_cache_invalidate(target->reg_cache);
+ if (riscv_rtos_enabled(target)) {
+ target->rtos->current_threadid = r->rtos_hartid + 1;
+ target->rtos->current_thread = r->rtos_hartid + 1;
+ }
+
target->state = TARGET_HALTED;
target->debug_reason = DBG_REASON_DBGRQ;
target_call_event_callbacks(target, TARGET_EVENT_HALTED);