Repository navigation
Zephyr: support RISC-V stack pointer and don't hang the panel on errors - #103
Merged
Merged
Conversation
getStackInfo() read callee_saved.psp, which only exists on Cortex-M. On RISC-V the saved stack pointer is callee_saved.sp, so .val threw. The exception was caught in getThreadInfo(), whose catch never settled the promise, leaving the panel on "Busy updating..." forever. Fall back to callee_saved.sp when psp is absent (Cortex-M unchanged) and resolve() in that catch so errors show the threads found so far. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Good fix. Especially not having a resolve() Looks like a safe fix for non-Cortex-M processors. |
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.
Problem
On a Zephyr target that is not Cortex-M (seen on an ESP32-C6, RISC-V, Zephyr 4.2, Cortex-Debug 1.12.1 + OpenOCD), the xRTOS panel detects Zephyr and then stays on "RTOS Views: Busy updating..." forever.
Two things combine:
getStackInfo()readscallee_saved.psp, which only exists on Cortex-M (the code already has a FIXME about this). On RISC-Vstruct _callee_savedhassp,ra,s0…s11, socallee_saved.pspisundefinedand.valthrows.getThreadInfo(), but thecatchonly logs it and never settles the promise, sorefresh()never completes and the panel stays busy.Fix
callee_saved.psp ?? callee_saved.sp. Cortex-M behaviour is unchanged (pspis still used when present).resolve()in thatcatch, so an unexpected error shows the threads collected so far instead of hanging the view.With both changes the panel shows the
mainandidlethreads with their name, priority, running state and stack usage on the ESP32-C6.Other things noticed (not addressed here)
refresh()calls run concurrently and both push into the sharedfoundThreads.???. Zephyr never queues the idle thread, so itsthread_stateis 0, which has no name inOsTaskState.🤖 Generated with Claude Code