diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-03-23 10:09:53 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-03-23 10:09:53 -0600 |
commit | 73a64bf3f0d7d33e2a9c71d876348bd6f1905316 (patch) | |
tree | 0519707f12ede1df73a11b71b67c62b56d25aba5 /nuttx/arch/avr | |
parent | 8387698219e88e00c5952902c1e871d53f82be91 (diff) | |
download | nuttx-73a64bf3f0d7d33e2a9c71d876348bd6f1905316.tar.gz nuttx-73a64bf3f0d7d33e2a9c71d876348bd6f1905316.tar.bz2 nuttx-73a64bf3f0d7d33e2a9c71d876348bd6f1905316.zip |
Clean-up AVR stack colorization logic
Diffstat (limited to 'nuttx/arch/avr')
-rw-r--r-- | nuttx/arch/avr/Kconfig | 1 | ||||
-rw-r--r-- | nuttx/arch/avr/src/avr/up_createstack.c | 2 | ||||
-rw-r--r-- | nuttx/arch/avr/src/avr/up_usestack.c | 2 | ||||
-rw-r--r-- | nuttx/arch/avr/src/avr32/up_createstack.c | 2 | ||||
-rw-r--r-- | nuttx/arch/avr/src/avr32/up_usestack.c | 8 | ||||
-rw-r--r-- | nuttx/arch/avr/src/common/up_internal.h | 8 |
6 files changed, 20 insertions, 3 deletions
diff --git a/nuttx/arch/avr/Kconfig b/nuttx/arch/avr/Kconfig index 7e4b74a54..917653fdc 100644 --- a/nuttx/arch/avr/Kconfig +++ b/nuttx/arch/avr/Kconfig @@ -32,6 +32,7 @@ endchoice config ARCH_FAMILY_AVR bool default n + select ARCH_HAVE_STACKCHECK config ARCH_FAMILY_AVR32 bool diff --git a/nuttx/arch/avr/src/avr/up_createstack.c b/nuttx/arch/avr/src/avr/up_createstack.c index e82473ef0..521213126 100644 --- a/nuttx/arch/avr/src/avr/up_createstack.c +++ b/nuttx/arch/avr/src/avr/up_createstack.c @@ -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 diff --git a/nuttx/arch/avr/src/avr/up_usestack.c b/nuttx/arch/avr/src/avr/up_usestack.c index 629ad6cf0..cb19ed241 100644 --- a/nuttx/arch/avr/src/avr/up_usestack.c +++ b/nuttx/arch/avr/src/avr/up_usestack.c @@ -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 diff --git a/nuttx/arch/avr/src/avr32/up_createstack.c b/nuttx/arch/avr/src/avr32/up_createstack.c index f6e1ab635..f9968d555 100644 --- a/nuttx/arch/avr/src/avr32/up_createstack.c +++ b/nuttx/arch/avr/src/avr32/up_createstack.c @@ -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 diff --git a/nuttx/arch/avr/src/avr32/up_usestack.c b/nuttx/arch/avr/src/avr32/up_usestack.c index e71be16e7..f606ff385 100644 --- a/nuttx/arch/avr/src/avr32/up_usestack.c +++ b/nuttx/arch/avr/src/avr32/up_usestack.c @@ -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 diff --git a/nuttx/arch/avr/src/common/up_internal.h b/nuttx/arch/avr/src/common/up_internal.h index 77d75afeb..75c9e5cb1 100644 --- a/nuttx/arch/avr/src/common/up_internal.h +++ b/nuttx/arch/avr/src/common/up_internal.h @@ -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 ****************************************************************************/ |