core: make SCHED_TEST_STACK boolean and default to 1 with DEVELHELP
This commit is contained in:
parent
1fa8bcc9d2
commit
f08989a3c8
@ -119,6 +119,15 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define PRIkernel_pid PRIi16
|
#define PRIkernel_pid PRIi16
|
||||||
|
|
||||||
|
#if defined(DEVELHELP) || defined(DOXYGEN)
|
||||||
|
/**
|
||||||
|
* Enables detection of stack overflows and measures stack usage when != 0
|
||||||
|
*/
|
||||||
|
#ifndef SCHED_TEST_STACK
|
||||||
|
#define SCHED_TEST_STACK 1
|
||||||
|
#endif /* SCHED_TEST_STACK */
|
||||||
|
#endif /* DEVELHELP */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique process identifier
|
* Unique process identifier
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -193,7 +193,7 @@ struct _thread {
|
|||||||
msg_t *msg_array; /**< memory holding messages sent
|
msg_t *msg_array; /**< memory holding messages sent
|
||||||
to this thread's message queue */
|
to this thread's message queue */
|
||||||
#endif
|
#endif
|
||||||
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK) \
|
#if defined(DEVELHELP) || IS_ACTIVE(SCHED_TEST_STACK) \
|
||||||
|| defined(MODULE_MPU_STACK_GUARD) || defined(DOXYGEN)
|
|| defined(MODULE_MPU_STACK_GUARD) || defined(DOXYGEN)
|
||||||
char *stack_start; /**< thread's stack start address */
|
char *stack_start; /**< thread's stack start address */
|
||||||
#endif
|
#endif
|
||||||
@ -545,7 +545,7 @@ const char *thread_state_to_string(thread_status_t state);
|
|||||||
*/
|
*/
|
||||||
static inline void *thread_get_stackstart(const thread_t *thread)
|
static inline void *thread_get_stackstart(const thread_t *thread)
|
||||||
{
|
{
|
||||||
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK) \
|
#if defined(DEVELHELP) || IS_ACTIVE(SCHED_TEST_STACK) \
|
||||||
|| defined(MODULE_MPU_STACK_GUARD)
|
|| defined(MODULE_MPU_STACK_GUARD)
|
||||||
return thread->stack_start;
|
return thread->stack_start;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -119,7 +119,7 @@ static void _unschedule(thread_t *active_thread)
|
|||||||
active_thread->status = STATUS_PENDING;
|
active_thread->status = STATUS_PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SCHED_TEST_STACK
|
#if IS_ACTIVE(SCHED_TEST_STACK)
|
||||||
if (*((uintptr_t *)active_thread->stack_start) !=
|
if (*((uintptr_t *)active_thread->stack_start) !=
|
||||||
(uintptr_t)active_thread->stack_start) {
|
(uintptr_t)active_thread->stack_start) {
|
||||||
LOG_WARNING(
|
LOG_WARNING(
|
||||||
|
|||||||
@ -233,7 +233,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, uint8_t priority,
|
|||||||
_init_tls(thread->tls);
|
_init_tls(thread->tls);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK)
|
#if defined(DEVELHELP) || IS_ACTIVE(SCHED_TEST_STACK)
|
||||||
if (flags & THREAD_CREATE_STACKTEST) {
|
if (flags & THREAD_CREATE_STACKTEST) {
|
||||||
/* assign each int of the stack the value of it's address. Alignment
|
/* assign each int of the stack the value of it's address. Alignment
|
||||||
* has been handled above, so silence -Wcast-align */
|
* has been handled above, so silence -Wcast-align */
|
||||||
@ -274,7 +274,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, uint8_t priority,
|
|||||||
thread->pid = pid;
|
thread->pid = pid;
|
||||||
thread->sp = thread_stack_init(function, arg, stack, stacksize);
|
thread->sp = thread_stack_init(function, arg, stack, stacksize);
|
||||||
|
|
||||||
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK) || \
|
#if defined(DEVELHELP) || IS_ACTIVE(SCHED_TEST_STACK) || \
|
||||||
defined(MODULE_MPU_STACK_GUARD)
|
defined(MODULE_MPU_STACK_GUARD)
|
||||||
thread->stack_start = stack;
|
thread->stack_start = stack;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -150,7 +150,7 @@ char* thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_sta
|
|||||||
sp = (uint8_t*)(((uintptr_t)(top_of_stack + 1) - XT_STK_FRMSZ - XT_CP_SIZE) & ~0xf);
|
sp = (uint8_t*)(((uintptr_t)(top_of_stack + 1) - XT_STK_FRMSZ - XT_CP_SIZE) & ~0xf);
|
||||||
|
|
||||||
/* Clear whole stack with a known value to assist debugging */
|
/* Clear whole stack with a known value to assist debugging */
|
||||||
#if !defined(DEVELHELP) && !defined(SCHED_TEST_STACK)
|
#if !defined(DEVELHELP) && !IS_ACTIVE(SCHED_TEST_STACK)
|
||||||
/* Unfortunately, this affects thread_measure_stack_free function */
|
/* Unfortunately, this affects thread_measure_stack_free function */
|
||||||
memset(stack_start, 0, stack_size);
|
memset(stack_start, 0, stack_size);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -101,7 +101,7 @@ int main(void)
|
|||||||
P(msg_queue);
|
P(msg_queue);
|
||||||
P(msg_array);
|
P(msg_array);
|
||||||
#endif
|
#endif
|
||||||
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK) || defined(MODULE_MPU_STACK_GUARD)
|
#if defined(DEVELHELP) || IS_ACTIVE(SCHED_TEST_STACK) || defined(MODULE_MPU_STACK_GUARD)
|
||||||
P(stack_start);
|
P(stack_start);
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEVELHELP
|
#ifdef DEVELHELP
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user