1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core: make SCHED_TEST_STACK boolean and default to 1 with DEVELHELP

This commit is contained in:
Martine Lenders 2021-11-03 21:38:22 +01:00
parent 1fa8bcc9d2
commit f08989a3c8
No known key found for this signature in database
GPG Key ID: 2134D77A5336DD80
6 changed files with 16 additions and 7 deletions

View File

@ -119,6 +119,15 @@ extern "C" {
*/
#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
*/

View File

@ -193,7 +193,7 @@ struct _thread {
msg_t *msg_array; /**< memory holding messages sent
to this thread's message queue */
#endif
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK) \
#if defined(DEVELHELP) || IS_ACTIVE(SCHED_TEST_STACK) \
|| defined(MODULE_MPU_STACK_GUARD) || defined(DOXYGEN)
char *stack_start; /**< thread's stack start address */
#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)
{
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK) \
#if defined(DEVELHELP) || IS_ACTIVE(SCHED_TEST_STACK) \
|| defined(MODULE_MPU_STACK_GUARD)
return thread->stack_start;
#else

View File

@ -119,7 +119,7 @@ static void _unschedule(thread_t *active_thread)
active_thread->status = STATUS_PENDING;
}
#ifdef SCHED_TEST_STACK
#if IS_ACTIVE(SCHED_TEST_STACK)
if (*((uintptr_t *)active_thread->stack_start) !=
(uintptr_t)active_thread->stack_start) {
LOG_WARNING(

View File

@ -233,7 +233,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, uint8_t priority,
_init_tls(thread->tls);
#endif
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK)
#if defined(DEVELHELP) || IS_ACTIVE(SCHED_TEST_STACK)
if (flags & THREAD_CREATE_STACKTEST) {
/* assign each int of the stack the value of it's address. Alignment
* 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->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)
thread->stack_start = stack;
#endif

View File

@ -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);
/* 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 */
memset(stack_start, 0, stack_size);
#else

View File

@ -101,7 +101,7 @@ int main(void)
P(msg_queue);
P(msg_array);
#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);
#endif
#ifdef DEVELHELP