diff --git a/Kconfig b/Kconfig index 82a3f4b737..6f895eb0fc 100644 --- a/Kconfig +++ b/Kconfig @@ -522,13 +522,6 @@ config DEBUG_PAGING ---help--- Enable demand paging debug SYSLOG output (disabled by default) -config DEBUG_STACK - bool "Stack usage debug hooks" - default n - depends on ARCH_HAVE_STACKCHECK - ---help--- - Enable hooks to check stack usage. Only supported by a few architectures. - comment "Driver Debug Options" config DEBUG_LCD diff --git a/arch/arm/src/a1x/Make.defs b/arch/arm/src/a1x/Make.defs index 177b423fdb..dc7a61b5a1 100644 --- a/arch/arm/src/a1x/Make.defs +++ b/arch/arm/src/a1x/Make.defs @@ -123,10 +123,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - # A1x-specific assembly language files CHIP_ASRCS = diff --git a/arch/arm/src/a1x/a1x_irq.c b/arch/arm/src/a1x/a1x_irq.c index 6dbee9c320..bce61765f5 100644 --- a/arch/arm/src/a1x/a1x_irq.c +++ b/arch/arm/src/a1x/a1x_irq.c @@ -165,7 +165,8 @@ void up_irqinitialize(void) } /* Colorize the interrupt stack for debug purposes */ -#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3 + +#if 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), diff --git a/arch/arm/src/arm/up_assert.c b/arch/arm/src/arm/up_assert.c index 21fe668dc9..c4319b934c 100644 --- a/arch/arm/src/arm/up_assert.c +++ b/arch/arm/src/arm/up_assert.c @@ -76,12 +76,6 @@ # undef CONFIG_ARCH_USBDUMP #endif -/* Check if we can dump stack usage information */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_STACK -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -237,7 +231,7 @@ static void up_dumpstate(void) lldbg("IRQ stack:\n"); lldbg(" base: %08x\n", istackbase); lldbg(" size: %08x\n", istacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_intstack()); #endif @@ -264,7 +258,7 @@ static void up_dumpstate(void) lldbg("User stack:\n"); lldbg(" base: %08x\n", ustackbase); lldbg(" size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_tcbstack(rtcb)); #endif @@ -272,7 +266,7 @@ static void up_dumpstate(void) lldbg("sp: %08x\n", sp); lldbg("stack base: %08x\n", ustackbase); lldbg("stack size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg("stack used: %08x\n", up_check_tcbstack(rtcb)); #endif #endif diff --git a/arch/arm/src/arm/up_head.S b/arch/arm/src/arm/up_head.S index 3f2dc57a8b..b4176823f7 100644 --- a/arch/arm/src/arm/up_head.S +++ b/arch/arm/src/arm/up_head.S @@ -611,7 +611,7 @@ __start: bl up_boot -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef 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 -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION .type .Lstkinit, %object .Lstkinit: .long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */ diff --git a/arch/arm/src/arm/up_nommuhead.S b/arch/arm/src/arm/up_nommuhead.S index ef5608b178..69855c0b09 100644 --- a/arch/arm/src/arm/up_nommuhead.S +++ b/arch/arm/src/arm/up_nommuhead.S @@ -128,7 +128,7 @@ __start: bl board_led_initialize #endif -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef 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 -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION .type .Lstkinit, %object .Lstkinit: .long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */ diff --git a/arch/arm/src/armv6-m/up_assert.c b/arch/arm/src/armv6-m/up_assert.c index a8ccbfe16b..d26a437983 100644 --- a/arch/arm/src/armv6-m/up_assert.c +++ b/arch/arm/src/armv6-m/up_assert.c @@ -75,12 +75,6 @@ # undef CONFIG_ARCH_USBDUMP #endif -/* Check if we can dump stack usage information */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_STACK -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -243,7 +237,7 @@ static void up_dumpstate(void) lldbg("IRQ stack:\n"); lldbg(" base: %08x\n", istackbase); lldbg(" size: %08x\n", istacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_intstack()); #endif @@ -272,7 +266,7 @@ static void up_dumpstate(void) lldbg("User stack:\n"); lldbg(" base: %08x\n", ustackbase); lldbg(" size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_tcbstack(rtcb)); #endif @@ -289,7 +283,7 @@ static void up_dumpstate(void) lldbg("sp: %08x\n", sp); lldbg("stack base: %08x\n", ustackbase); lldbg("stack size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg("stack used: %08x\n", up_check_tcbstack(rtcb)); #endif diff --git a/arch/arm/src/armv7-a/arm_assert.c b/arch/arm/src/armv7-a/arm_assert.c index adcb48f46f..a809f6658c 100644 --- a/arch/arm/src/armv7-a/arm_assert.c +++ b/arch/arm/src/armv7-a/arm_assert.c @@ -74,12 +74,6 @@ # undef CONFIG_ARCH_USBDUMP #endif -/* Check if we can dump stack usage information */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_STACK -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -239,7 +233,7 @@ static void up_dumpstate(void) lldbg("Interrupt stack:\n"); lldbg(" base: %08x\n", istackbase); lldbg(" size: %08x\n", istacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_intstack()); #endif #endif @@ -249,7 +243,7 @@ static void up_dumpstate(void) lldbg("User stack:\n"); lldbg(" base: %08x\n", ustackbase); lldbg(" size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_tcbstack(rtcb)); #endif diff --git a/arch/arm/src/armv7-a/arm_head.S b/arch/arm/src/armv7-a/arm_head.S index 44418de0de..88b1ffee5d 100644 --- a/arch/arm/src/armv7-a/arm_head.S +++ b/arch/arm/src/armv7-a/arm_head.S @@ -631,7 +631,7 @@ __start: bl up_boot -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef 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 -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION .type .Lstkinit, %object .Lstkinit: #ifdef CONFIG_BOOT_SDRAM_DATA diff --git a/arch/arm/src/armv7-a/arm_pghead.S b/arch/arm/src/armv7-a/arm_pghead.S index 1b4f41bf46..3f6abcb5a1 100644 --- a/arch/arm/src/armv7-a/arm_pghead.S +++ b/arch/arm/src/armv7-a/arm_pghead.S @@ -675,7 +675,7 @@ __start: bl up_boot -#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION) +#ifdef 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 -#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION .type .Lstkinit, %object .Lstkinit: #ifdef CONFIG_BOOT_SDRAM_DATA diff --git a/arch/arm/src/armv7-m/up_assert.c b/arch/arm/src/armv7-m/up_assert.c index 6b3b86d59a..eb72b05737 100644 --- a/arch/arm/src/armv7-m/up_assert.c +++ b/arch/arm/src/armv7-m/up_assert.c @@ -74,12 +74,6 @@ # undef CONFIG_ARCH_USBDUMP #endif -/* Check if we can dump stack usage information */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_STACK -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -248,7 +242,7 @@ static void up_dumpstate(void) lldbg("IRQ stack:\n"); lldbg(" base: %08x\n", istackbase); lldbg(" size: %08x\n", istacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_intstack()); #endif @@ -277,7 +271,7 @@ static void up_dumpstate(void) lldbg("User stack:\n"); lldbg(" base: %08x\n", ustackbase); lldbg(" size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_tcbstack(rtcb)); #endif @@ -297,7 +291,7 @@ static void up_dumpstate(void) lldbg("sp: %08x\n", sp); lldbg("stack base: %08x\n", ustackbase); lldbg("stack size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg("stack used: %08x\n", up_check_tcbstack(rtcb)); #endif diff --git a/arch/arm/src/c5471/Make.defs b/arch/arm/src/c5471/Make.defs index 3e20a54a5b..b1c64bed3a 100644 --- a/arch/arm/src/c5471/Make.defs +++ b/arch/arm/src/c5471/Make.defs @@ -53,10 +53,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - CHIP_ASRCS = c5471_lowputc.S c5471_vectors.S CHIP_CSRCS = c5471_irq.c c5471_serial.c c5471_watchdog.c c5471_ethernet.c diff --git a/arch/arm/src/calypso/Make.defs b/arch/arm/src/calypso/Make.defs index 35eb161a8c..07145d0539 100644 --- a/arch/arm/src/calypso/Make.defs +++ b/arch/arm/src/calypso/Make.defs @@ -56,10 +56,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - CHIP_ASRCS = calypso_lowputc.S CHIP_CSRCS = calypso_irq.c calypso_heap.c calypso_serial.c calypso_spi.c CHIP_CSRCS += clock.c calypso_uwire.c calypso_armio.c calypso_keypad.c diff --git a/arch/arm/src/common/up_checkstack.c b/arch/arm/src/common/up_checkstack.c index 006ee535f3..bec4d07dde 100644 --- a/arch/arm/src/common/up_checkstack.c +++ b/arch/arm/src/common/up_checkstack.c @@ -53,11 +53,7 @@ * Pre-processor Definitions ****************************************************************************/ -#if !defined(CONFIG_DEBUG) -# undef CONFIG_DEBUG_STACK -#endif - -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION /**************************************************************************** * Public Data @@ -203,4 +199,4 @@ size_t up_check_intstack_remain(void) } #endif -#endif /* CONFIG_DEBUG_STACK || CONFIG_STACK_COLORATION */ +#endif /* CONFIG_STACK_COLORATION */ diff --git a/arch/arm/src/common/up_createstack.c b/arch/arm/src/common/up_createstack.c index 73bf01b86a..a7a49a9b78 100644 --- a/arch/arm/src/common/up_createstack.c +++ b/arch/arm/src/common/up_createstack.c @@ -162,22 +162,14 @@ 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) || 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); -#endif } else #endif { /* Use the user-space allocator if this is a task or pthread */ -#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); -#endif } #ifdef CONFIG_DEBUG @@ -230,7 +222,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)) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size); #endif @@ -249,7 +241,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)) || defined(CONFIG_STACK_COLORATION) +#ifdef 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 */ diff --git a/arch/arm/src/common/up_initialize.c b/arch/arm/src/common/up_initialize.c index 2ee43572f1..69e1f2cf8a 100644 --- a/arch/arm/src/common/up_initialize.c +++ b/arch/arm/src/common/up_initialize.c @@ -96,7 +96,7 @@ static void up_calibratedelay(void) * ****************************************************************************/ -#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3 +#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3 static inline void up_color_intstack(void) { uint32_t *ptr = (uint32_t *)&g_intstackalloc; diff --git a/arch/arm/src/common/up_internal.h b/arch/arm/src/common/up_internal.h index be261e1179..9c274dcaf1 100644 --- a/arch/arm/src/common/up_internal.h +++ b/arch/arm/src/common/up_internal.h @@ -519,7 +519,7 @@ void up_rnginitialize(void); #endif /* Debug ********************************************************************/ -#if (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION void up_stack_color(FAR void *stackbase, size_t nbytes); #endif diff --git a/arch/arm/src/dm320/Make.defs b/arch/arm/src/dm320/Make.defs index a7d1ff6369..530d70bd22 100644 --- a/arch/arm/src/dm320/Make.defs +++ b/arch/arm/src/dm320/Make.defs @@ -54,10 +54,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - CHIP_ASRCS = dm320_lowputc.S dm320_restart.S CHIP_CSRCS = dm320_allocateheap.c dm320_boot.c dm320_decodeirq.c diff --git a/arch/arm/src/efm32/Make.defs b/arch/arm/src/efm32/Make.defs index c83f165bc3..6a3ebac4ae 100644 --- a/arch/arm/src/efm32/Make.defs +++ b/arch/arm/src/efm32/Make.defs @@ -75,10 +75,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c endif diff --git a/arch/arm/src/efm32/efm32_irq.c b/arch/arm/src/efm32/efm32_irq.c index 6ba7b13bba..3b7c386ef6 100644 --- a/arch/arm/src/efm32/efm32_irq.c +++ b/arch/arm/src/efm32/efm32_irq.c @@ -353,7 +353,7 @@ void up_irqinitialize(void) #endif #endif -#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3 +#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3 /* Colorize the interrupt stack for debug purposes */ { diff --git a/arch/arm/src/efm32/efm32_start.c b/arch/arm/src/efm32/efm32_start.c index be439c27d1..08d0d3bf6d 100644 --- a/arch/arm/src/efm32/efm32_start.c +++ b/arch/arm/src/efm32/efm32_start.c @@ -68,7 +68,7 @@ #ifdef CONFIG_ARCH_FPU static inline void efm32_fpuconfig(void); #endif -#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION) +#ifdef 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) * ****************************************************************************/ -#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION) +#ifdef 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'); -#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION) +#ifdef 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); diff --git a/arch/arm/src/imx/Make.defs b/arch/arm/src/imx/Make.defs index 6a31844a7b..46d16d4148 100644 --- a/arch/arm/src/imx/Make.defs +++ b/arch/arm/src/imx/Make.defs @@ -53,10 +53,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - CHIP_ASRCS = imx_lowputc.S CHIP_CSRCS = imx_boot.c imx_gpio.c imx_allocateheap.c imx_irq.c CHIP_CSRCS += imx_serial.c imx_decodeirq.c imx_spi.c diff --git a/arch/arm/src/kl/Make.defs b/arch/arm/src/kl/Make.defs index 55a8377697..20d5a64f58 100644 --- a/arch/arm/src/kl/Make.defs +++ b/arch/arm/src/kl/Make.defs @@ -59,10 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c endif diff --git a/arch/arm/src/lpc214x/Make.defs b/arch/arm/src/lpc214x/Make.defs index 6d4695d508..364c2c52ee 100644 --- a/arch/arm/src/lpc214x/Make.defs +++ b/arch/arm/src/lpc214x/Make.defs @@ -58,10 +58,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - CHIP_ASRCS = lpc214x_lowputc.S CHIP_CSRCS = lpc214x_decodeirq.c lpc214x_irq.c lpc214x_serial.c diff --git a/arch/arm/src/lpc2378/Make.defs b/arch/arm/src/lpc2378/Make.defs index df38c1c3e3..4df2d7eb3e 100644 --- a/arch/arm/src/lpc2378/Make.defs +++ b/arch/arm/src/lpc2378/Make.defs @@ -62,10 +62,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - CHIP_ASRCS = lpc23xx_lowputc.S CHIP_CSRCS += lpc23xx_pllsetup.c lpc23xx_decodeirq.c lpc23xx_irq.c CHIP_CSRCS += lpc23xx_serial.c lpc23xx_io.c diff --git a/arch/arm/src/lpc31xx/Make.defs b/arch/arm/src/lpc31xx/Make.defs index 45e24630e8..a8bbcb5087 100644 --- a/arch/arm/src/lpc31xx/Make.defs +++ b/arch/arm/src/lpc31xx/Make.defs @@ -59,10 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - CGU_ASRCS = CGU_CSRCS = lpc31_bcrndx.c lpc31_clkdomain.c lpc31_clkexten.c diff --git a/arch/arm/src/lpc43xx/Make.defs b/arch/arm/src/lpc43xx/Make.defs index a55f1d9261..1ab24e84e7 100644 --- a/arch/arm/src/lpc43xx/Make.defs +++ b/arch/arm/src/lpc43xx/Make.defs @@ -72,10 +72,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c endif diff --git a/arch/arm/src/nuc1xx/Make.defs b/arch/arm/src/nuc1xx/Make.defs index 4ba3d6f05c..753322fb34 100644 --- a/arch/arm/src/nuc1xx/Make.defs +++ b/arch/arm/src/nuc1xx/Make.defs @@ -59,10 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c endif diff --git a/arch/arm/src/sam34/Make.defs b/arch/arm/src/sam34/Make.defs index cc439da76e..cfe342e0f9 100644 --- a/arch/arm/src/sam34/Make.defs +++ b/arch/arm/src/sam34/Make.defs @@ -78,10 +78,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - # Required SAM3/4 files CHIP_ASRCS = diff --git a/arch/arm/src/sama5/Make.defs b/arch/arm/src/sama5/Make.defs index dcb62de058..29265802f8 100644 --- a/arch/arm/src/sama5/Make.defs +++ b/arch/arm/src/sama5/Make.defs @@ -125,10 +125,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - # SAMA5-specific assembly language files CHIP_ASRCS = diff --git a/arch/arm/src/sama5/sam_irq.c b/arch/arm/src/sama5/sam_irq.c index 55e2046ed3..8c39503ab0 100644 --- a/arch/arm/src/sama5/sam_irq.c +++ b/arch/arm/src/sama5/sam_irq.c @@ -427,7 +427,7 @@ void up_irqinitialize(void) /* Colorize the interrupt stack for debug purposes */ -#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3 +#if 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), diff --git a/arch/arm/src/samd/Make.defs b/arch/arm/src/samd/Make.defs index 4d13406744..36fd5afbdd 100644 --- a/arch/arm/src/samd/Make.defs +++ b/arch/arm/src/samd/Make.defs @@ -59,10 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c endif diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index 8a3935190b..4369d9d748 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -83,10 +83,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c endif diff --git a/arch/arm/src/stm32/stm32_irq.c b/arch/arm/src/stm32/stm32_irq.c index 6942ac1dd5..3318caa367 100644 --- a/arch/arm/src/stm32/stm32_irq.c +++ b/arch/arm/src/stm32/stm32_irq.c @@ -308,7 +308,7 @@ void up_irqinitialize(void) /* Colorize the interrupt stack for debug purposes */ -#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3 +#if 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), diff --git a/arch/arm/src/stm32/stm32_start.c b/arch/arm/src/stm32/stm32_start.c index d9bc5d3b2b..df155392f3 100644 --- a/arch/arm/src/stm32/stm32_start.c +++ b/arch/arm/src/stm32/stm32_start.c @@ -65,7 +65,7 @@ #ifdef CONFIG_ARCH_FPU static inline void stm32_fpuconfig(void); #endif -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION static void go_os_start(void *pv, unsigned int nbytes) __attribute__ ((naked,no_instrument_function,noreturn)); #endif @@ -195,7 +195,8 @@ static inline void stm32_fpuconfig(void) * Set the IDLE stack to the * ****************************************************************************/ -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) + +#ifdef 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 @@ -310,7 +311,7 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef 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); diff --git a/arch/arm/src/str71x/Make.defs b/arch/arm/src/str71x/Make.defs index 41ee1144eb..00ce4a3625 100644 --- a/arch/arm/src/str71x/Make.defs +++ b/arch/arm/src/str71x/Make.defs @@ -58,10 +58,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - CHIP_ASRCS = CHIP_CSRCS = str71x_prccu.c str71x_lowputc.c str71x_decodeirq.c str71x_irq.c CHIP_CSRCS += str71x_serial.c diff --git a/arch/arm/src/tiva/Make.defs b/arch/arm/src/tiva/Make.defs index 2d9773d89c..fc43be2344 100644 --- a/arch/arm/src/tiva/Make.defs +++ b/arch/arm/src/tiva/Make.defs @@ -59,10 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/avr/src/at90usb/Make.defs b/arch/avr/src/at90usb/Make.defs index a7e1526ac3..50245c338a 100644 --- a/arch/avr/src/at90usb/Make.defs +++ b/arch/avr/src/at90usb/Make.defs @@ -62,10 +62,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_ARCH_ROMGETC),y) CMN_CSRCS += up_romgetc.c endif diff --git a/arch/avr/src/atmega/Make.defs b/arch/avr/src/atmega/Make.defs index e61ef3ecc6..c2d679b7db 100644 --- a/arch/avr/src/atmega/Make.defs +++ b/arch/avr/src/atmega/Make.defs @@ -62,10 +62,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) -CMN_CSRCS += up_checkstack.c -endif - ifeq ($(CONFIG_ARCH_ROMGETC),y) CMN_CSRCS += up_romgetc.c endif diff --git a/arch/avr/src/avr/up_checkstack.c b/arch/avr/src/avr/up_checkstack.c index da7697be4d..eb5f22d744 100644 --- a/arch/avr/src/avr/up_checkstack.c +++ b/arch/avr/src/avr/up_checkstack.c @@ -53,11 +53,7 @@ * Pre-processor Definitions ****************************************************************************/ -#if !defined(CONFIG_DEBUG) -# undef CONFIG_DEBUG_STACK -#endif - -#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION /**************************************************************************** * Public Data @@ -199,4 +195,4 @@ size_t up_check_intstack_remain(void) } #endif -#endif /* CONFIG_DEBUG_STACK || CONFIG_STACK_COLORATION */ +#endif /* CONFIG_STACK_COLORATION */ diff --git a/arch/avr/src/avr/up_createstack.c b/arch/avr/src/avr/up_createstack.c index ff3d26d01f..0b5e4ab939 100644 --- a/arch/avr/src/avr/up_createstack.c +++ b/arch/avr/src/avr/up_createstack.c @@ -120,11 +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) || 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); -#endif #ifdef CONFIG_DEBUG /* Was the allocation successful? */ @@ -147,7 +143,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * water marks. */ -#if (defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size); #endif diff --git a/arch/avr/src/avr/up_dumpstate.c b/arch/avr/src/avr/up_dumpstate.c index 1049c1fac6..1f77c899a6 100644 --- a/arch/avr/src/avr/up_dumpstate.c +++ b/arch/avr/src/avr/up_dumpstate.c @@ -65,12 +65,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Check if we can dump stack usage information */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_STACK -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -208,7 +202,7 @@ void up_dumpstate(void) lldbg("IRQ stack:\n"); lldbg(" base: %04x\n", istackbase); lldbg(" size: %04x\n", istacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_intstack()); #endif @@ -237,7 +231,7 @@ void up_dumpstate(void) lldbg("User stack:\n"); lldbg(" base: %04x\n", ustackbase); lldbg(" size: %04x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_tcbstack(rtcb)); #endif @@ -253,7 +247,7 @@ void up_dumpstate(void) lldbg("sp: %04x\n", sp); lldbg("stack base: %04x\n", ustackbase); lldbg("stack size: %04x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg("stack used: %08x\n", up_check_tcbstack(rtcb)); #endif diff --git a/arch/avr/src/avr/up_usestack.c b/arch/avr/src/avr/up_usestack.c index 7113971a47..84817e356a 100644 --- a/arch/avr/src/avr/up_usestack.c +++ b/arch/avr/src/avr/up_usestack.c @@ -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)) || defined(CONFIG_STACK_COLORATION)) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size); #endif diff --git a/arch/avr/src/avr32/up_createstack.c b/arch/avr/src/avr32/up_createstack.c index be5e37e7ec..2956dd4516 100644 --- a/arch/avr/src/avr32/up_createstack.c +++ b/arch/avr/src/avr32/up_createstack.c @@ -129,22 +129,14 @@ 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) || 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); -#endif } else #endif { /* Use the user-space allocator if this is a task or pthread */ -#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); -#endif } #ifdef CONFIG_DEBUG @@ -169,7 +161,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)) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size); #endif diff --git a/arch/avr/src/avr32/up_dumpstate.c b/arch/avr/src/avr32/up_dumpstate.c index 6884a037de..4bba418b84 100644 --- a/arch/avr/src/avr32/up_dumpstate.c +++ b/arch/avr/src/avr32/up_dumpstate.c @@ -65,12 +65,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Check if we can dump stack usage information */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_STACK -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -185,7 +179,7 @@ void up_dumpstate(void) lldbg("IRQ stack:\n"); lldbg(" base: %08x\n", istackbase); lldbg(" size: %08x\n", istacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_intstack()); #endif @@ -214,7 +208,7 @@ void up_dumpstate(void) lldbg("User stack:\n"); lldbg(" base: %08x\n", ustackbase); lldbg(" size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg(" used: %08x\n", up_check_tcbstack(rtcb)); #endif @@ -230,7 +224,7 @@ void up_dumpstate(void) lldbg("sp: %08x\n", sp); lldbg("stack base: %08x\n", ustackbase); lldbg("stack size: %08x\n", ustacksize); -#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION lldbg("stack used: %08x\n", up_check_tcbstack(rtcb)); #endif diff --git a/arch/avr/src/avr32/up_usestack.c b/arch/avr/src/avr32/up_usestack.c index 5c43c54d65..8e7f398c06 100644 --- a/arch/avr/src/avr32/up_usestack.c +++ b/arch/avr/src/avr32/up_usestack.c @@ -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)) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size); #endif diff --git a/arch/avr/src/common/up_initialize.c b/arch/avr/src/common/up_initialize.c index 92297d066b..991e0a0849 100644 --- a/arch/avr/src/common/up_initialize.c +++ b/arch/avr/src/common/up_initialize.c @@ -141,7 +141,7 @@ static void up_calibratedelay(void) * ****************************************************************************/ -#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3 +#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3 static inline void up_color_intstack(void) { uint8_t *ptr = (uint8_t *)&g_intstackalloc; diff --git a/arch/hc/src/common/up_createstack.c b/arch/hc/src/common/up_createstack.c index 50c2c4626d..21bbe76902 100644 --- a/arch/hc/src/common/up_createstack.c +++ b/arch/hc/src/common/up_createstack.c @@ -126,22 +126,14 @@ 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) - tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size); -#endif } else #endif { /* Use the user-space allocator if this is a task or pthread */ -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size); -#endif } #ifdef CONFIG_DEBUG @@ -166,7 +158,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) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, 0xaa, stack_size); #endif diff --git a/arch/mips/src/common/up_createstack.c b/arch/mips/src/common/up_createstack.c index 36754d5462..a5f4483ca0 100644 --- a/arch/mips/src/common/up_createstack.c +++ b/arch/mips/src/common/up_createstack.c @@ -147,22 +147,14 @@ 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) - tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size); -#endif } else #endif { /* Use the user-space allocator if this is a task or pthread */ -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size); -#endif } #ifdef CONFIG_DEBUG @@ -187,7 +179,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) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, 0xaa, stack_size); #endif diff --git a/arch/sh/src/common/up_createstack.c b/arch/sh/src/common/up_createstack.c index 52e311b765..c36dcaa769 100644 --- a/arch/sh/src/common/up_createstack.c +++ b/arch/sh/src/common/up_createstack.c @@ -126,22 +126,14 @@ 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) - tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size); -#endif } else #endif { /* Use the user-space allocator if this is a task or pthread */ -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size); -#endif } #ifdef CONFIG_DEBUG @@ -166,7 +158,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) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, 0xaa, stack_size); #endif diff --git a/arch/x86/src/i486/up_createstack.c b/arch/x86/src/i486/up_createstack.c index a0731d9f79..167b4a7d59 100644 --- a/arch/x86/src/i486/up_createstack.c +++ b/arch/x86/src/i486/up_createstack.c @@ -128,22 +128,14 @@ 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) - tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size); -#endif } else #endif { /* Use the user-space allocator if this is a task or pthread */ -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size); -#endif } #ifdef CONFIG_DEBUG @@ -168,7 +160,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) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, 0xaa, stack_size); #endif diff --git a/arch/z16/src/common/up_createstack.c b/arch/z16/src/common/up_createstack.c index 42df4d0c2f..4930785805 100644 --- a/arch/z16/src/common/up_createstack.c +++ b/arch/z16/src/common/up_createstack.c @@ -117,11 +117,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) - tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size); -#endif #ifdef CONFIG_DEBUG /* Was the allocation successful? */ @@ -145,7 +141,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) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, 0xaa, stack_size); #endif diff --git a/arch/z80/src/common/up_createstack.c b/arch/z80/src/common/up_createstack.c index 96119a7e89..25bd615f90 100644 --- a/arch/z80/src/common/up_createstack.c +++ b/arch/z80/src/common/up_createstack.c @@ -126,22 +126,14 @@ 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) - tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size); -#endif } else #endif { /* Use the user-space allocator if this is a task or pthread */ -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size); -#else tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size); -#endif } #ifdef CONFIG_DEBUG @@ -166,7 +158,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) +#ifdef CONFIG_STACK_COLORATION memset(tcb->stack_alloc_ptr, 0xaa, stack_size); #endif diff --git a/configs/spark/README.txt b/configs/spark/README.txt index 334a2edb59..67f2472836 100644 --- a/configs/spark/README.txt +++ b/configs/spark/README.txt @@ -548,7 +548,7 @@ Configurations in the top level Make.degs or the code will not fit. Stack space has been hand optimized using the stack coloring by enabling - "Stack usage debug hooks" (CONFIG_DEBUG_STACK) in Build Setup-> Debug + "Stack coloration" (CONFIG_STACK_COLORATION) in Build Setup-> Debug Options. I have selected values that have 8-16 bytes of headroom with network debugging on. If you enable more debugging and get a hard fault or any weirdness like commands hanging. Then the Idle, main or Interrupt diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c index cd39762862..071ace89fd 100644 --- a/fs/procfs/fs_procfsproc.c +++ b/fs/procfs/fs_procfsproc.c @@ -631,7 +631,7 @@ static ssize_t proc_stack(FAR struct proc_file_s *procfile, buffer += copysize; remaining -= copysize; -#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK) +#ifdef CONFIG_DEBUG_COLORATION if (totalsize >= buflen) { return totalsize; diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 987e67dff9..a703d2806c 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -1729,7 +1729,7 @@ void irq_dispatch(int irq, FAR void *context); * ****************************************************************************/ -#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION) +#ifdef CONFIG_STACK_COLORATION struct tcb_s; size_t up_check_tcbstack(FAR struct tcb_s *tcb); ssize_t up_check_tcbstack_remain(FAR struct tcb_s *tcb); diff --git a/tools/mkconfig.c b/tools/mkconfig.c index d21930101c..93dc7e3149 100644 --- a/tools/mkconfig.c +++ b/tools/mkconfig.c @@ -269,7 +269,6 @@ int main(int argc, char **argv, char **envp) printf("# undef CONFIG_DEBUG_GRAPHICS\n"); printf("# undef CONFIG_DEBUG_GPIO\n"); printf("# undef CONFIG_DEBUG_SPI\n"); - printf("# undef CONFIG_DEBUG_STACK\n"); printf("# undef CONFIG_DEBUG_HEAP\n"); printf("#endif\n\n"); printf("/* User entry point. This is provided as a fall-back to keep compatibility\n");