From 56ecd44f63d0822965a33f2452bcef644ab66b71 Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Thu, 21 Apr 2022 16:17:06 +0200 Subject: [PATCH] arch/xtensa: Color the other CPUs task when they are created. Signed-off-by: Abdelatif Guettouche --- 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