More SDCC compilation fixes

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@468 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-12-30 23:34:20 +00:00
parent f038ce79e9
commit 8403a62cdf
13 changed files with 147 additions and 45 deletions

16
TODO
View File

@ -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

View File

@ -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 =

View File

@ -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

View File

@ -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=

View File

@ -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 */

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -41,6 +41,7 @@
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdarg.h>
#include <sched.h>

View File

@ -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 */

View File

@ -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. */

View File

@ -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

View File

@ -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;