From 9c0a1fbc995bdbc0989119ae49c4e87bd6afd0ad Mon Sep 17 00:00:00 2001 From: emece67 <98874294+emece67@users.noreply.github.com> Date: Tue, 20 Oct 2026 14:17:20 +0200 Subject: [PATCH] Zephyr: support RISC-V stack pointer, don't hang on errors 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 --- src/rtos/rtos-zephyr.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rtos/rtos-zephyr.ts b/src/rtos/rtos-zephyr.ts index 1984e83..953d20d 100644 --- a/src/rtos/rtos-zephyr.ts +++ b/src/rtos/rtos-zephyr.ts @@ -283,6 +283,7 @@ export class RTOSZEPHYR extends RTOSCommon.RTOSBase { resolve(); } catch (e) { console.log('RTOSZEPHYR.getThreadInfo() error', e); + resolve(); // show the threads found so far instead of hanging the panel } }, (e) => { @@ -410,7 +411,8 @@ export class RTOSZEPHYR extends RTOSCommon.RTOSBase { return stackInfo; } - const TopOfStack = callee_saved.psp.val; // FIXME This is not right for all arches => include\zephyr\arch\....\thread.h + // the saved stack pointer is 'psp' on Cortex-M and 'sp' on RISC-V (include/zephyr/arch/*/thread.h) + const TopOfStack = (callee_saved.psp ?? callee_saved.sp)?.val; stackInfo.stackTop = parseInt(TopOfStack); /* only available with CONFIG_THREAD_STACK_INFO (optional) */