summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-10-10 21:24:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-10-10 21:24:15 +0000
commit5b5dd1c8736322092154362df62a8179f5a4c770 (patch)
treef7dd4ac10e1122cc0b253be7bcbb85833007ca50 /c
parent2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-5b5dd1c8736322092154362df62a8179f5a4c770.tar.bz2
2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* shared/bspgetworkarea.c: Add debug prints of memory information.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/sparc/ChangeLog4
-rw-r--r--c/src/lib/libbsp/sparc/shared/bspgetworkarea.c32
2 files changed, 36 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/ChangeLog b/c/src/lib/libbsp/sparc/ChangeLog
index 2d901a8bd7..dee76a0f6c 100644
--- a/c/src/lib/libbsp/sparc/ChangeLog
+++ b/c/src/lib/libbsp/sparc/ChangeLog
@@ -1,3 +1,7 @@
+2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * shared/bspgetworkarea.c: Add debug prints of memory information.
+
2009-09-29 Ralf Corsépius <ralf.corsepius@rtems.org>
* shared/include/pci.h: Add prototypes for BusCountPCI(void),
diff --git a/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c b/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c
index 7b6cf76d7b..d4cd779267 100644
--- a/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c
+++ b/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c
@@ -12,8 +12,12 @@
* $Id$
*/
+/* #define BSP_GET_WORK_AREA_DEBUG */
#include <bsp.h>
#include <bsp/bootcard.h>
+#ifdef BSP_GET_WORK_AREA_DEBUG
+ #include <rtems/bspIo.h>
+#endif
/* Tells us where to put the workspace in case remote debugger is present. */
extern uint32_t rdb_start;
@@ -37,4 +41,32 @@ void bsp_get_work_area(
*work_area_size = (void *)rdb_start - (void *)&end - STACK_SIZE;
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
+
+ /*
+ * The following may be helpful in debugging what goes wrong when
+ * you are allocating the Work Area in a new BSP.
+ */
+ #ifdef BSP_GET_WORK_AREA_DEBUG
+ {
+ void *sp = __builtin_frame_address(0);
+ void *end = *work_area_start + *work_area_size;
+ printk(
+ "work_area_start = 0x%p\n"
+ "work_area_size = %d 0x%08x\n"
+ "end = 0x%p\n"
+ "heap_start = 0x%p\n"
+ "heap_size = %d\n"
+ "current stack pointer = 0x%p%s\n",
+ *work_area_start,
+ *work_area_size, /* decimal */
+ *work_area_size, /* hexadecimal */
+ end,
+ *heap_start,
+ *heap_size,
+ sp,
+ ((sp >= *work_area_start && sp <= end) ? " OVERLAPS!" : "")
+ );
+ printk( "rdb_start = 0x%08x\n", rdb_start );
+ }
+ #endif
}