mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
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:
@@ -119,6 +119,10 @@ CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
|
|||||||
CMN_CSRCS += arm_copyarmstate.c
|
CMN_CSRCS += arm_copyarmstate.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -165,8 +165,7 @@ void up_irqinitialize(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
/* Colorize the interrupt stack for debug purposes */
|
||||||
|
#if (defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||||
#if defined(CONFIG_DEBUG_STACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
{
|
{
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("IRQ stack:\n");
|
lldbg("IRQ stack:\n");
|
||||||
lldbg(" base: %08x\n", istackbase);
|
lldbg(" base: %08x\n", istackbase);
|
||||||
lldbg(" size: %08x\n", istacksize);
|
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());
|
lldbg(" used: %08x\n", up_check_intstack());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("User stack:\n");
|
lldbg("User stack:\n");
|
||||||
lldbg(" base: %08x\n", ustackbase);
|
lldbg(" base: %08x\n", ustackbase);
|
||||||
lldbg(" size: %08x\n", ustacksize);
|
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));
|
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("sp: %08x\n", sp);
|
lldbg("sp: %08x\n", sp);
|
||||||
lldbg("stack base: %08x\n", ustackbase);
|
lldbg("stack base: %08x\n", ustackbase);
|
||||||
lldbg("stack size: %08x\n", ustacksize);
|
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));
|
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ __start:
|
|||||||
|
|
||||||
bl up_boot
|
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
|
/* Write a known value to the IDLE thread stack to support stack
|
||||||
* monitoring logic
|
* monitoring logic
|
||||||
*/
|
*/
|
||||||
@@ -678,7 +678,7 @@ __start:
|
|||||||
.long _edata
|
.long _edata
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
|
||||||
.type .Lstkinit, %object
|
.type .Lstkinit, %object
|
||||||
.Lstkinit:
|
.Lstkinit:
|
||||||
.long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */
|
.long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ __start:
|
|||||||
bl board_led_initialize
|
bl board_led_initialize
|
||||||
#endif
|
#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
|
/* Write a known value to the IDLE thread stack to support stack
|
||||||
* monitoring logic
|
* monitoring logic
|
||||||
*/
|
*/
|
||||||
@@ -170,7 +170,7 @@ __start:
|
|||||||
.long _edata
|
.long _edata
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
|
||||||
.type .Lstkinit, %object
|
.type .Lstkinit, %object
|
||||||
.Lstkinit:
|
.Lstkinit:
|
||||||
.long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */
|
.long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("IRQ stack:\n");
|
lldbg("IRQ stack:\n");
|
||||||
lldbg(" base: %08x\n", istackbase);
|
lldbg(" base: %08x\n", istackbase);
|
||||||
lldbg(" size: %08x\n", istacksize);
|
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());
|
lldbg(" used: %08x\n", up_check_intstack());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("User stack:\n");
|
lldbg("User stack:\n");
|
||||||
lldbg(" base: %08x\n", ustackbase);
|
lldbg(" base: %08x\n", ustackbase);
|
||||||
lldbg(" size: %08x\n", ustacksize);
|
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));
|
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("sp: %08x\n", sp);
|
lldbg("sp: %08x\n", sp);
|
||||||
lldbg("stack base: %08x\n", ustackbase);
|
lldbg("stack base: %08x\n", ustackbase);
|
||||||
lldbg("stack size: %08x\n", ustacksize);
|
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));
|
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("Interrupt stack:\n");
|
lldbg("Interrupt stack:\n");
|
||||||
lldbg(" base: %08x\n", istackbase);
|
lldbg(" base: %08x\n", istackbase);
|
||||||
lldbg(" size: %08x\n", istacksize);
|
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());
|
lldbg(" used: %08x\n", up_check_intstack());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -249,7 +249,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("User stack:\n");
|
lldbg("User stack:\n");
|
||||||
lldbg(" base: %08x\n", ustackbase);
|
lldbg(" base: %08x\n", ustackbase);
|
||||||
lldbg(" size: %08x\n", ustacksize);
|
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));
|
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -631,7 +631,7 @@ __start:
|
|||||||
|
|
||||||
bl up_boot
|
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
|
/* Write a known value to the IDLE thread stack to support stack
|
||||||
* monitoring logic
|
* monitoring logic
|
||||||
*/
|
*/
|
||||||
@@ -748,7 +748,7 @@ arm_data_initialize:
|
|||||||
.size .Ldatainit, . -.Ldatainit
|
.size .Ldatainit, . -.Ldatainit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
|
||||||
.type .Lstkinit, %object
|
.type .Lstkinit, %object
|
||||||
.Lstkinit:
|
.Lstkinit:
|
||||||
#ifdef CONFIG_BOOT_SDRAM_DATA
|
#ifdef CONFIG_BOOT_SDRAM_DATA
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ __start:
|
|||||||
|
|
||||||
bl up_boot
|
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
|
/* Write a known value to the IDLE thread stack to support stack
|
||||||
* monitoring logic
|
* monitoring logic
|
||||||
*/
|
*/
|
||||||
@@ -797,7 +797,7 @@ arm_data_initialize:
|
|||||||
.long _edata
|
.long _edata
|
||||||
.size .Ldatainit, . -.Ldatainit
|
.size .Ldatainit, . -.Ldatainit
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
|
||||||
.type .Lstkinit, %object
|
.type .Lstkinit, %object
|
||||||
.Lstkinit:
|
.Lstkinit:
|
||||||
#ifdef CONFIG_BOOT_SDRAM_DATA
|
#ifdef CONFIG_BOOT_SDRAM_DATA
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("IRQ stack:\n");
|
lldbg("IRQ stack:\n");
|
||||||
lldbg(" base: %08x\n", istackbase);
|
lldbg(" base: %08x\n", istackbase);
|
||||||
lldbg(" size: %08x\n", istacksize);
|
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());
|
lldbg(" used: %08x\n", up_check_intstack());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("User stack:\n");
|
lldbg("User stack:\n");
|
||||||
lldbg(" base: %08x\n", ustackbase);
|
lldbg(" base: %08x\n", ustackbase);
|
||||||
lldbg(" size: %08x\n", ustacksize);
|
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));
|
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ static void up_dumpstate(void)
|
|||||||
lldbg("sp: %08x\n", sp);
|
lldbg("sp: %08x\n", sp);
|
||||||
lldbg("stack base: %08x\n", ustackbase);
|
lldbg("stack base: %08x\n", ustackbase);
|
||||||
lldbg("stack size: %08x\n", ustacksize);
|
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));
|
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
# undef CONFIG_DEBUG_STACK
|
# undef CONFIG_DEBUG_STACK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DEBUG_STACK)
|
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
@@ -66,6 +66,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
static size_t do_stackcheck(uintptr_t alloc, size_t size);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: do_stackcheck
|
* 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 start;
|
||||||
FAR uintptr_t end;
|
FAR uintptr_t end;
|
||||||
@@ -202,4 +203,4 @@ size_t up_check_intstack_remain(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_DEBUG_STACK */
|
#endif /* CONFIG_DEBUG_STACK || CONFIG_STACK_COLORATION */
|
||||||
|
|||||||
@@ -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 (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);
|
tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size);
|
||||||
#else
|
#else
|
||||||
tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size);
|
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 */
|
/* 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);
|
tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size);
|
||||||
#else
|
#else
|
||||||
tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size);
|
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.
|
* 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);
|
up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
|
||||||
#endif
|
#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)
|
void up_stack_color(FAR void *stackbase, size_t nbytes)
|
||||||
{
|
{
|
||||||
/* Take extra care that we do not write outsize the stack boundaries */
|
/* Take extra care that we do not write outsize the stack boundaries */
|
||||||
|
|||||||
@@ -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)
|
static inline void up_color_intstack(void)
|
||||||
{
|
{
|
||||||
uint32_t *ptr = (uint32_t *)&g_intstackalloc;
|
uint32_t *ptr = (uint32_t *)&g_intstackalloc;
|
||||||
|
|||||||
@@ -519,8 +519,7 @@ void up_rnginitialize(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Debug ********************************************************************/
|
/* Debug ********************************************************************/
|
||||||
|
#if (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
|
||||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
|
|
||||||
void up_stack_color(FAR void *stackbase, size_t nbytes);
|
void up_stack_color(FAR void *stackbase, size_t nbytes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ CMN_UASRCS += up_signal_handler.S
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ void up_irqinitialize(void)
|
|||||||
#endif
|
#endif
|
||||||
#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 */
|
/* Colorize the interrupt stack for debug purposes */
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
static inline void efm32_fpuconfig(void);
|
static inline void efm32_fpuconfig(void);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
|
||||||
static void go_os_start(void *pv, unsigned int nbytes)
|
static void go_os_start(void *pv, unsigned int nbytes)
|
||||||
__attribute__ ((naked,no_instrument_function,noreturn));
|
__attribute__ ((naked,no_instrument_function,noreturn));
|
||||||
#endif
|
#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)
|
static void go_os_start(void *pv, unsigned int nbytes)
|
||||||
{
|
{
|
||||||
/* Set the IDLE stack to the stack coloration value then jump to
|
/* Set the IDLE stack to the stack coloration value then jump to
|
||||||
@@ -301,7 +301,7 @@ void __start(void)
|
|||||||
showprogress('\r');
|
showprogress('\r');
|
||||||
showprogress('\n');
|
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() */
|
/* Set the IDLE stack to the coloration value and jump into os_start() */
|
||||||
|
|
||||||
go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE);
|
go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE);
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ CMN_UASRCS += up_signal_handler.S
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ CMN_UASRCS += up_signal_handler.S
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ CMN_UASRCS += up_signal_handler.S
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
|
|||||||
CMN_CSRCS += arm_copyarmstate.c
|
CMN_CSRCS += arm_copyarmstate.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
/* 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);
|
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ CMN_UASRCS += up_signal_handler.S
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ CMN_UASRCS += up_signal_handler.S
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
/* Colorize the interrupt stack for debug purposes */
|
/* 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);
|
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
static inline void stm32_fpuconfig(void);
|
static inline void stm32_fpuconfig(void);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
|
||||||
static void go_os_start(void *pv, unsigned int nbytes)
|
static void go_os_start(void *pv, unsigned int nbytes)
|
||||||
__attribute__ ((naked,no_instrument_function,noreturn));
|
__attribute__ ((naked,no_instrument_function,noreturn));
|
||||||
#endif
|
#endif
|
||||||
@@ -195,8 +195,7 @@ static inline void stm32_fpuconfig(void)
|
|||||||
* Set the IDLE stack to the
|
* Set the IDLE stack to the
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#if defined(CONFIG_DEBUG_STACK) || defined(CONFIG_STACK_COLORATION)
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
|
||||||
static void go_os_start(void *pv, unsigned int nbytes)
|
static void go_os_start(void *pv, unsigned int nbytes)
|
||||||
{
|
{
|
||||||
/* Set the IDLE stack to the stack coloration value then jump to
|
/* Set the IDLE stack to the stack coloration value then jump to
|
||||||
@@ -311,7 +310,7 @@ void __start(void)
|
|||||||
showprogress('\r');
|
showprogress('\r');
|
||||||
showprogress('\n');
|
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() */
|
/* Set the IDLE stack to the coloration value and jump into os_start() */
|
||||||
|
|
||||||
go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE);
|
go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE);
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ ifeq ($(CONFIG_ELF),y)
|
|||||||
CMN_CSRCS += up_elf.c
|
CMN_CSRCS += up_elf.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y)
|
|||||||
CMN_ASRCS += up_memcpy.S
|
CMN_ASRCS += up_memcpy.S
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ ifeq ($(CONFIG_AVR_SPI),y)
|
|||||||
CMN_CSRCS += up_spi.c
|
CMN_CSRCS += up_spi.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ ifeq ($(CONFIG_AVR_SPI),y)
|
|||||||
CMN_CSRCS += up_spi.c
|
CMN_CSRCS += up_spi.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||||
CMN_CSRCS += up_checkstack.c
|
CMN_CSRCS += up_checkstack.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
# undef CONFIG_DEBUG_STACK
|
# undef CONFIG_DEBUG_STACK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DEBUG_STACK)
|
#if defined(CONFIG_DEBUG_STACK)) || defined(CONFIG_STACK_COLORATION)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
@@ -67,6 +67,8 @@
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static size_t do_stackcheck(uintptr_t alloc, size_t size);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: do_stackcheck
|
* 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;
|
FAR uint8_t *ptr;
|
||||||
size_t mark;
|
size_t mark;
|
||||||
@@ -197,4 +199,4 @@ size_t up_check_intstack_remain(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_DEBUG_STACK */
|
#endif /* CONFIG_DEBUG_STACK || CONFIG_STACK_COLORATION */
|
||||||
|
|||||||
@@ -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.
|
* 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);
|
tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size);
|
||||||
#else
|
#else
|
||||||
tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size);
|
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.
|
* 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);
|
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ void up_dumpstate(void)
|
|||||||
lldbg("IRQ stack:\n");
|
lldbg("IRQ stack:\n");
|
||||||
lldbg(" base: %04x\n", istackbase);
|
lldbg(" base: %04x\n", istackbase);
|
||||||
lldbg(" size: %04x\n", istacksize);
|
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());
|
lldbg(" used: %08x\n", up_check_intstack());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ void up_dumpstate(void)
|
|||||||
lldbg("User stack:\n");
|
lldbg("User stack:\n");
|
||||||
lldbg(" base: %04x\n", ustackbase);
|
lldbg(" base: %04x\n", ustackbase);
|
||||||
lldbg(" size: %04x\n", ustacksize);
|
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));
|
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ void up_dumpstate(void)
|
|||||||
lldbg("sp: %04x\n", sp);
|
lldbg("sp: %04x\n", sp);
|
||||||
lldbg("stack base: %04x\n", ustackbase);
|
lldbg("stack base: %04x\n", ustackbase);
|
||||||
lldbg("stack size: %04x\n", ustacksize);
|
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));
|
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
* 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);
|
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -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 (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);
|
tcb->stack_alloc_ptr = (uint32_t *)kmm_zalloc(stack_size);
|
||||||
#else
|
#else
|
||||||
tcb->stack_alloc_ptr = (uint32_t *)kmm_malloc(stack_size);
|
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 */
|
/* 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);
|
tcb->stack_alloc_ptr = (uint32_t *)kumm_zalloc(stack_size);
|
||||||
#else
|
#else
|
||||||
tcb->stack_alloc_ptr = (uint32_t *)kumm_malloc(stack_size);
|
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.
|
* 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);
|
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ void up_dumpstate(void)
|
|||||||
lldbg("IRQ stack:\n");
|
lldbg("IRQ stack:\n");
|
||||||
lldbg(" base: %08x\n", istackbase);
|
lldbg(" base: %08x\n", istackbase);
|
||||||
lldbg(" size: %08x\n", istacksize);
|
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());
|
lldbg(" used: %08x\n", up_check_intstack());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ void up_dumpstate(void)
|
|||||||
lldbg("User stack:\n");
|
lldbg("User stack:\n");
|
||||||
lldbg(" base: %08x\n", ustackbase);
|
lldbg(" base: %08x\n", ustackbase);
|
||||||
lldbg(" size: %08x\n", ustacksize);
|
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));
|
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ void up_dumpstate(void)
|
|||||||
lldbg("sp: %08x\n", sp);
|
lldbg("sp: %08x\n", sp);
|
||||||
lldbg("stack base: %08x\n", ustackbase);
|
lldbg("stack base: %08x\n", ustackbase);
|
||||||
lldbg("stack size: %08x\n", ustacksize);
|
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));
|
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
* 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);
|
memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
static inline void up_color_intstack(void)
|
||||||
{
|
{
|
||||||
uint8_t *ptr = (uint8_t *)&g_intstackalloc;
|
uint8_t *ptr = (uint8_t *)&g_intstackalloc;
|
||||||
|
|||||||
Reference in New Issue
Block a user