1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 06:12:43 +01:00

core: thread_measure_stack_free() is only useful for DEVELHELP

This commit is contained in:
René Kijewski 2014-06-06 01:59:41 +02:00
parent 9e3830a72b
commit f7bdc7e4fe
2 changed files with 6 additions and 0 deletions

View File

@ -130,6 +130,7 @@ int thread_wakeup(kernel_pid_t pid);
*/
kernel_pid_t thread_getpid(void);
#ifdef DEVELHELP
/**
* @brief Measures the stack usage of a stack
*
@ -140,6 +141,7 @@ kernel_pid_t thread_getpid(void);
* @return the amount of unused space of the thread's stack
*/
int thread_measure_stack_free(char *stack);
#endif
/* @} */
#endif /* __THREAD_H */

View File

@ -92,6 +92,7 @@ int thread_wakeup(kernel_pid_t pid)
}
}
#ifdef DEVELHELP
int thread_measure_stack_free(char *stack)
{
unsigned int *stackp = (unsigned int *)stack;
@ -105,6 +106,7 @@ int thread_measure_stack_free(char *stack)
int space_free = (unsigned int)stackp - (unsigned int)stack;
return space_free;
}
#endif
kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags, void *(*function)(void *arg), void *arg, const char *name)
{
@ -133,6 +135,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
return -EINVAL;
}
#ifdef DEVELHELP
if (flags & CREATE_STACKTEST) {
/* assign each int of the stack the value of it's address */
unsigned int *stackmax = (unsigned int *)((char *)stack + stacksize);
@ -147,6 +150,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
/* create stack guard */
*stack = (unsigned int)stack;
}
#endif
if (!inISR()) {
dINT();