diff --git a/src/target/target.c b/src/target/target.c index f26789c13c4..f98a5df83e5 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -334,13 +334,10 @@ bool target_mem64_write(target_s *const target, const target_addr64_t dest, cons return target_check_error(target); } -/* target_mem_access_needs_halt() is true if the target needs to be halted during jtag memory access */ - +/* Returns true if the target needs halting to access memory on it */ bool target_mem_access_needs_halt(target_s *target) { - /* assume all arm processors allow memory access while running, and no riscv does. */ - bool is_riscv = target && target->core && strstr(target->core, "RVDBG"); - return is_riscv; + return !(target->target_options & TOPT_NON_HALTING_MEM_IO); } /* Register access functions */ diff --git a/src/target/target_internal.h b/src/target/target_internal.h index 313a4fdbfaf..ab7b11e5489 100644 --- a/src/target/target_internal.h +++ b/src/target/target_internal.h @@ -27,8 +27,9 @@ #include "platform_support.h" #include "target_probe.h" -#define TOPT_INHIBIT_NRST (1U << 0U) -#define TOPT_IN_SEMIHOSTING_SYSCALL (1U << 31U) +#define TOPT_INHIBIT_NRST (1U << 0U) /* Target misbehaves if reset using nRST line */ +#define TOPT_NON_HALTING_MEM_IO (1U << 30U) /* Target does not need halting for memory I/O */ +#define TOPT_IN_SEMIHOSTING_SYSCALL (1U << 31U) /* Target is currently in a semihosting syscall */ extern target_s *target_list;