Skip to content

Commit de4fc3d

Browse files
committed
riscv_debug: Implemented poll timeouts for halt/resume
1 parent 0cef432 commit de4fc3d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/target/riscv_debug.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,12 @@ static bool riscv_check_error(target_s *const target)
747747

748748
static bool riscv_dm_poll_state(riscv_dm_s *const dbg_module, const uint32_t state)
749749
{
750+
platform_timeout_s timeout;
751+
platform_timeout_set(&timeout, 500U);
750752
/* Poll for the requested state to become set */
751753
uint32_t status = 0;
752754
while (!(status & state)) {
753-
if (!riscv_dm_read(dbg_module, RV_DM_STATUS, &status))
755+
if (!riscv_dm_read(dbg_module, RV_DM_STATUS, &status) || platform_timeout_is_expired(&timeout))
754756
return false;
755757
}
756758
return true;

0 commit comments

Comments
 (0)