summaryrefslogtreecommitdiff
path: root/nuttx/arch/pjrc-8051
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
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')
-rw-r--r--nuttx/arch/pjrc-8051/README.txt5
-rw-r--r--nuttx/arch/pjrc-8051/defconfig3
-rw-r--r--nuttx/arch/pjrc-8051/include/arch.h7
-rw-r--r--nuttx/arch/pjrc-8051/include/irq.h4
-rw-r--r--nuttx/arch/pjrc-8051/sdcc-2.6.0.patch17
-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
8 files changed, 63 insertions, 8 deletions
diff --git a/nuttx/arch/pjrc-8051/README.txt b/nuttx/arch/pjrc-8051/README.txt
index 0b73373d3..dae92b59b 100644
--- a/nuttx/arch/pjrc-8051/README.txt
+++ b/nuttx/arch/pjrc-8051/README.txt
@@ -21,7 +21,10 @@ compatible with this build. First start with the usual steps
./configure
make
-But before installing,
+But before installing, we need to apply a patch to the SDCC 2.6.0 source.
+WARNING: This patch is specific to the particular combination of CFLAGS
+that are used in the compilation. If you change Make.defs, then you will
+likely have to change the patch as well.
Apply sdcc-2.6.0.patch
cd sdcc/device/lib
diff --git a/nuttx/arch/pjrc-8051/defconfig b/nuttx/arch/pjrc-8051/defconfig
index 2d7222305..28044f43f 100644
--- a/nuttx/arch/pjrc-8051/defconfig
+++ b/nuttx/arch/pjrc-8051/defconfig
@@ -40,7 +40,8 @@
# CONFIG_PJRC_LEDS - Use LEDs to show state. Unique to 8051.
#
CONFIG_ARCH=pjrc-8051
-CONFIG_ARCH_8051=y
+CONFIG_ARCH_8052=y
+CONFIG_ARCH_PJRC=y
CONFIG_8051_LEDS=n
#
diff --git a/nuttx/arch/pjrc-8051/include/arch.h b/nuttx/arch/pjrc-8051/include/arch.h
index b61ce916a..f7d2b956c 100644
--- a/nuttx/arch/pjrc-8051/include/arch.h
+++ b/nuttx/arch/pjrc-8051/include/arch.h
@@ -67,6 +67,13 @@ extern "C" {
#define EXTERN extern
#endif
+/* 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.
+ */
+
+EXTERN void up_showsp(ubyte ch) __naked;
+
#undef EXTERN
#ifdef __cplusplus
}
diff --git a/nuttx/arch/pjrc-8051/include/irq.h b/nuttx/arch/pjrc-8051/include/irq.h
index 8ca78adc8..819a73df7 100644
--- a/nuttx/arch/pjrc-8051/include/irq.h
+++ b/nuttx/arch/pjrc-8051/include/irq.h
@@ -44,6 +44,8 @@
* Included Files
************************************************************/
+#include <nuttx/config.h>
+
/************************************************************
* Definitions
************************************************************/
@@ -65,7 +67,7 @@
#define IRAM_BASE 0x0000
#define IRAM_SIZE 0x0100
-#define STACK_BASE 0x0030
+#define STACK_BASE 0x0024
#define STACK_SIZE (IRAM_SIZE - STACK_BASE)
/* This is the form of initial stack frame
diff --git a/nuttx/arch/pjrc-8051/sdcc-2.6.0.patch b/nuttx/arch/pjrc-8051/sdcc-2.6.0.patch
index e518dab0a..beb8bf2ea 100644
--- a/nuttx/arch/pjrc-8051/sdcc-2.6.0.patch
+++ b/nuttx/arch/pjrc-8051/sdcc-2.6.0.patch
@@ -1,3 +1,4 @@
+diff -u sdcc/device/lib/Makefile.orig sdcc/device/lib/Makefile
--- sdcc/device/lib/Makefile.orig 2007-03-06 09:55:01.000000000 -0600
+++ sdcc/device/lib/Makefile 2007-03-06 09:58:32.000000000 -0600
@@ -242,7 +242,7 @@
@@ -9,3 +10,19 @@
done \
fi
+diff -u sdcc/device/include/stdarg.h.orig sdcc/device/include/stdarg.h
+--- sdcc/device/include/stdarg.h.orig 2007-03-11 13:21:15.000000000 -0600
++++ sdcc/device/include/stdarg.h 2007-03-11 13:26:59.000000000 -0600
+@@ -25,9 +25,9 @@
+
+ #else
+
+-typedef unsigned char __data * va_list ;
+-#define va_arg(marker,type) *((type __data * )(marker -= sizeof(type)))
+-#define va_start(marker,first) { marker = (va_list) ((char __data * )&first); }
++typedef unsigned char * va_list ;
++#define va_arg(marker,type) *((type * )(marker -= sizeof(type)))
++#define va_start(marker,first) { marker = (va_list) ((char * )&first); }
+
+ #endif
+
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