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

riscv-011: Don't trigger semihosting before the target is examined #1228

Open
wants to merge 1 commit into
base: riscv
Choose a base branch
from

Conversation

JanMatCodasip
Copy link
Collaborator

In riscv-011 target, the handle_halt() function, and thus also riscv_semihosting(), can get called from within examine() before the examination is actually complete.

The chain of the function calls is:

  • examine() -> riscv011_poll() -> poll_target() -> handle_halt() -> riscv_semihosting()

If the target is already halted due to a breakpoint (dcsr.cause = SWBP) at the time OpenOCD connects to it, semihosting will be attempted before completing the examination, and the examination will fail.

This issue was observed on HiFive1 Rev A01.

The fix is to handle semihosting only after the target got successfully examined.

Change-Id: Iccfa0da35d47a430d8674131ebd2eb8e5e2922c0

In riscv-011 target, the handle_halt() function, and thus also
riscv_semihosting(), can get called from within examine() before
the examination is actually complete!

The chain of the function calls is:

- examine() -> riscv011_poll() -> poll_target()
  -> handle_halt() -> riscv_semihosting()

If the target is already halted due to a breakpoint (dcsr.cause = SWBP)
at the time OpenOCD connects to it, semihosting will be attempted before
completing the examination, and the examination will fail.

This issue was observed on HiFive1 Rev A01.

The fix is to handle semihosting only after the target got successfully
examined.

Change-Id: Iccfa0da35d47a430d8674131ebd2eb8e5e2922c0
Signed-off-by: Jan Matyas <[email protected]>
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.

1 participant