You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/04/21 17:13:00 UTC

[incubator-nuttx] branch master updated: arch/xtensa: Color the other CPUs task when they are created.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 56ecd44f63 arch/xtensa: Color the other CPUs task when they are created.
56ecd44f63 is described below

commit 56ecd44f63d0822965a33f2452bcef644ab66b71
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Apr 21 16:17:06 2022 +0200

    arch/xtensa: Color the other CPUs task when they are created.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/src/esp32/esp32_cpuidlestack.c     | 18 ++++++++++++++++++
 arch/xtensa/src/esp32/esp32_cpustart.c         | 18 ------------------
 arch/xtensa/src/esp32s3/esp32s3_cpuidlestack.c | 18 ++++++++++++++++++
 arch/xtensa/src/esp32s3/esp32s3_cpustart.c     | 18 ------------------
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/arch/xtensa/src/esp32/esp32_cpuidlestack.c b/arch/xtensa/src/esp32/esp32_cpuidlestack.c
index 7a79b40fd8..dae3d4122a 100644
--- a/arch/xtensa/src/esp32/esp32_cpuidlestack.c
+++ b/arch/xtensa/src/esp32/esp32_cpuidlestack.c
@@ -100,6 +100,24 @@ int up_cpu_idlestack(int cpu, struct tcb_s *tcb, size_t stack_size)
   tcb->adj_stack_size  = CPU1_IDLETHREAD_STACKSIZE;
   tcb->stack_base_ptr  = tcb->stack_alloc_ptr;
 
+#ifdef CONFIG_STACK_COLORATION
+    {
+      register uint32_t *ptr;
+      register int i;
+
+      /* If stack debug is enabled, then fill the stack with a recognizable
+       * value that we can use later to test for high water marks.
+       */
+
+      for (i = 0, ptr = (uint32_t *)tcb->stack_alloc_ptr;
+           i < tcb->adj_stack_size;
+           i += sizeof(uint32_t))
+        {
+          *ptr++ = STACK_COLOR;
+        }
+    }
+#endif
+
 #if XCHAL_CP_NUM > 0
   /* REVISIT: Does it make since to have co-processors enabled on the IDLE
    * thread?
diff --git a/arch/xtensa/src/esp32/esp32_cpustart.c b/arch/xtensa/src/esp32/esp32_cpustart.c
index 9c2ca772e1..6a9fe3ee40 100644
--- a/arch/xtensa/src/esp32/esp32_cpustart.c
+++ b/arch/xtensa/src/esp32/esp32_cpustart.c
@@ -129,24 +129,6 @@ void IRAM_ATTR xtensa_appcpu_start(void)
   struct tcb_s *tcb = this_task();
   register uint32_t sp;
 
-#ifdef CONFIG_STACK_COLORATION
-    {
-      register uint32_t *ptr;
-      register int i;
-
-      /* If stack debug is enabled, then fill the stack with a recognizable
-       * value that we can use later to test for high water marks.
-       */
-
-      for (i = 0, ptr = (uint32_t *)tcb->stack_alloc_ptr;
-           i < tcb->adj_stack_size;
-           i += sizeof(uint32_t))
-        {
-          *ptr++ = STACK_COLOR;
-        }
-    }
-#endif
-
   /* Move to the stack assigned to us by up_smp_start immediately.  Although
    * we were give a stack pointer at start-up, we don't know where that stack
    * pointer is positioned respect to our memory map.  The only safe option
diff --git a/arch/xtensa/src/esp32s3/esp32s3_cpuidlestack.c b/arch/xtensa/src/esp32s3/esp32s3_cpuidlestack.c
index 142b9d628c..b028abee4d 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_cpuidlestack.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_cpuidlestack.c
@@ -100,6 +100,24 @@ int up_cpu_idlestack(int cpu, struct tcb_s *tcb, size_t stack_size)
   tcb->adj_stack_size  = CPU1_IDLETHREAD_STACKSIZE;
   tcb->stack_base_ptr  = tcb->stack_alloc_ptr;
 
+#ifdef CONFIG_STACK_COLORATION
+    {
+      register uint32_t *ptr;
+      register int i;
+
+      /* If stack debug is enabled, then fill the stack with a recognizable
+       * value that we can use later to test for high water marks.
+       */
+
+      for (i = 0, ptr = (uint32_t *)tcb->stack_alloc_ptr;
+           i < tcb->adj_stack_size;
+           i += sizeof(uint32_t))
+        {
+          *ptr++ = STACK_COLOR;
+        }
+    }
+#endif
+
   return OK;
 }
 
diff --git a/arch/xtensa/src/esp32s3/esp32s3_cpustart.c b/arch/xtensa/src/esp32s3/esp32s3_cpustart.c
index 8694f4b620..6c424fb6b5 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_cpustart.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_cpustart.c
@@ -109,24 +109,6 @@ void xtensa_appcpu_start(void)
   struct tcb_s *tcb = this_task();
   register uint32_t sp;
 
-#ifdef CONFIG_STACK_COLORATION
-    {
-      register uint32_t *ptr;
-      register int i;
-
-      /* If stack debug is enabled, then fill the stack with a recognizable
-       * value that we can use later to test for high water marks.
-       */
-
-      for (i = 0, ptr = (uint32_t *)tcb->stack_alloc_ptr;
-           i < tcb->adj_stack_size;
-           i += sizeof(uint32_t))
-        {
-          *ptr++ = STACK_COLOR;
-        }
-    }
-#endif
-
   /* Move to the stack assigned to us by up_smp_start immediately.  Although
    * we were give a stack pointer at start-up, we don't know where that stack
    * pointer is positioned respect to our memory map.  The only safe option