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/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 72acec7275 esp32s3: Fix faulty `esp32s3-devkit:stack` example
72acec7275 is described below

commit 72acec7275046fab63c2acc9598f0b4d4510af63
Author: Tiago Medicci Serrano <[email protected]>
AuthorDate: Fri Sep 20 14:28:46 2024 -0300

    esp32s3: Fix faulty `esp32s3-devkit:stack` example
    
    This defconfig is an example of the recorded stack and it became
    faulty recently after the implementation of the `up_current_regs`
    functions. The `noinstrument_function` directive must be used for
    preventing it from being looped when instrumentation is enabled.
    Also, this commit places `sched/instrument/stack_record.c` in IRAM.
---
 arch/xtensa/include/irq.h                                    | 5 +++--
 boards/xtensa/esp32s3/common/scripts/legacy_sections.ld      | 1 +
 boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld     | 1 +
 boards/xtensa/esp32s3/common/scripts/simple_boot_sections.ld | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/include/irq.h b/arch/xtensa/include/irq.h
index 6e5d77bd30..21ce8f20f4 100644
--- a/arch/xtensa/include/irq.h
+++ b/arch/xtensa/include/irq.h
@@ -429,11 +429,12 @@ int up_cpu_index(void);
 #  define up_cpu_index() (0)
 #endif
 
-static inline_function uint32_t *up_current_regs(void)
+noinstrument_function static inline_function uint32_t *up_current_regs(void)
 {
   return (uint32_t *)g_current_regs[up_cpu_index()];
 }
 
+noinstrument_function
 static inline_function void up_set_current_regs(uint32_t *regs)
 {
   g_current_regs[up_cpu_index()] = regs;
@@ -449,7 +450,7 @@ static inline_function void up_set_current_regs(uint32_t 
*regs)
  ****************************************************************************/
 
 #ifndef __ASSEMBLY__
-noinstrument_function static inline bool up_interrupt_context(void)
+noinstrument_function static inline_function bool up_interrupt_context(void)
 {
 #ifdef CONFIG_SMP
   irqstate_t flags = up_irq_save();
diff --git a/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld 
b/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld
index a09e99aa00..9a00ed9183 100644
--- a/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld
+++ b/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld
@@ -102,6 +102,7 @@ SECTIONS
     *libsched.a:sched_suspendscheduler.*(.literal .text .literal.* .text.*)
     *libsched.a:sched_thistask.*(.literal .text .literal.* .text.*)
     *libsched.a:spinlock.*(.literal .text .literal.* .text.*)
+    *libsched.a:stack_record.*(.literal .text .literal.* .text.*)
 
     *libc.a:*lib_instrument.*(.literal .text .literal.* .text.*)
 
diff --git a/boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld 
b/boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld
index 68398759b0..38daf32cee 100644
--- a/boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld
+++ b/boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld
@@ -210,6 +210,7 @@ SECTIONS
     *libsched.a:sched_suspendscheduler.*(.literal .text .literal.* .text.*)
     *libsched.a:sched_thistask.*(.literal .text .literal.* .text.*)
     *libsched.a:spinlock.*(.literal .text .literal.* .text.*)
+    *libsched.a:stack_record.*(.literal .text .literal.* .text.*)
 
 #ifdef CONFIG_ESP32S3_SPEED_UP_ISR
     *libarch.a:xtensa_switchcontext.*(.literal.up_switch_context 
.text.up_switch_context)
diff --git a/boards/xtensa/esp32s3/common/scripts/simple_boot_sections.ld 
b/boards/xtensa/esp32s3/common/scripts/simple_boot_sections.ld
index fb98660c36..cdae1e4e5f 100644
--- a/boards/xtensa/esp32s3/common/scripts/simple_boot_sections.ld
+++ b/boards/xtensa/esp32s3/common/scripts/simple_boot_sections.ld
@@ -104,6 +104,7 @@ SECTIONS
     *libsched.a:sched_thistask.*(.literal .text .literal.* .text.*)
     *libsched.a:spinlock.*(.literal .text .literal.* .text.*)
     *libsched.a:*sched_get_stackinfo.*(.literal .text .literal.* .text.*)
+    *libsched.a:stack_record.*(.literal .text .literal.* .text.*)
 
 #ifdef CONFIG_ESP32S3_SPEED_UP_ISR
     *libarch.a:xtensa_switchcontext.*(.literal.up_switch_context 
.text.up_switch_context)

Reply via email to