summaryrefslogtreecommitdiff
path: root/nuttx/arch/avr
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-03-23 10:11:14 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-03-23 10:11:14 -0600
commit9acd7deb2a7d40d8134706cc0f9434375475abe1 (patch)
tree8379dea3349bfe93a651359bfe1be73673dbbdfb /nuttx/arch/avr
parent73a64bf3f0d7d33e2a9c71d876348bd6f1905316 (diff)
downloadnuttx-9acd7deb2a7d40d8134706cc0f9434375475abe1.tar.gz
nuttx-9acd7deb2a7d40d8134706cc0f9434375475abe1.tar.bz2
nuttx-9acd7deb2a7d40d8134706cc0f9434375475abe1.zip
AVR assertion logic will report stack usage on crash if DEBUG_STACK is set
Diffstat (limited to 'nuttx/arch/avr')
-rw-r--r--nuttx/arch/avr/src/avr/up_dumpstate.c17
-rw-r--r--nuttx/arch/avr/src/avr32/up_dumpstate.c17
2 files changed, 32 insertions, 2 deletions
diff --git a/nuttx/arch/avr/src/avr/up_dumpstate.c b/nuttx/arch/avr/src/avr/up_dumpstate.c
index 6ba50d238..ba81eda2e 100644
--- a/nuttx/arch/avr/src/avr/up_dumpstate.c
+++ b/nuttx/arch/avr/src/avr/up_dumpstate.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/avr/src/avr/up_dumpstate.c
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -58,6 +58,12 @@
* Pre-processor Definitions
****************************************************************************/
+/* Check if we can dump stack usage information */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_STACK
+#endif
+
/* Output debug info if stack dump is selected -- even if debug is not
* selected.
*/
@@ -202,6 +208,9 @@ void up_dumpstate(void)
lldbg("IRQ stack:\n");
lldbg(" base: %04x\n", istackbase);
lldbg(" size: %04x\n", istacksize);
+#ifdef CONFIG_DEBUG_STACK
+ lldbg(" used: %08x\n", up_check_intstack());
+#endif
/* Does the current stack pointer lie within the interrupt
* stack?
@@ -228,6 +237,9 @@ void up_dumpstate(void)
lldbg("User stack:\n");
lldbg(" base: %04x\n", ustackbase);
lldbg(" size: %04x\n", ustacksize);
+#ifdef CONFIG_DEBUG_STACK
+ lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
+#endif
/* Dump the user stack if the stack pointer lies within the allocated user
* stack memory.
@@ -241,6 +253,9 @@ 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
+ lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
+#endif
/* Dump the user stack if the stack pointer lies within the allocated user
* stack memory.
diff --git a/nuttx/arch/avr/src/avr32/up_dumpstate.c b/nuttx/arch/avr/src/avr32/up_dumpstate.c
index 90cb22837..bc74d9bb0 100644
--- a/nuttx/arch/avr/src/avr32/up_dumpstate.c
+++ b/nuttx/arch/avr/src/avr32/up_dumpstate.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/avr/src/avr32/up_dumpstate.c
*
- * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2010-2011, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -58,6 +58,12 @@
* Pre-processor Definitions
****************************************************************************/
+/* Check if we can dump stack usage information */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_STACK
+#endif
+
/* Output debug info if stack dump is selected -- even if debug is not
* selected.
*/
@@ -179,6 +185,9 @@ void up_dumpstate(void)
lldbg("IRQ stack:\n");
lldbg(" base: %08x\n", istackbase);
lldbg(" size: %08x\n", istacksize);
+#ifdef CONFIG_DEBUG_STACK
+ lldbg(" used: %08x\n", up_check_intstack());
+#endif
/* Does the current stack pointer lie within the interrupt
* stack?
@@ -205,6 +214,9 @@ void up_dumpstate(void)
lldbg("User stack:\n");
lldbg(" base: %08x\n", ustackbase);
lldbg(" size: %08x\n", ustacksize);
+#ifdef CONFIG_DEBUG_STACK
+ lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
+#endif
/* Dump the user stack if the stack pointer lies within the allocated user
* stack memory.
@@ -218,6 +230,9 @@ 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
+ lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
+#endif
/* Dump the user stack if the stack pointer lies within the allocated user
* stack memory.