Skip to content

Commit

Permalink
esp32s3: Fix faulty esp32s3-devkit:stack example
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tmedicci authored and xiaoxiang781216 committed Sep 21, 2024
1 parent 2b59a0a commit 72acec7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/xtensa/include/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions boards/xtensa/esp32s3/common/scripts/legacy_sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -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.*)

Expand Down
1 change: 1 addition & 0 deletions boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 72acec7

Please sign in to comment.