-
Notifications
You must be signed in to change notification settings - Fork 328
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
Incorrect "valid" read of menvcfg
CSR from HiFive1 board
#1058
Comments
While I can reproduce this reliably by running the |
Is this triggering something that causes the wrong value to be read?
|
@en-sc - maybe when you get a chance you could look at this as you probably know a lot more about the mechanics of the caching that's going on here than I do (which wouldn't be difficult! 🤣 ). |
@TommyMurphyTM1234, thanks for the great analysis! Disclaimer: I have not read RISC-V Debug Spec v0.11 nor developed the related code. So this analysis is more of a guess than a definitive truth. AFAIU, the issue is internal to Taking a look at the snippets you've provided one can see:
TLDRI think the issue is RISC-V 0.11 specific and one would need to be quite knowledgeable in RISC-V Debug v0.11 to fix it (I'm not). Fixing the issue may take some time. On a side note, @TommyMurphyTM1234, does the test fails always on |
Thanks a lot for the detailed analysis @en-sc. Just to address this specific point:
The test fails every time (not sporadically) and always in the same way - i.e. a mismatch between the old and new (after disconnect/reconnect) values of |
It probably doesn't add anything to the analysis but if I reduce the JTAG clock speed from 10Mhz to, say, 5MHz: then the problem goes away but only because the DBUS delay "backoff" increments and register read retries disappear. But I presume that the issue with the incorrect successful read of |
I bumped the clock speed up to 30MHz just to see if I could trigger the problem with another CSR but without success. However I noticed a few things. The first read of
The second one always does and results in the incorrect "successful" read:
The second read of other CSRs also leads to DBUS "backoff" delays but not the incorrect "successful" read of a value for the register:
and
So, for some reason, the issue seems (so far) specific to |
Split out from this issue:
I'm using this build of OpenOCD:
When I run the
DisconnectTest
test I get this:This is the resulting log:
logs/20240424-095411-HiFive1-DisconnectTest.log
: 20240424-095411-HiFive1-DisconnectTest.logThis test reads all registers, disconnects/reconnects, reads all registers again and compares the two sets of values. The test passes if they match and fails if they don't.
In this case it fails because the first read of
menvcfg
correctly fails because it is not implemented on this M-mode only target (SiFive HiFive1 Rev A01 using the FE310-G000 CPU). But the second read after the disconnect "succeeds" but seems to get the value ofmtvec
:I think that these are the relevant snippets of the OpenOCD verbose log:
Is there a bug in the caching of registers that causes this?
The text was updated successfully, but these errors were encountered: