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

Commit bfec3e7

Browse files
committed
riscv_debug: Unconditionally disable triggers during detach
1 parent f9794e9 commit bfec3e7

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
@@ -1063,6 +1063,12 @@ bool riscv_attach(target_s *const target)
10631063
void riscv_detach(target_s *const target)
10641064
{
10651065
riscv_hart_s *const hart = riscv_hart_struct(target);
1066+
/* Clear any stale triggers */
1067+
for (size_t trigger = 0; trigger < hart->triggers; trigger++) {
1068+
const uint32_t tdata1 = 0;
1069+
const uint32_t tdata2 = 0;
1070+
riscv_config_trigger(hart, trigger, RISCV_TRIGGER_MODE_UNUSED, &tdata1, &tdata2);
1071+
}
10661072
/* Once we get done and the user's asked us to detach, we need to resume the hart */
10671073
riscv_halt_resume(target, false);
10681074
/* If the DMI needs steps done to quiesce it, finsh up with that */

0 commit comments

Comments
 (0)