Skip to content

Commit 867dc63

Browse files
committed
target/riscv: extend trigger controls
* Add control for action mode. * Introduce `riscv mtrigger` command.
1 parent 1aebdf8 commit 867dc63

File tree

2 files changed

+229
-45
lines changed

2 files changed

+229
-45
lines changed

doc/openocd.texi

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11728,12 +11728,15 @@ set those triggers directly. (It's also possible to do so by writing the
1172811728
appropriate CSRs.)
1172911729

1173011730
@deffn {Command} {riscv etrigger set} [@option{m}] [@option{s}] [@option{u}] [@option{vs}] [@option{vu}] exception_codes
11731-
Set an exception trigger (type 5) on the current target, which halts the target when it
11732-
fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu} control
11733-
which execution modes the trigger fires in. @var{exception_codes} is a bit
11734-
field, where each bit corresponds to an exception code in mcause (defined in the
11735-
RISC-V Privileged Spec). The etrigger will fire on the exceptions whose bits are
11736-
set in @var{exception_codes}.
11731+
[@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}]
11732+
Set an exception trigger (type 5) on the current target, which sets the desired behavior on
11733+
the target when it fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu}
11734+
control which execution modes the trigger fires in. @var{exception_codes} is a bit field,
11735+
where each bit corresponds to an exception code in mcause (defined in the RISC-V Privileged Spec).
11736+
The etrigger will fire on the exceptions whose bits are set in @var{exception_codes}.
11737+
@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}
11738+
control the desired behavior on the target when the trigger fires. Defaults to @option{halt},
11739+
which halts the target.
1173711740

1173811741
For details on this trigger type, see the RISC-V Debug Specification.
1173911742
@end deffn
@@ -11743,14 +11746,16 @@ Clear the type 5 trigger that was set using @command{riscv etrigger set}.
1174311746
@end deffn
1174411747

1174511748
@deffn {Command} {riscv icount set} [@option{m}] [@option{s}] [@option{u}] [@option{vs}] [@option{vu}] [@option{pending}] count
11746-
Set an instruction count
11747-
trigger (type 3) on the current target, which halts the target when it fires.
11748-
@option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu} control which
11749-
execution modes the trigger fires in. If [@option{pending}] is passed then the
11750-
pending bit is set, which is unlikely to be useful unless you're debugging the
11751-
hardware implementation of this trigger.
11752-
@var{count} sets the number of instructions to execute before the trigger is
11753-
taken.
11749+
[@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}]
11750+
Set an instruction count trigger (type 3) on the current target, which sets the desired behavior
11751+
on the target when it fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu}
11752+
control which execution modes the trigger fires in. If [@option{pending}] is passed then the
11753+
pending bit is set, which is unlikely to be useful unless you're debugging the hardware
11754+
implementation of this trigger. @var{count} sets the number of instructions to execute before
11755+
the trigger is taken.
11756+
@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}
11757+
control the desired behavior on the target when the trigger fires. Defaults to @option{halt},
11758+
which halts the target.
1175411759

1175511760
For details on this trigger type, see the RISC-V Debug Specification.
1175611761
@end deffn
@@ -11760,12 +11765,16 @@ Clear the type 3 trigger that was set using @command{riscv icount set}.
1176011765
@end deffn
1176111766

1176211767
@deffn {Command} {riscv itrigger set} [@option{m}] [@option{s}] [@option{u}] [@option{vs}] [@option{vu}] [@option{nmi}] mie_bits
11763-
Set an interrupt trigger (type 4) on the current target, which halts the target when it
11764-
fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu} control
11765-
which execution modes the trigger fires in. If [@option{nmi}] is passed then
11766-
the trigger will fire on non-maskable interrupts in those modes. @var{mie_bits}
11767-
controls which interrupts the trigger fires on, using the same bit assignments
11768-
as in the mie CSR (defined in the RISC-V Privileged Spec).
11768+
[@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}]
11769+
Set an interrupt trigger (type 4) on the current target, which sets the desired behavior on
11770+
the target when it fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu}
11771+
control which execution modes the trigger fires in. If [@option{nmi}] is passed then the
11772+
trigger will fire on non-maskable interrupts in those modes. @var{mie_bits} controls which
11773+
interrupts the trigger fires on, using the same bit assignments as in the mie CSR (defined
11774+
in the RISC-V Privileged Spec).
11775+
@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}
11776+
control the desired behavior on the target when the trigger fires. Defaults to @option{halt},
11777+
which halts the target.
1176911778

1177011779
For details on this trigger type, see the RISC-V Debug Specification.
1177111780
@end deffn

0 commit comments

Comments
 (0)