Merge pull request #1198 from JanMatCodasip/jm-codasip/semihosting-1-remove-dead-code

RISC-V Semihosting 1 of 3: Remove dead code
This commit is contained in:
Evgeniy Naydanov 2025-01-13 22:49:24 +03:00 committed by GitHub
commit eb9ba216e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 10 deletions

View File

@ -57,10 +57,7 @@ void riscv_semihosting_init(struct target *target)
enum semihosting_result riscv_semihosting(struct target *target, int *retval) enum semihosting_result riscv_semihosting(struct target *target, int *retval)
{ {
struct semihosting *semihosting = target->semihosting; struct semihosting *semihosting = target->semihosting;
if (!semihosting) { assert(semihosting);
LOG_TARGET_DEBUG(target, " -> NONE (!semihosting)");
return SEMIHOSTING_NONE;
}
if (!semihosting->is_active) { if (!semihosting->is_active) {
LOG_TARGET_DEBUG(target, " -> NONE (!semihosting->is_active)"); LOG_TARGET_DEBUG(target, " -> NONE (!semihosting->is_active)");
@ -170,19 +167,16 @@ static int riscv_semihosting_setup(struct target *target, int enable)
LOG_TARGET_DEBUG(target, "enable=%d", enable); LOG_TARGET_DEBUG(target, "enable=%d", enable);
struct semihosting *semihosting = target->semihosting; struct semihosting *semihosting = target->semihosting;
if (semihosting) assert(semihosting);
semihosting->setup_time = clock();
semihosting->setup_time = clock();
return ERROR_OK; return ERROR_OK;
} }
static int riscv_semihosting_post_result(struct target *target) static int riscv_semihosting_post_result(struct target *target)
{ {
struct semihosting *semihosting = target->semihosting; struct semihosting *semihosting = target->semihosting;
if (!semihosting) { assert(semihosting);
/* If not enabled, silently ignored. */
return 0;
}
LOG_TARGET_DEBUG(target, "Result: 0x%" PRIx64, semihosting->result); LOG_TARGET_DEBUG(target, "Result: 0x%" PRIx64, semihosting->result);
riscv_reg_set(target, GDB_REGNO_A0, semihosting->result); riscv_reg_set(target, GDB_REGNO_A0, semihosting->result);