Clean-up AVR stack colorization logic

This commit is contained in:
Gregory Nutt 2014-03-23 10:09:53 -06:00
parent 82c9694c5b
commit c41976f23c
6 changed files with 20 additions and 3 deletions

View File

@ -32,6 +32,7 @@ endchoice
config ARCH_FAMILY_AVR
bool
default n
select ARCH_HAVE_STACKCHECK
config ARCH_FAMILY_AVR32
bool

View File

@ -170,7 +170,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
#endif
/* The AVR uses a push-down stack: the stack grows toward lower

View File

@ -112,7 +112,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
#endif
/* The AVR uses a push-down stack: the stack grows toward loweraddresses in

View File

@ -170,7 +170,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
memset(tcb->stack_alloc_ptr, 0xaa, stack_size);
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
#endif
/* The AVR32 uses a push-down stack: the stack grows toward lower

View File

@ -107,6 +107,14 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
/* If stack debug is enabled, then fill the stack with a recognizable value
* that we can use later to test for high water marks.
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
#endif
/* The AVR32 uses a push-down stack: the stack grows
* toward loweraddresses in memory. The stack pointer
* register, points to the lowest, valid work address

View File

@ -73,6 +73,14 @@
# define CONFIG_ARCH_INTERRUPTSTACK 0
#endif
/* This is the value used to mark the stack for subsequent stack monitoring
* logic.
*/
#define STACK_COLOR 's'
#define INTSTACK_COLOR 's'
#define HEAP_COLOR 'h'
/****************************************************************************
* Public Types
****************************************************************************/