summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-12-30 23:34:20 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-12-30 23:34:20 +0000
commitcec4c4d2c9468a0d0234d306c886ba97515b1690 (patch)
tree326bbe7079e54314b42270d115ae6d39e8f037b8
parentf3532ac59f8b6bb4d4a7239b73b5fcb4b66ed6b1 (diff)
downloadnuttx-cec4c4d2c9468a0d0234d306c886ba97515b1690.tar.gz
nuttx-cec4c4d2c9468a0d0234d306c886ba97515b1690.tar.bz2
nuttx-cec4c4d2c9468a0d0234d306c886ba97515b1690.zip
More SDCC compilation fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@468 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/TODO16
-rw-r--r--nuttx/arch/z80/src/z80/Make.defs6
-rw-r--r--nuttx/configs/z80sim/README.txt14
-rw-r--r--nuttx/configs/z80sim/defconfig18
-rw-r--r--nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch11
-rw-r--r--nuttx/examples/ostest/posixtimer.c34
-rw-r--r--nuttx/examples/ostest/timedmqueue.c10
-rw-r--r--nuttx/examples/ostest/timedwait.c35
-rw-r--r--nuttx/include/stdio.h1
-rw-r--r--nuttx/include/sys/types.h35
-rw-r--r--nuttx/sched/pthread_create.c2
-rw-r--r--nuttx/sched/timer_create.c8
-rw-r--r--nuttx/sched/timer_settime.c2
13 files changed, 147 insertions, 45 deletions
diff --git a/nuttx/TODO b/nuttx/TODO
index 33db2ed41..57c3de98b 100644
--- a/nuttx/TODO
+++ b/nuttx/TODO
@@ -293,10 +293,18 @@ o pjrc-8052 / MCS51 (arch/pjrc-8051/)
Priority: Low
Description: During build, there are several integer overflows reported:
- gmtime_r.c aroud lines 184 and 185
- clock_initialize.c at line 107
- pthread_create.c at 330
- sighand.c at 225 and 244
+ sched/gmtime_r.c aroud lines 184 and 185
+ sched/clock_initialize.c at line 107
+ sched/pthread_create.c at 330
+ examples/ostest/barrier.c around lines 53 and 74
+ examples/ostest/sighand.c at 225 and 244
Status: Open
Priority: Medium
+o z80 (arch/z80)
+ ^^^^^^^^^^^^^^^
+
+ Has the same problems with interger overflow during compilation as described
+ for pjrc-8051
+
+
diff --git a/nuttx/arch/z80/src/z80/Make.defs b/nuttx/arch/z80/src/z80/Make.defs
index 05dc8cd56..d4e38b11c 100644
--- a/nuttx/arch/z80/src/z80/Make.defs
+++ b/nuttx/arch/z80/src/z80/Make.defs
@@ -41,7 +41,11 @@ CMN_CSRCS = up_initialize.c up_allocateheap.c up_initialstate.c \
up_blocktask.c up_unblocktask.c up_exit.c up_releasepending.c \
up_reprioritizertr.c up_copystate.c up_irq.c up_idle.c \
up_assert.c up_mdelay.c up_udelay.c \
- up_registerdump.c up_usestack.c \
+ up_registerdump.c up_usestack.c
+
+ifneq ($(CONFIG_DISABLE_SIGNALS),y)
+CMD_CSRCS += up_schedulesigaction.c up_sigdeliver.c
+endif
CHIP_ASRCS =
CHIP_CSRCS =
diff --git a/nuttx/configs/z80sim/README.txt b/nuttx/configs/z80sim/README.txt
index 50be916e1..ff9754c04 100644
--- a/nuttx/configs/z80sim/README.txt
+++ b/nuttx/configs/z80sim/README.txt
@@ -17,4 +17,18 @@ compatible with this build. First start with the usual steps
unpack
cd sdcc
./configure
+
+But before making, we need to apply a patch to the SDCC 2.6.0 source
+so that the z80 assembler can handle long symbol names
+
+ Apply sdcc-2.6.0-asz80-symlen.patch
+ cd sdcc/device/lib
+
+Then make the SDCC binaries
+
+ cd sdcc
make
+
+and install SDCC:
+
+ sudo make install
diff --git a/nuttx/configs/z80sim/defconfig b/nuttx/configs/z80sim/defconfig
index a993a6aeb..6141c34b1 100644
--- a/nuttx/configs/z80sim/defconfig
+++ b/nuttx/configs/z80sim/defconfig
@@ -112,13 +112,13 @@ CONFIG_DEV_CONSOLE=n
# o pthread_condtimedwait() depends on signals to wake
# up waiting tasks.
#
-CONFIG_DISABLE_CLOCK=y
-CONFIG_DISABLE_POSIX_TIMERS=y
-CONFIG_DISABLE_PTHREAD=y
-CONFIG_DISABLE_SIGNALS=y
-CONFIG_DISABLE_MQUEUE=y
-CONFIG_DISABLE_MOUNTPOINT=y
-CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
#
# Misc libc settings
@@ -283,7 +283,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
CONFIG_BOOT_FROM_FLASH=n
CONFIG_CUSTOM_STACK=n
CONFIG_PROC_STACK_SIZE=1024
-CONFIG_PTHREAD_STACK_MIN=
-CONFIG_PTHREAD_STACK_DEFAULT=
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
CONFIG_HEAP_SIZE=
CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch b/nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch
new file mode 100644
index 000000000..d91c18d98
--- /dev/null
+++ b/nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch
@@ -0,0 +1,11 @@
+--- sdcc/as/z80/asm.h 2007-12-30 16:49:53.000000000 -0600
++++ sdcc.orig/as/z80/asm.h 2007-12-30 16:49:14.000000000 -0600
+@@ -65,7 +65,7 @@
+ #define RTTERM ')' /* Right expression delimeter */
+
+ #ifdef SDK
+-#define NCPS 80 /* characters per symbol */
++#define NCPS 32 /* characters per symbol */
+ #else /* SDK */
+ #define NCPS 8 /* Chars. per symbol */
+ #endif /* SDK */
diff --git a/nuttx/examples/ostest/posixtimer.c b/nuttx/examples/ostest/posixtimer.c
index 1b466c99f..87498baa2 100644
--- a/nuttx/examples/ostest/posixtimer.c
+++ b/nuttx/examples/ostest/posixtimer.c
@@ -1,7 +1,7 @@
/***********************************************************************
* posixtimer.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -33,6 +33,10 @@
*
***********************************************************************/
+/**************************************************************************
+ * Included Files
+ **************************************************************************/
+
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
@@ -42,6 +46,10 @@
#include <errno.h>
#include "ostest.h"
+/**************************************************************************
+ * Private Definitions
+ **************************************************************************/
+
#ifndef NULL
# define NULL (void*)0
#endif
@@ -49,9 +57,23 @@
#define MY_TIMER_SIGNAL 17
#define SIGVALUE_INT 42
+#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0
+# define FFLUSH() fflush(stdout)
+#else
+# define FFLUSH()
+#endif
+
+/**************************************************************************
+ * Private Data
+ **************************************************************************/
+
static sem_t sem;
static int g_nsigreceived = 0;
+/**************************************************************************
+ * Private Functions
+ **************************************************************************/
+
static void timer_expiration(int signo, siginfo_t *info, void *ucontext)
{
sigset_t oldset;
@@ -119,6 +141,10 @@ static void timer_expiration(int signo, siginfo_t *info, void *ucontext)
}
+/**************************************************************************
+ * Public Functions
+ **************************************************************************/
+
void timer_test(void)
{
sigset_t sigset;
@@ -200,7 +226,7 @@ void timer_test(void)
for (i = 0; i < 5; i++)
{
printf("timer_test: Waiting on semaphore\n" );
- fflush(stdout);
+ FFLUSH();
status = sem_wait(&sem);
if (status != 0)
{
@@ -239,5 +265,5 @@ errorout:
status = sigaction(MY_TIMER_SIGNAL, &act, &oact);
printf("timer_test: done\n" );
- fflush(stdout);
+ FFLUSH();
}
diff --git a/nuttx/examples/ostest/timedmqueue.c b/nuttx/examples/ostest/timedmqueue.c
index 186296a06..2ef0dedea 100644
--- a/nuttx/examples/ostest/timedmqueue.c
+++ b/nuttx/examples/ostest/timedmqueue.c
@@ -66,6 +66,12 @@
#define TEST_SEND_NMSGS (10)
#define TEST_RECEIVE_NMSGS (10)
+#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0
+# define FFLUSH() fflush(stdout)
+#else
+# define FFLUSH()
+#endif
+
/**************************************************************************
* Private Types
**************************************************************************/
@@ -180,7 +186,7 @@ static void *sender_thread(void *arg)
}
printf("sender_thread: returning nerrors=%d\n", nerrors);
- fflush(stdout);
+ FFLUSH();
return (pthread_addr_t)nerrors;
}
@@ -305,7 +311,7 @@ static void *receiver_thread(void *arg)
}
printf("receiver_thread: returning nerrors=%d\n", nerrors);
- fflush(stdout);
+ FFLUSH();
pthread_exit((pthread_addr_t)nerrors);
return (pthread_addr_t)nerrors;
}
diff --git a/nuttx/examples/ostest/timedwait.c b/nuttx/examples/ostest/timedwait.c
index 0bc47c693..51622bad8 100644
--- a/nuttx/examples/ostest/timedwait.c
+++ b/nuttx/examples/ostest/timedwait.c
@@ -1,7 +1,7 @@
/***********************************************************************
- * timedwait.c
+ * examples/ostest/timedwait.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -33,16 +33,39 @@
*
***********************************************************************/
+/**************************************************************************
+ * Included Files
+ **************************************************************************/
+
#include <stdio.h>
#include <time.h>
#include <pthread.h>
#include <unistd.h>
#include <errno.h>
+
#include "ostest.h"
+/**************************************************************************
+ * Private Definitions
+ **************************************************************************/
+
+#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0
+# define FFLUSH() fflush(stdout)
+#else
+# define FFLUSH()
+#endif
+
+/**************************************************************************
+ * Private Data
+ **************************************************************************/
+
static pthread_mutex_t mutex;
static pthread_cond_t cond;
+/**************************************************************************
+ * Private Functions
+ **************************************************************************/
+
static void *thread_waiter(void *parameter)
{
struct timespec time;
@@ -99,6 +122,10 @@ static void *thread_waiter(void *parameter)
return NULL;
}
+/**************************************************************************
+ * Public Definitions
+ **************************************************************************/
+
void timedwait_test(void)
{
pthread_t waiter;
@@ -161,7 +188,7 @@ void timedwait_test(void)
}
printf("timedwait_test: Joining\n");
- fflush(stdout);
+ FFLUSH();
status = pthread_join(waiter, &result);
if (status != 0)
{
diff --git a/nuttx/include/stdio.h b/nuttx/include/stdio.h
index eaeb879d3..cfb722c6d 100644
--- a/nuttx/include/stdio.h
+++ b/nuttx/include/stdio.h
@@ -41,6 +41,7 @@
************************************************************/
#include <nuttx/config.h>
+
#include <sys/types.h>
#include <stdarg.h>
#include <sched.h>
diff --git a/nuttx/include/sys/types.h b/nuttx/include/sys/types.h
index 0460c5e5c..2fd53e41d 100644
--- a/nuttx/include/sys/types.h
+++ b/nuttx/include/sys/types.h
@@ -1,7 +1,7 @@
-/************************************************************
+/****************************************************************************
* sys/types.h
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -31,39 +31,44 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
#ifndef __SYS_TYPES_H
#define __SYS_TYPES_H
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <nuttx/config.h>
#include <arch/types.h>
#include <nuttx/compiler.h>
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
/* Values for type boolean */
#define TRUE 1
#define FALSE 0
-/* NULL is usually defined in stddef.h */
+/* NULL is usually defined in stddef.h (which includes this file) */
#ifndef NULL
-#define NULL (void*)0L
+ /* SDCC is sensitive to NULL pointer type conversions */
+# ifdef SDCC
+# define NULL (0)
+# else
+# define NULL ((void*)0)
+# endif
#endif
/* POSIX-like OS return values: */
#if !defined(__cplusplus)
-#undef ERROR
-#define ERROR -1
+# undef ERROR
+# define ERROR -1
#endif
#undef OK
@@ -86,9 +91,9 @@
#define SCHED_PRIORITY_MIN 1
#define SCHED_PRIORITY_IDLE 0
-/************************************************************
+/****************************************************************************
* Type Declarations
- ************************************************************/
+ ****************************************************************************/
#ifndef __ASSEMBLY__
#ifndef CONFIG_HAVE_DOUBLE
@@ -132,8 +137,8 @@ typedef int (*main_t)(int argc, char *argv[]);
#endif
-/************************************************************
+/****************************************************************************
* Global Function Prototypes
- ************************************************************/
+ ****************************************************************************/
#endif /* __SYS_TYPES_H */
diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c
index 24768664b..bd86643f9 100644
--- a/nuttx/sched/pthread_create.c
+++ b/nuttx/sched/pthread_create.c
@@ -357,7 +357,7 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr,
* passed by value
*/
- (void)pthread_argsetup(ptcb, arg);
+ pthread_argsetup(ptcb, arg);
/* Attach the join info to the TCB. */
diff --git a/nuttx/sched/timer_create.c b/nuttx/sched/timer_create.c
index 40a660f50..645007c9f 100644
--- a/nuttx/sched/timer_create.c
+++ b/nuttx/sched/timer_create.c
@@ -1,7 +1,7 @@
/********************************************************************************
- * timer_create.c
+ * sched/timer_create.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -204,7 +204,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
#ifdef CONFIG_CAN_PASS_STRUCTS
ret->pt_value = evp->sigev_value;
#else
- ret->pt_value.sival_ptr = evp->sigev_value.sigval_ptr;
+ ret->pt_value.sival_ptr = evp->sigev_value.sival_ptr;
#endif
}
else
diff --git a/nuttx/sched/timer_settime.c b/nuttx/sched/timer_settime.c
index 29796a593..a9a7fd7c4 100644
--- a/nuttx/sched/timer_settime.c
+++ b/nuttx/sched/timer_settime.c
@@ -104,7 +104,7 @@ static void inline timer_sigqueue(FAR struct posix_timer_s *timer)
info.si_signo = timer->pt_signo;
info.si_code = SI_TIMER;
-#ifndef CONFIG_CAN_PASS_STRUCTS
+#ifdef CONFIG_CAN_PASS_STRUCTS
info.si_value = timer->pt_value;
#else
info.si_value.sival_ptr = timer->pt_value.sival_ptr;