This is an automated email from the ASF dual-hosted git repository.

linguini1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 5844ff5abb82f59862822e391fe7a6f4a42fa2f1
Author: Jukka Laitinen <[email protected]>
AuthorDate: Fri Jun 5 13:22:08 2026 +0300

    sched/misc/assert: Small flash-saving fixes
    
    - Use shared string for "stack pointer out of range" to avoid duplicate in 
flash
    - Re-use already calculated stack_used instead of calling up_check_tcbstack 
again
    
    Signed-off-by: Jukka Laitinen <[email protected]>
---
 sched/misc/assert.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 128046ccc61..ab6c47bbd4c 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -168,6 +168,11 @@ static int assert_tracecallback(FAR struct usbtrace_s 
*trace, FAR void *arg)
 
 #ifdef CONFIG_ARCH_STACKDUMP
 
+static void sp_out_of_range(uintptr_t sp)
+{
+  _alert("ERROR: Stack pointer %" PRIxPTR " is not within the stack\n", sp);
+}
+
 /****************************************************************************
  * Name: stack_dump
  ****************************************************************************/
@@ -285,8 +290,7 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t 
sp)
   else
     {
       force = true;
-      _alert("ERROR: Stack pointer %" PRIxPTR "is not within the stack\n",
-             sp);
+      sp_out_of_range(sp);
     }
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 0
@@ -309,8 +313,7 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t 
sp)
                     up_getusrsp((FAR void *)running_regs()) : 0;
       if (tcbstack_sp < tcbstack_base || tcbstack_sp >= tcbstack_top)
         {
-          _alert("ERROR: Stack pointer %" PRIxPTR " is not within the"
-                 " stack\n", tcbstack_sp);
+          sp_out_of_range(tcbstack_sp);
 
           tcbstack_sp = 0;
           force = true;
@@ -436,7 +439,7 @@ static void dump_task(FAR struct tcb_s *tcb, FAR void *arg)
          , tcb->stack_base_ptr
          , tcb->adj_stack_size
 #ifdef CONFIG_STACK_COLORATION
-         , up_check_tcbstack(tcb, tcb->adj_stack_size)
+         , stack_used
          , stack_filled / 10, stack_filled % 10
          , (stack_filled >= 10 * 80 ? '!' : ' ')
 #endif

Reply via email to