summaryrefslogtreecommitdiff
path: root/nuttx/arch/pjrc-8051/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-11 21:16:56 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-11 21:16:56 +0000
commit7e354ad57b4d040ab88e2eeb4ac84240e65e0e52 (patch)
treea8d9734a0a38870239e613c63c3e066b36221b18 /nuttx/arch/pjrc-8051/src
parent6877a8efaf6edad7dcff6412c1eb03973d080247 (diff)
downloadpx4-nuttx-7e354ad57b4d040ab88e2eeb4ac84240e65e0e52.tar.gz
px4-nuttx-7e354ad57b4d040ab88e2eeb4ac84240e65e0e52.tar.bz2
px4-nuttx-7e354ad57b4d040ab88e2eeb4ac84240e65e0e52.zip
Fixed 8051 printf bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@57 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/pjrc-8051/src')
-rw-r--r--nuttx/arch/pjrc-8051/src/up_debug.c25
-rw-r--r--nuttx/arch/pjrc-8051/src/up_initialstate.c5
-rw-r--r--nuttx/arch/pjrc-8051/src/up_internal.h5
3 files changed, 30 insertions, 5 deletions
diff --git a/nuttx/arch/pjrc-8051/src/up_debug.c b/nuttx/arch/pjrc-8051/src/up_debug.c
index 6f59f488b..6f1485aaa 100644
--- a/nuttx/arch/pjrc-8051/src/up_debug.c
+++ b/nuttx/arch/pjrc-8051/src/up_debug.c
@@ -160,3 +160,28 @@ void up_dumpframe(FAR struct xcptcontext *context)
_up_dump8(" PSW ", start[FRAME_PSW]);
}
#endif
+
+/************************************************************
+ * Name: up_dumpframe
+ ************************************************************/
+
+/* The 805x family has a tiny, 256 stack and can be easily
+ * overflowed. The following macro can be used to instrument
+ * code to dump the stack pointer at critical locations.
+ */
+
+#ifdef CONFIG_ARCH_PJRC
+void up_showsp(ubyte ch) __naked
+{
+ ch;
+ _asm
+ mov a, dpl
+ lcall PM2_ENTRY_COUT
+ mov a, sp
+ lcall PM2_ENTRY_PHEX
+ lcall PM2_ENTRY_NEWLINE
+ _endasm;
+}
+#endif
+
+
diff --git a/nuttx/arch/pjrc-8051/src/up_initialstate.c b/nuttx/arch/pjrc-8051/src/up_initialstate.c
index 930f16873..1eae39fa9 100644
--- a/nuttx/arch/pjrc-8051/src/up_initialstate.c
+++ b/nuttx/arch/pjrc-8051/src/up_initialstate.c
@@ -96,10 +96,7 @@ void up_initial_state(FAR _TCB *tcb)
frame[FRAME_RETLS] = (((uint16)tcb->start) & 0xff);
frame[FRAME_RETMS] = (((uint16)tcb->start) >> 8);
- /* Then the context save area which can be indexed with
- * the following definitions (relative to the beginning of
- * the initial frame.
- */
+ /* The context save area follows the return address. */
frame[FRAME_IE] = 0x80;
frame[FRAME_PSW] = 0;
diff --git a/nuttx/arch/pjrc-8051/src/up_internal.h b/nuttx/arch/pjrc-8051/src/up_internal.h
index 95fb97745..19c628f5c 100644
--- a/nuttx/arch/pjrc-8051/src/up_internal.h
+++ b/nuttx/arch/pjrc-8051/src/up_internal.h
@@ -40,7 +40,10 @@
* Included Files
**************************************************************************/
-#include "pjrc.h"
+#include <nuttx/config.h>
+#ifdef CONFIG_ARCH_PJRC
+# include "pjrc.h"
+#endif
/**************************************************************************
* Public Definitions