summaryrefslogtreecommitdiff
path: root/src/scheduler.c
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-11-11 15:56:02 +0800
committerBernard Xiong <[email protected]>2018-11-11 15:56:02 +0800
commit00a655ac1c24d3707a5af376ec756e42406cd6bb (patch)
tree408adf7686ed80dda45bac17b622e2d36fe4d18a /src/scheduler.c
parentc7a85df1cd19a4c2e1d37483f713ad67dcf4b55f (diff)
[Kernel] Add ARCH_CPU_STACK_GROWS_UPWARD option
Diffstat (limited to 'src/scheduler.c')
-rw-r--r--src/scheduler.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/scheduler.c b/src/scheduler.c
index 95b5d487df..0b8b54ae92 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -91,11 +91,19 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread)
level = rt_hw_interrupt_disable();
while (level);
}
+#if defined(ARCH_CPU_STACK_GROWS_UPWARD)
+ else if ((rt_uint32_t)thread->sp > ((rt_uint32_t)thread->stack_addr + thread->stack_size))
+ {
+ rt_kprintf("warning: %s stack is close to the top of stack address.\n",
+ thread->name);
+ }
+#else
else if ((rt_uint32_t)thread->sp <= ((rt_uint32_t)thread->stack_addr + 32))
{
- rt_kprintf("warning: %s stack is close to end of stack address.\n",
+ rt_kprintf("warning: %s stack is close to the bottom of stack address.\n",
thread->name);
}
+#endif
}
#endif