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

src/target/riscv: error out of the examine() in case abits is zero #1238

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

en-sc
Copy link
Collaborator

@en-sc en-sc commented Mar 7, 2025

The spec requires abits to be no less then 7 ( [3.1. Debug Module Interface (DMI)]):

The DMI uses between 7 and 32 address bits

Commit a450a7d ("Fix data types around batch.{c,h}") introduced a check that issues a warning if abits is less then 7. The reason it's a warning and not an error -- on Spike abits is 6.

However, if the examination is to proceed when abits is zero, an assert in get_dmi_scan_length() will trigger when attempting to communicate over DMI.
Link: https://github.com/JanMatCodasip/riscv-openocd/blob/a450a7d4966a19c48b2543810f5b8370af6383e5/src/target/riscv/batch.c#L25

It's impossible to communicate over DMI with abits == 0, so an error is returned instead of a warning in this case.

Change-Id: Ice4622adccfc8304b37bc678253cc19d8ac1457e

The spec requires `abits` to be no less then 7 ( [3.1. Debug Module
Interface (DMI)]):
> The DMI uses between 7 and 32 address bits

Commit a450a7d ("Fix data types around
batch.{c,h}") introduced a check that issues a warning if `abits` is
less then 7. The reason it's a warning and not an error -- on Spike
`abits` is 6.

However, if the examination is to proceed when `abits` is zero, an
assert in `get_dmi_scan_length()` will trigger when attempting to
communicate over DMI.
Link: https://github.com/JanMatCodasip/riscv-openocd/blob/a450a7d4966a19c48b2543810f5b8370af6383e5/src/target/riscv/batch.c#L25

It's impossible to communicate over DMI with `abits == 0`, so an error
is returned instead of a warning in this case.

Change-Id: Ice4622adccfc8304b37bc678253cc19d8ac1457e
Signed-off-by: Evgeniy Naydanov <[email protected]>
@en-sc en-sc requested a review from JanMatCodasip March 7, 2025 08:37
@en-sc en-sc self-assigned this Mar 7, 2025
@en-sc
Copy link
Collaborator Author

en-sc commented Mar 7, 2025

@JanMatCodasip, please take a look at this one when you have the time. It's related to #1202

Copy link
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@en-sc en-sc merged commit c3f1566 into riscv-collab:riscv Mar 10, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants