Skip to content

Commit

Permalink
Merge pull request riscv-collab#1198 from JanMatCodasip/jm-codasip/se…
Browse files Browse the repository at this point in the history
…mihosting-1-remove-dead-code

RISC-V Semihosting 1 of 3: Remove dead code
  • Loading branch information
en-sc authored Jan 13, 2025
2 parents f82c5a7 + ecb2ad4 commit eb9ba21
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/target/riscv/riscv_semihosting.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ void riscv_semihosting_init(struct target *target)
enum semihosting_result riscv_semihosting(struct target *target, int *retval)
{
struct semihosting *semihosting = target->semihosting;
if (!semihosting) {
LOG_TARGET_DEBUG(target, " -> NONE (!semihosting)");
return SEMIHOSTING_NONE;
}
assert(semihosting);

if (!semihosting->is_active) {
LOG_TARGET_DEBUG(target, " -> NONE (!semihosting->is_active)");
Expand Down Expand Up @@ -170,19 +167,16 @@ static int riscv_semihosting_setup(struct target *target, int enable)
LOG_TARGET_DEBUG(target, "enable=%d", enable);

struct semihosting *semihosting = target->semihosting;
if (semihosting)
semihosting->setup_time = clock();
assert(semihosting);

semihosting->setup_time = clock();
return ERROR_OK;
}

static int riscv_semihosting_post_result(struct target *target)
{
struct semihosting *semihosting = target->semihosting;
if (!semihosting) {
/* If not enabled, silently ignored. */
return 0;
}
assert(semihosting);

LOG_TARGET_DEBUG(target, "Result: 0x%" PRIx64, semihosting->result);
riscv_reg_set(target, GDB_REGNO_A0, semihosting->result);
Expand Down

0 comments on commit eb9ba21

Please sign in to comment.