Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 2ff786f

Browse files
committed
riscv_debug: Unconditionally disable triggers during detach
1 parent 9b8f7ea commit 2ff786f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/target/riscv_debug.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,12 @@ bool riscv_attach(target_s *const target)
10661066
void riscv_detach(target_s *const target)
10671067
{
10681068
riscv_hart_s *const hart = riscv_hart_struct(target);
1069+
/* Clear any stale triggers */
1070+
for (size_t trigger = 0U; trigger < hart->triggers; trigger++) {
1071+
const uint32_t tdata1 = 0U;
1072+
const uint32_t tdata2 = 0U;
1073+
riscv_config_trigger(hart, trigger, RISCV_TRIGGER_MODE_UNUSED, &tdata1, &tdata2);
1074+
}
10691075
/* Once we get done and the user's asked us to detach, we need to resume the hart */
10701076
riscv_halt_resume(target, false);
10711077
/* If the DMI needs steps done to quiesce it, finsh up with that */

0 commit comments

Comments
 (0)