Skip to content

Commit 363a0a2

Browse files
authored
Merge pull request #64 from riscv/release-fixes
Two fixes from the release branch
2 parents e17f8f0 + afc9eb6 commit 363a0a2

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/target/riscv/riscv-013.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ static int register_write_direct(struct target *target, unsigned number,
542542

543543
int exec_out = riscv_program_exec(&program, target);
544544
if (exec_out != ERROR_OK) {
545-
LOG_ERROR("Unable to execute program");
546-
return exec_out;
545+
riscv013_clear_abstract_error(target);
546+
return ERROR_FAIL;
547547
}
548548

549549
return ERROR_OK;
@@ -575,8 +575,8 @@ static int register_read_direct(struct target *target, uint64_t *value, uint32_t
575575

576576
int exec_out = riscv_program_exec(&program, target);
577577
if (exec_out != ERROR_OK) {
578-
LOG_ERROR("Unable to execute program");
579-
return exec_out;
578+
riscv013_clear_abstract_error(target);
579+
return ERROR_FAIL;
580580
}
581581

582582
*value = 0;
@@ -679,7 +679,7 @@ static int init_target(struct command_context *cmd_ctx,
679679
info->ac_busy_delay = 0;
680680

681681
target->reg_cache = calloc(1, sizeof(*target->reg_cache));
682-
target->reg_cache->name = "RISC-V registers";
682+
target->reg_cache->name = "RISC-V Registers";
683683
target->reg_cache->num_regs = GDB_REGNO_COUNT;
684684

685685
target->reg_cache->reg_list = calloc(GDB_REGNO_COUNT, sizeof(struct reg));

src/target/riscv/riscv.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,8 @@ int riscv_openocd_poll(struct target *target)
737737

738738
int riscv_openocd_halt(struct target *target)
739739
{
740+
RISCV_INFO(r);
741+
740742
LOG_DEBUG("halting all harts");
741743

742744
int out = riscv_halt_all_harts(target);
@@ -746,6 +748,11 @@ int riscv_openocd_halt(struct target *target)
746748
}
747749

748750
register_cache_invalidate(target->reg_cache);
751+
if (riscv_rtos_enabled(target)) {
752+
target->rtos->current_threadid = r->rtos_hartid + 1;
753+
target->rtos->current_thread = r->rtos_hartid + 1;
754+
}
755+
749756
target->state = TARGET_HALTED;
750757
target->debug_reason = DBG_REASON_DBGRQ;
751758
target_call_event_callbacks(target, TARGET_EVENT_HALTED);

0 commit comments

Comments
 (0)