-
Notifications
You must be signed in to change notification settings - Fork 94
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 reset the DM on the first connection on both 0.13 and 1.0 spec versions #1021
Comments
My proposal would be to specify the external debugger is permitted to perform I am inclined to believe that this was the intention of the debug spec, however strict interpretation of the spec text |
The thing is, there may be a RISC-V Debug Spec v0.13 implemetation that complies to this strict interpretation of I would suggest specifying that while |
I maintain the opinion that
then the reset implementation in the DM can be considered defective, because in that case dmactive=0 does not clear the state of the debug module, as required by any version of the debug spec.
My recommendation for the EDs would be to go with the most robust approach in this case - that is to perform the DM reset always. If the ED detects the case when there would be concern about the hartsel bits, the ED can warn the user and possibly provide a configuration option to the user to alter the behavior. |
|
… is high With the clarification, it's obvious that the DM can be reset without knowing the `hartsel`. Fixes riscv#1021
I would to clarify this. Please, take a look at #1040.
Oh, I see. I didn't consider this. Thanks!
Initially, this issue was the least concerning to me. I think it can be mitigated by a descriptive error message on the ED side. |
… is high With the clarification, it's obvious that the DM can be reset without knowing the `hartsel`. Fixes riscv#1021
This is a clean way to let a debugger reset a DM without having to know what hartsel is first. It can simply write 0 then 1 to dmactive. These new rules resolve the issue raised in #1021, that if the DM is executing an abstract command when the debugger wants to reset it, the debugger should not be expected to preserve hartsel.
That would have been a better way to write the spec, but not what the spec says. Fixing this is not backwards compatible, and it's not worth it to make a backwards incompatible change to address the extreme corner case where the DM is executing an abstract command and also reading dmcontrol results in an error. |
dmcontrol.dmactive = 0
.The ED does not know whether an abstract command is executing, so it needs to read
dmcontrol
to know the value ofdmcontrol.hartsel
before writingdmcontrol = dmactive=0 | <the old hartsel value>
(requesting DM reset without changing hartsel).dmcontrol
results in an error.dmcontrol.dmactive
is low and [3.14.2. Debug Module Control ]dmcontrol.dmactive
is high and it's a legitimate DMI error (e.g. some issue with the connection).dmcontrol.dmactive
is low and writesdmcontrol = <dmcontrol.dmactive=1> | <hartsel=0>
-- may result in the change ofhartel
, so ED can't do that.dmcontrol
again.Now let's take into account RISC-V Debug Spec v0.13, since the ED does not yet know which version it is (
dtmcs
only distinguishes between 0.11 and (0.13 or 1.0)).In versions less then 0.13.3, according to [1.2.1.2. Incompatible Changes from 0.13 to 1.0]:
The HW is not required to eventually return something meaningful when
dmcontroll.dmactive
was set to low. So the ED may wait forever in the loop, readingdmcontrol
and getting an error on RISC-V Debug Spec v0.13 - compliant HW.Can this somehow be fixed?
The text was updated successfully, but these errors were encountered: