Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use trace action in RISC-V target triggers? #1182

Open
Alan-19950616 opened this issue Dec 10, 2024 · 4 comments
Open

How to use trace action in RISC-V target triggers? #1182

Alan-19950616 opened this issue Dec 10, 2024 · 4 comments

Comments

@Alan-19950616
Copy link

In the current OpenOCD code, the trace related action is not used.

/*
 * trace on:
 */
#define CSR_MCONTROL_ACTION_TRACE_ON        2
/*
 * trace off:
 */
#define CSR_MCONTROL_ACTION_TRACE_OFF       3
@JanMatCodasip
Copy link
Collaborator

Hi @Alan-19950616,

In riscv-openocd, there are currently no commands that would set up triggers with trace actions for you.

Still, you can set up such a trigger manually:

  1. Reserve the trigger to prevent OpenOCD from touching it - command riscv reserve_trigger
  2. Use standard CSR register write commands to set up your trigger: reg tselect <value>, reg tdata1 <value>, ...

@aap-sc
Copy link
Collaborator

aap-sc commented Dec 10, 2024

@Alan-19950616 also see here: #1158

@Alan-19950616
Copy link
Author

@JanMatCodasip @aap-sc Thanks for your replies.

The method you propose does successfully configure TRACE_ON/TRACE_OFF, but OpenOCD does not know that these Triggers are being used as TRACE_ON/TRACE_OFF functions, and therefore will conflict with normal hardware breakpoints.

@aap-sc
Copy link
Collaborator

aap-sc commented Dec 11, 2024

@Alan-19950616 have you tried `riscv reserve_trigger mentioned by @JanMatCodasip ? That command is designed to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants