mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
Fixed 8051 printf bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@57 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
#
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -40,7 +40,10 @@
|
||||
* Included Files
|
||||
**************************************************************************/
|
||||
|
||||
#include "pjrc.h"
|
||||
#include <nuttx/config.h>
|
||||
#ifdef CONFIG_ARCH_PJRC
|
||||
# include "pjrc.h"
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
* Public Definitions
|
||||
|
||||
Reference in New Issue
Block a user