From bece5130043af60557371d9900a6fcb4b5a0fd51 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 9 Jun 2007 20:31:09 +0000 Subject: [PATCH] SDCC specific changes. Z80 support; re-enable __FILE__ and __LINE__ in assert -- might have broken the 8051/2 git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@277 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 3 +++ Documentation/NuttX.html | 3 +++ arch/pjrc-8051/src/up_assert.c | 16 ++++++++++------ include/assert.h | 8 ++++---- include/nuttx/compiler.h | 10 +++++++--- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index c02857e72c..3443e8a7f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -171,5 +171,8 @@ source files. * tools/mkconfig.c: No long depends on asprintf() and _GNU_SOURCE and so should now build in non-GNU, non-GLIBC environments. + * include/nuttx/compiler.h: Fix for using SDCC with the Z80. + * include/assert.h & arch/pjrc-8051/src/up_assert.c: SDCC does support + __FILE__and __LINE__ (not tested) * Started m68322 diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 1adab64be5..c88c341547 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -605,6 +605,9 @@ Other memory: source files. * tools/mkconfig.c: No long depends on asprintf() and _GNU_SOURCE and so should now build in non-GNU, non-GLIBC environments. + * include/nuttx/compiler.h: Fix for using SDCC with the Z80. + * include/assert.h & arch/pjrc-8051/src/up_assert.c: SDCC does support + __FILE__and __LINE__ (not tested) * Started m68322 diff --git a/arch/pjrc-8051/src/up_assert.c b/arch/pjrc-8051/src/up_assert.c index 01bec26caa..a0d04c3937 100644 --- a/arch/pjrc-8051/src/up_assert.c +++ b/arch/pjrc-8051/src/up_assert.c @@ -95,7 +95,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ * Name: up_assert ************************************************************/ -void up_assert(void) +void up_assert(const ubyte *filename, int lineno) { #if CONFIG_TASK_NAME_SIZE > 0 _TCB *rtcb = (_TCB*)g_readytorun.head; @@ -104,9 +104,11 @@ void up_assert(void) up_ledon(LED_ASSERTION); #if CONFIG_TASK_NAME_SIZE > 0 - lldbg("%s: Assertion failed\n", rtcb->name); + lldbg("Assertion failed at file:%s line: %d task: %s\n", + filename, lineno, rtcb->name); #else - lldbg("Assertion failed\n"); + lldbg("Assertion failed at file:%s line: %d\n", + filename, lineno); #endif up_dumpstack(); @@ -117,7 +119,7 @@ void up_assert(void) * Name: up_assert_code ************************************************************/ -void up_assert_code(int errorcode) +void up_assert_code(const ubyte *filename, int lineno, int errorcode) { #if CONFIG_TASK_NAME_SIZE > 0 _TCB *rtcb = (_TCB*)g_readytorun.head; @@ -126,9 +128,11 @@ void up_assert_code(int errorcode) up_ledon(LED_ASSERTION); #if CONFIG_TASK_NAME_SIZE > 0 - lldbg("%s: Assertion failed, error=%d\n", rtcb->name, errorcode); + lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n", + filename, lineno, rtcb->name, errorcode); #else - lldbg("Assertion failed , error=%d\n", errorcode); + lldbg("Assertion failed at file:%s line: %d error code: %d\n", + filename, lineno, errorcode); #endif up_dumpstack(); diff --git a/include/assert.h b/include/assert.h index 4222aa2d8e..5f69b71781 100644 --- a/include/assert.h +++ b/include/assert.h @@ -53,7 +53,7 @@ #undef ASSERTCODE #undef DEBUGASSERT -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(SDCC) # define ASSERT(f) \ { if (!(f)) up_assert((const ubyte *)__FILE__, (int)__LINE__); } @@ -105,9 +105,9 @@ extern "C" { #define EXTERN extern #endif -#ifdef __GNUC__ -EXTERN void up_assert(FAR const ubyte *filename, int linenum); -EXTERN void up_assert_code(FAR const ubyte *filename, int linenum, +#if defined(__GNUC__) || defined(SDCC) +EXTERN void up_assert(const ubyte *filename, int linenum); +EXTERN void up_assert_code(const ubyte *filename, int linenum, int error_code); #else EXTERN void up_assert(void); diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index b0ea16f38e..2b7a967887 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -84,7 +84,7 @@ # undef CONFIG_LONG_IS_NOT_INT -/* The pointers and int are the same size */ +/* Pointers and int are the same size */ # undef CONFIG_PTR_IS_NOT_INT @@ -152,9 +152,13 @@ # define CONFIG_LONG_IS_NOT_INT 1 -/* The generic point and int are not the same size */ - +/* The generic pointer and int are not the same size + * (for some SDCC architectures) + */ + +#if !defined(__z80) && defined(__gbz80) # define CONFIG_PTR_IS_NOT_INT 1 +#endif /* SDCC does not support inline functions */