Closed Tim-Dong-CN closed 11 months ago
@Tim-Dong-CN are you talking about this part of the snippet?
if (get_field(dmstatus, DM_DMSTATUS_ALLRESUMEACK) == 0)
continue;
if (step && get_field(dmstatus, DM_DMSTATUS_ALLHALTED) == 0)
continue;
?
Could you please elaborate what's wrong with it? If I read this right the sequence is the following:
both conditions should be true simultaneously. Looks fine to me.
In the scenario that you've described:
This results in all these operations completing before OpenOCD reads the dmstatus register for the first time after sending the resume request.
Upon accepting resume request the hart should have resumeack
set and allhalted
set if the step completes. This is aligned quite well with the above analysis. Am I missing something?
Thank you for your reply. I think there is a problem with my understanding of the resumeack protocol. Of course your code is correct. Express thanks to you!
Which OpenOCD version are you using?
The error "unable to resume hart 0" appears
(gdb) ni unable to resume hart 0 dmstatus =0x00400383 was stepping, halting
From the error message reported, It seems to be prior to https://github.com/riscv/riscv-openocd/commit/550a66e720 (at least year old). Maybe the problem you have can be solved by using a more recent version?
Hi, I met the similar issue when running bunch of step commands using a tcl script, while no error was reported when just send a single step command through telnet
I've already updated my OpenOCD to the latest version, commit: 6a61446, and the problem still exist..
@jbw0410 could you please run OpenOCD with -d3
option passed to the command line? This will enable verbose debug logging. Please attach the output to this discussion. Most likely the log file will be huge, so you should compress it.
The error "unable to resume hart 0" appears
I am using remote-bitbang for simulation testing. Upon inspecting the log information from OpenOCD and reviewing my simulation waveform files, I observed that Hart 0 has already received the resume request sent by OpenOCD, and the core has resumed execution. Subsequently, it paused via a single-step. However, the operations within this Hart occur very rapidly, while JTAG transmission is comparatively slow. This results in all these operations completing before OpenOCD reads the dmstatus register for the first time after sending the resume request. As a consequence, OpenOCD incorrectly believes that the core has not resumed execution and, therefore, reports an error.
By examining the OpenOCD source code, I speculate that the logic in the following code snippet might be causing the issue. I think relying solely on checking DM_DMSTATUS_ALLHALTED might be too simplistic. Would it be more rigorous to incorporate the detection with the dcsr register for a more comprehensive verification of the check result?