Add CONFIG_STACK_COLORATION that does the same thing as CONFIG_DEBUG_STACK but without enabling debug. From David Sidrane

This commit is contained in:
Gregory Nutt 2015-01-24 06:03:39 -06:00
parent 16f72b3470
commit e8f266001d
46 changed files with 138 additions and 58 deletions

View File

@ -119,6 +119,10 @@ CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
CMN_CSRCS += arm_copyarmstate.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -165,8 +165,7 @@ void up_irqinitialize(void)
}
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_DEBUG_STACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),

View File

@ -237,7 +237,7 @@ static void up_dumpstate(void)
lldbg("IRQ stack:\n");
lldbg(" base: %08x\n", istackbase);
lldbg(" size: %08x\n", istacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_intstack());
#endif
@ -264,7 +264,7 @@ static void up_dumpstate(void)
lldbg("User stack:\n");
lldbg(" base: %08x\n", ustackbase);
lldbg(" size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
#endif
@ -272,7 +272,7 @@ static void up_dumpstate(void)
lldbg("sp: %08x\n", sp);
lldbg("stack base: %08x\n", ustackbase);
lldbg("stack size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
#endif
#endif

View File

@ -611,7 +611,7 @@ __start:
bl up_boot
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
/* Write a known value to the IDLE thread stack to support stack
* monitoring logic
*/
@ -678,7 +678,7 @@ __start:
.long _edata
#endif
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
.type .Lstkinit, %object
.Lstkinit:
.long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */

View File

@ -128,7 +128,7 @@ __start:
bl board_led_initialize
#endif
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
/* Write a known value to the IDLE thread stack to support stack
* monitoring logic
*/
@ -170,7 +170,7 @@ __start:
.long _edata
#endif
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
.type .Lstkinit, %object
.Lstkinit:
.long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */

View File

@ -243,7 +243,7 @@ static void up_dumpstate(void)
lldbg("IRQ stack:\n");
lldbg(" base: %08x\n", istackbase);
lldbg(" size: %08x\n", istacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_intstack());
#endif
@ -272,7 +272,7 @@ static void up_dumpstate(void)
lldbg("User stack:\n");
lldbg(" base: %08x\n", ustackbase);
lldbg(" size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
#endif
@ -289,7 +289,7 @@ static void up_dumpstate(void)
lldbg("sp: %08x\n", sp);
lldbg("stack base: %08x\n", ustackbase);
lldbg("stack size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
#endif

View File

@ -239,7 +239,7 @@ static void up_dumpstate(void)
lldbg("Interrupt stack:\n");
lldbg(" base: %08x\n", istackbase);
lldbg(" size: %08x\n", istacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_intstack());
#endif
#endif
@ -249,7 +249,7 @@ static void up_dumpstate(void)
lldbg("User stack:\n");
lldbg(" base: %08x\n", ustackbase);
lldbg(" size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
#endif

View File

@ -631,7 +631,7 @@ __start:
bl up_boot
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
/* Write a known value to the IDLE thread stack to support stack
* monitoring logic
*/
@ -748,7 +748,7 @@ arm_data_initialize:
.size .Ldatainit, . -.Ldatainit
#endif
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
.type .Lstkinit, %object
.Lstkinit:
#ifdef CONFIG_BOOT_SDRAM_DATA

View File

@ -675,7 +675,7 @@ __start:
bl up_boot
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
/* Write a known value to the IDLE thread stack to support stack
* monitoring logic
*/
@ -797,7 +797,7 @@ arm_data_initialize:
.long _edata
.size .Ldatainit, . -.Ldatainit
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
.type .Lstkinit, %object
.Lstkinit:
#ifdef CONFIG_BOOT_SDRAM_DATA

View File

@ -248,7 +248,7 @@ static void up_dumpstate(void)
lldbg("IRQ stack:\n");
lldbg(" base: %08x\n", istackbase);
lldbg(" size: %08x\n", istacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_intstack());
#endif
@ -277,7 +277,7 @@ static void up_dumpstate(void)
lldbg("User stack:\n");
lldbg(" base: %08x\n", ustackbase);
lldbg(" size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
#endif
@ -297,7 +297,7 @@ static void up_dumpstate(void)
lldbg("sp: %08x\n", sp);
lldbg("stack base: %08x\n", ustackbase);
lldbg("stack size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
#endif

View File

@ -49,6 +49,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -52,6 +52,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -57,7 +57,7 @@
# undef CONFIG_DEBUG_STACK
#endif
#if defined(CONFIG_DEBUG_STACK)
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
/****************************************************************************
* Public Data
@ -66,6 +66,7 @@
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/****************************************************************************
* Name: do_stackcheck
@ -84,7 +85,7 @@
*
****************************************************************************/
size_t do_stackcheck(uintptr_t alloc, size_t size)
static size_t do_stackcheck(uintptr_t alloc, size_t size)
{
FAR uintptr_t start;
FAR uintptr_t end;
@ -202,4 +203,4 @@ size_t up_check_intstack_remain(void)
}
#endif
#endif /* CONFIG_DEBUG_STACK */
#endif /* CONFIG_DEBUG_STACK || CONFIG_STACK_COLORATION */

View File

@ -162,7 +162,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
if (ttype == TCB_FLAG_TTYPE_KERNEL)
{
#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK)
#if defined(CONFIG_DEBUG) && !(defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION))
tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size);
#else
tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size);
@ -173,7 +173,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
/* Use the user-space allocator if this is a task or pthread */
#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK)
#if defined(CONFIG_DEBUG) && !(defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION))
tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size);
#else
tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size);
@ -230,7 +230,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* water marks.
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
#if (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
#endif
@ -249,7 +249,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)
#if (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
void up_stack_color(FAR void *stackbase, size_t nbytes)
{
/* Take extra care that we do not write outsize the stack boundaries */

View File

@ -96,7 +96,7 @@ static void up_calibratedelay(void)
*
****************************************************************************/
#if defined(CONFIG_DEBUG_STACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3
static inline void up_color_intstack(void)
{
uint32_t *ptr = (uint32_t *)&g_intstackalloc;

View File

@ -519,8 +519,7 @@ void up_rnginitialize(void);
#endif
/* Debug ********************************************************************/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
#if (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
void up_stack_color(FAR void *stackbase, size_t nbytes);
#endif

View File

@ -50,6 +50,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -71,6 +71,10 @@ CMN_UASRCS += up_signal_handler.S
endif
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -353,7 +353,7 @@ void up_irqinitialize(void)
#endif
#endif
#if defined(CONFIG_DEBUG_STACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3
/* Colorize the interrupt stack for debug purposes */
{

View File

@ -68,7 +68,7 @@
#ifdef CONFIG_ARCH_FPU
static inline void efm32_fpuconfig(void);
#endif
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
static void go_os_start(void *pv, unsigned int nbytes)
__attribute__ ((naked,no_instrument_function,noreturn));
#endif
@ -195,7 +195,7 @@ static inline void efm32_fpuconfig(void)
*
****************************************************************************/
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
static void go_os_start(void *pv, unsigned int nbytes)
{
/* Set the IDLE stack to the stack coloration value then jump to
@ -301,7 +301,7 @@ void __start(void)
showprogress('\r');
showprogress('\n');
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
/* Set the IDLE stack to the coloration value and jump into os_start() */
go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE);

View File

@ -49,6 +49,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -55,6 +55,10 @@ CMN_UASRCS += up_signal_handler.S
endif
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -54,6 +54,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -58,6 +58,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -55,6 +55,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -68,6 +68,10 @@ CMN_UASRCS += up_signal_handler.S
endif
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -55,6 +55,10 @@ CMN_UASRCS += up_signal_handler.S
endif
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -74,6 +74,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -121,6 +121,10 @@ CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
CMN_CSRCS += arm_copyarmstate.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -427,7 +427,7 @@ void up_irqinitialize(void)
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_DEBUG_STACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),

View File

@ -55,6 +55,10 @@ CMN_UASRCS += up_signal_handler.S
endif
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -79,6 +79,10 @@ CMN_UASRCS += up_signal_handler.S
endif
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -308,7 +308,7 @@ void up_irqinitialize(void)
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_DEBUG_STACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),

View File

@ -65,7 +65,7 @@
#ifdef CONFIG_ARCH_FPU
static inline void stm32_fpuconfig(void);
#endif
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
static void go_os_start(void *pv, unsigned int nbytes)
__attribute__ ((naked,no_instrument_function,noreturn));
#endif
@ -195,8 +195,7 @@ static inline void stm32_fpuconfig(void)
* Set the IDLE stack to the
*
****************************************************************************/
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
static void go_os_start(void *pv, unsigned int nbytes)
{
/* Set the IDLE stack to the stack coloration value then jump to
@ -311,7 +310,7 @@ void __start(void)
showprogress('\r');
showprogress('\n');
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
/* Set the IDLE stack to the coloration value and jump into os_start() */
go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE);

View File

@ -54,6 +54,10 @@ ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -55,6 +55,10 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y)
CMN_ASRCS += up_memcpy.S
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -58,6 +58,10 @@ ifeq ($(CONFIG_AVR_SPI),y)
CMN_CSRCS += up_spi.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -58,6 +58,10 @@ ifeq ($(CONFIG_AVR_SPI),y)
CMN_CSRCS += up_spi.c
endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif

View File

@ -57,7 +57,7 @@
# undef CONFIG_DEBUG_STACK
#endif
#if defined(CONFIG_DEBUG_STACK)
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
/****************************************************************************
* Public Data
@ -67,6 +67,8 @@
* Private Functions
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/****************************************************************************
* Name: do_stackcheck
*
@ -84,7 +86,7 @@
*
****************************************************************************/
size_t do_stackcheck(uintptr_t alloc, size_t size)
static size_t do_stackcheck(uintptr_t alloc, size_t size)
{
FAR uint8_t *ptr;
size_t mark;
@ -197,4 +199,4 @@ size_t up_check_intstack_remain(void)
}
#endif
#endif /* CONFIG_DEBUG_STACK */
#endif /* CONFIG_DEBUG_STACK || CONFIG_STACK_COLORATION */

View File

@ -120,7 +120,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* then create a zeroed stack to make stack dumps easier to trace.
*/
#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK)
#if defined(CONFIG_DEBUG) && !(defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION))
tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size);
#else
tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size);
@ -147,7 +147,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* water marks.
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
#if (defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION))
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
#endif

View File

@ -208,7 +208,7 @@ void up_dumpstate(void)
lldbg("IRQ stack:\n");
lldbg(" base: %04x\n", istackbase);
lldbg(" size: %04x\n", istacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_intstack());
#endif
@ -237,7 +237,7 @@ void up_dumpstate(void)
lldbg("User stack:\n");
lldbg(" base: %04x\n", ustackbase);
lldbg(" size: %04x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
#endif
@ -253,7 +253,7 @@ void up_dumpstate(void)
lldbg("sp: %04x\n", sp);
lldbg("stack base: %04x\n", ustackbase);
lldbg("stack size: %04x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
#endif

View File

@ -111,7 +111,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
* that we can use later to test for high water marks.
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
#if (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION))
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
#endif

View File

@ -129,7 +129,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
if (ttype == TCB_FLAG_TTYPE_KERNEL)
{
#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK)
#if defined(CONFIG_DEBUG) && !(defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION))
tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size);
#else
tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size);
@ -140,7 +140,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
/* Use the user-space allocator if this is a task or pthread */
#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK)
#if defined(CONFIG_DEBUG) && !(defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION))
tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size);
#else
tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size);
@ -169,7 +169,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* water marks.
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
#if (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
#endif

View File

@ -185,7 +185,7 @@ void up_dumpstate(void)
lldbg("IRQ stack:\n");
lldbg(" base: %08x\n", istackbase);
lldbg(" size: %08x\n", istacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_intstack());
#endif
@ -214,7 +214,7 @@ void up_dumpstate(void)
lldbg("User stack:\n");
lldbg(" base: %08x\n", ustackbase);
lldbg(" size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
#endif
@ -230,7 +230,7 @@ void up_dumpstate(void)
lldbg("sp: %08x\n", sp);
lldbg("stack base: %08x\n", ustackbase);
lldbg("stack size: %08x\n", ustacksize);
#ifdef CONFIG_DEBUG_STACK
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
#endif

View File

@ -111,7 +111,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
* that we can use later to test for high water marks.
*/
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
#if (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
#endif

View File

@ -141,7 +141,7 @@ static void up_calibratedelay(void)
*
****************************************************************************/
#if defined(CONFIG_DEBUG_STACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3
static inline void up_color_intstack(void)
{
uint8_t *ptr = (uint8_t *)&g_intstackalloc;