WFI: Reacquire control of the core in the debugger after it executes a WFI instruction#43
Merged
eyck merged 1 commit intoMinres:mainfrom Mar 7, 2026
Conversation
db4f8fd to
c86d984
Compare
eyck
requested changes
Mar 6, 2026
Contributor
eyck
left a comment
There was a problem hiding this comment.
There is an update of the dbt-rise-core commit hash in the toplevel CMakeList.txt line 30 needed
ad01da6 to
d168843
Compare
…a WFI instruction. A new gdb_stop_evt event was added, triggered when the debugger issues a stop request. The thread now waits on wfi_evt or gdb_stop_evt (SystemC OR event list). After waking, it checks whether gdb_stop_evt triggered; if so, it exits the loop immediately.
d168843 to
bd008da
Compare
Contributor
Author
updated with 5d1ab03db17819fc113d3c4182cf0cee666085f2 hash. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: When the core executes a WFI instruction (or RISC-V equivalent) we cannot regain the core from the debugger
Root Cause: When the firmware executes the WFI instruction, core start waiting for the WFI event and it suspends the thread that runs execute_inst. The problem is that this same thread is responsible for checking whether the debugger has issued a stop request. Because the thread is suspended during WFI, it cannot evaluate the stop condition or call the GDB session’s stop_callback.
Fix: A new gdb_stop_evt event was added, triggered when the debugger issues a stop request. The thread now waits on wfi_evt or gdb_stop_evt (SystemC OR event list). After waking, it checks whether gdb_stop_evt triggered; if so, it exits the loop immediately.