Various fixes to get a clean compile with the SDCC compiler. Compile is 'almost' clean.

This commit is contained in:
Gregory Nutt 2019-06-03 16:53:11 -06:00
parent fd4436f559
commit 7ab149d8e9
19 changed files with 136 additions and 46 deletions

View File

@ -42,7 +42,7 @@
#include <string.h> #include <string.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include "chip/chip.h" #include "chip.h"
#include "up_internal.h" #include "up_internal.h"
#include "up_arch.h" #include "up_arch.h"

View File

@ -46,7 +46,7 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/sched.h> #include <nuttx/sched.h>
#include "chip/chip.h" #include "chip.h"
#include "common/up_internal.h" #include "common/up_internal.h"
#include "z180_config.h" #include "z180_config.h"

View File

@ -46,7 +46,7 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/sched.h> #include <nuttx/sched.h>
#include "chip/chip.h" #include "chip.h"
#include "common/up_internal.h" #include "common/up_internal.h"
#include "z180_config.h" #include "z180_config.h"

View File

@ -53,7 +53,7 @@
#include <nuttx/serial/serial.h> #include <nuttx/serial/serial.h>
#include <arch/io.h> #include <arch/io.h>
#include "chip/chip.h" #include "chip.h"
#include "up_internal.h" #include "up_internal.h"
#include "z180_config.h" #include "z180_config.h"

View File

@ -42,7 +42,7 @@
#include <string.h> #include <string.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include "chip/chip.h" #include "chip.h"
#include "up_internal.h" #include "up_internal.h"
#include "up_arch.h" #include "up_arch.h"

View File

@ -65,7 +65,7 @@ BOARD_INSTALLED = $(if $(wildcard $(BOARD_DIR)$(DELIM)Makefile),y,)
# Basic # Basic
CONFIG_ASRCS = CONFIG_ASRCS =
CONFIG_CSRCS = CONFIG_CSRCS = dummy.c
CONFIG_CXXSRCS = CONFIG_CXXSRCS =
# boardctl support # boardctl support
@ -101,7 +101,6 @@ $(CXXOBJS): %$(OBJEXT): %.cxx
$(call COMPILEXX, $<, $@) $(call COMPILEXX, $<, $@)
$(BIN): $(OBJS) $(BIN): $(OBJS)
$(Q) touch $(BIN) # Archive may not exist
$(call ARCHIVE, $@, $(OBJS)) $(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)

59
configs/dummy.c Normal file
View File

@ -0,0 +1,59 @@
/****************************************************************************
* configs/dummy.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: __configs_dummy
*
* Description:
* This is a dummy C file. It is used to generate a useless object. The
* purpose of the useless object is to assure that libconfigs.a/lib is
* created. Some archivers (ZDS-II, SDCC) require a non-empty library or
* they will generate errors
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void __configs_dummy(void)
{
}

View File

@ -222,3 +222,13 @@ and install SDCC:
sudo make install sudo make install
Known compilation problems:
CC: stdlib/lib_strtof.c
stdlib/lib_strtof.c:62:6: warning: #warning "Size of exponent is unknown"
stdlib/lib_strtof.c:76: error 122: dividing by ZERO
stdlib/lib_strtof.c:102: error 122: dividing by ZERO
stdlib/lib_strtof.c:76: error 122: dividing by ZERO
Workaround: Remove lib_strtof.c from libs/libc/stdlib/Make.defs

View File

@ -50,7 +50,6 @@
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/serial/serial.h> #include <nuttx/serial/serial.h>
#include <arch/serial.h>
#include "up_arch.h" #include "up_arch.h"
#include "up_internal.h" #include "up_internal.h"
@ -113,22 +112,24 @@ static uart_dev_t g_uartport =
{ 1 }, /* closesem */ { 1 }, /* closesem */
{ 0 }, /* xmitsem */ { 0 }, /* xmitsem */
{ 0 }, /* recvsem */ { 0 }, /* recvsem */
{ 0 }, /* pollsem */
{ /* xmit */ { /* xmit */
{ 1 }, /* sem */ { 1 }, /* sem */
0, /* head */ 0, /* head */
0, /* tail */ 0, /* tail */
CONFIG_UART_TXBUFSIZE, /* size */ CONFIG_UART_TXBUFSIZE, /* size */
g_uarttxbuffer, /* buffer */ g_uarttxbuffer /* buffer */
}, },
{ /* recv */ { /* recv */
{ 1 }, /* sem */ { 1 }, /* sem */
0, /* head */ 0, /* head */
0, /* tail */ 0, /* tail */
CONFIG_UART_RXBUFSIZE, /* size */ CONFIG_UART_RXBUFSIZE, /* size */
g_uartrxbuffer, /* buffer */ g_uartrxbuffer /* buffer */
}, },
&g_uart_ops, /* ops */ &g_uart_ops, /* ops */
NULL, /* priv */ NULL, /* priv */
NULL /* pollfds */
}; };
/**************************************************************************** /****************************************************************************

View File

@ -44,6 +44,10 @@ Other Versions
the configs/z8f64200100kit/*/Make.defs file and also your PATH environment the configs/z8f64200100kit/*/Make.defs file and also your PATH environment
variable. variable.
It has been a long time since the z8 port has been used. A lot has
changed so it would most likely require a modest effort to get the
compilation working again.
Configuration Subdirectories Configuration Subdirectories
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -142,14 +142,14 @@ static FAR bigint_t *g_freelist[KMAX + 1];
static FAR bigint_t *g_p5s; static FAR bigint_t *g_p5s;
#ifdef IEEE_ARITH #ifdef IEEE_ARITH
static const double g_bigtens[] = static const double_t g_bigtens[] =
{ {
1e16, 1e32, 1e64, 1e128, 1e256 1e16, 1e32, 1e64, 1e128, 1e256
}; };
# define n_bigtens 5 # define n_bigtens 5
#else #else
static const double g_bigtens[] = static const double_t g_bigtens[] =
{ {
1e16, 1e32 1e16, 1e32
}; };
@ -767,7 +767,7 @@ static FAR bigint_t *diff(FAR bigint_t *a, FAR bigint_t *b)
return c; return c;
} }
static FAR bigint_t *d2b(double d, int *e, int *bits) static FAR bigint_t *d2b(double_t d, int *e, int *bits)
{ {
FAR bigint_t *b; FAR bigint_t *b;
FAR unsigned long *x; FAR unsigned long *x;
@ -900,7 +900,7 @@ static FAR bigint_t *d2b(double d, int *e, int *bits)
return b; return b;
} }
static const double tens[] = static const double_t tens[] =
{ {
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
@ -1082,7 +1082,7 @@ static int quorem(FAR bigint_t *b, FAR bigint_t *s)
* calculation. * calculation.
*/ */
FAR char *__dtoa(double d, int mode, int ndigits, FAR int *decpt, FAR char *__dtoa(double_t d, int mode, int ndigits, FAR int *decpt,
FAR int *sign, FAR char **rve) FAR int *sign, FAR char **rve)
{ {
/* Arguments ndigits, decpt, sign are similar to those of ecvt and fcvt; /* Arguments ndigits, decpt, sign are similar to those of ecvt and fcvt;
@ -1120,9 +1120,9 @@ FAR char *__dtoa(double d, int mode, int ndigits, FAR int *decpt,
FAR bigint_t *s; FAR bigint_t *s;
FAR char *st; FAR char *st;
FAR char *st0; FAR char *st0;
double d2; double_t d2;
double ds; double_t ds;
double eps; double_t eps;
long l; long l;
unsigned long x; unsigned long x;
int denorm; int denorm;

View File

@ -39,6 +39,7 @@
#include <nuttx/compiler.h> #include <nuttx/compiler.h>
#include <sys/types.h>
#include <wchar.h> #include <wchar.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@ -505,7 +506,7 @@ static int getusize(uint8_t fmt, uint16_t flags, unsigned int n)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_LIBC_FLOATINGPOINT #ifdef CONFIG_LIBC_FLOATINGPOINT
static int getdblsize(uint8_t fmt, int trunc, uint16_t flags, double n) static int getdblsize(uint8_t fmt, int trunc, uint16_t flags, double_t n)
{ {
struct lib_outstream_s nulloutstream; struct lib_outstream_s nulloutstream;
lib_nulloutstream(&nulloutstream); lib_nulloutstream(&nulloutstream);
@ -1561,7 +1562,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
#ifdef CONFIG_LIBC_FLOATINGPOINT #ifdef CONFIG_LIBC_FLOATINGPOINT
else if (strchr("eEfgG", FMT_CHAR)) else if (strchr("eEfgG", FMT_CHAR))
{ {
double dblval = va_arg(ap, double); double_t dblval = va_arg(ap, double_t);
int dblsize; int dblsize;
if (FMT_CHAR == 'g' || FMT_CHAR == 'G') if (FMT_CHAR == 'g' || FMT_CHAR == 'G')

View File

@ -37,6 +37,7 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <sys/types.h>
#include "lib_dtoa_engine.h" #include "lib_dtoa_engine.h"
/**************************************************************************** /****************************************************************************
@ -68,7 +69,7 @@
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
const double g_dtoa_scale_up[] = const double_t g_dtoa_scale_up[] =
{ {
#if DBL_MAX_10_EXP >= 1 #if DBL_MAX_10_EXP >= 1
1e1, 1e1,
@ -123,7 +124,7 @@ const double g_dtoa_scale_up[] =
#endif #endif
}; };
const double g_dtoa_scale_down[] = const double_t g_dtoa_scale_down[] =
{ {
#if DBL_MIN_10_EXP <= -1 #if DBL_MIN_10_EXP <= -1
1e-1, 1e-1,
@ -178,7 +179,7 @@ const double g_dtoa_scale_down[] =
#endif #endif
}; };
const double g_dtoa_round[] = const double_t g_dtoa_round[] =
{ {
#if DBL_DIG >= 30 #if DBL_DIG >= 30
5e30, 5e30,

View File

@ -37,6 +37,7 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <sys/types.h>
#include <math.h> #include <math.h>
#include "lib_dtoa_engine.h" #include "lib_dtoa_engine.h"
@ -63,7 +64,7 @@
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits, int __dtoa_engine(double_t x, FAR struct dtoa_s *dtoa, int max_digits,
int max_decimals) int max_decimals)
{ {
int32_t exp = 0; int32_t exp = 0;
@ -92,7 +93,7 @@ int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits,
} }
else else
{ {
double y; double_t y;
exp = MIN_MANT_EXP; exp = MIN_MANT_EXP;

View File

@ -40,9 +40,12 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <sys/types.h>
#include <stdint.h> #include <stdint.h>
#include <float.h> #include <float.h>
#include <nuttx/lib/float.h>
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
@ -175,15 +178,15 @@ struct dtoa_s
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
extern const double g_dtoa_scale_up[]; extern const double_t g_dtoa_scale_up[];
extern const double g_dtoa_scale_down[]; extern const double_t g_dtoa_scale_down[];
extern const double g_dtoa_round[]; extern const double_t g_dtoa_round[];
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits, int __dtoa_engine(double_t x, FAR struct dtoa_s *dtoa, int max_digits,
int max_decimals); int max_decimals);
#endif /* __LIBS_LIBC_STDIO_LIB_DTOA_ENGINE_H */ #endif /* __LIBS_LIBC_STDIO_LIB_DTOA_ENGINE_H */

View File

@ -46,6 +46,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h> #include <stdbool.h>
#include <math.h> #include <math.h>
#include <assert.h> #include <assert.h>
@ -158,7 +159,7 @@ static void lib_dtoa_string(FAR struct lib_outstream_s *obj, const char *str)
****************************************************************************/ ****************************************************************************/
static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec,
uint16_t flags, double value) uint16_t flags, double_t value)
{ {
FAR char *digits; /* String returned by __dtoa */ FAR char *digits; /* String returned by __dtoa */
FAR char *rve; /* Points to the end of the return value */ FAR char *rve; /* Points to the end of the return value */

View File

@ -43,6 +43,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/types.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
@ -917,7 +918,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
else if (strchr("aAfFeEgG", *fmt) != NULL) else if (strchr("aAfFeEgG", *fmt) != NULL)
{ {
#ifdef CONFIG_HAVE_DOUBLE #ifdef CONFIG_HAVE_DOUBLE
FAR double *pd = NULL; FAR double_t *pd = NULL;
#endif #endif
FAR float *pf = NULL; FAR float *pf = NULL;
@ -937,7 +938,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
#ifdef CONFIG_HAVE_DOUBLE #ifdef CONFIG_HAVE_DOUBLE
if (modifier >= L_MOD) if (modifier >= L_MOD)
{ {
pd = va_arg(ap, FAR double *); pd = va_arg(ap, FAR double_t *);
*pd = 0.0; *pd = 0.0;
} }
else else
@ -970,7 +971,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
bool stopconv; bool stopconv;
int errsave; int errsave;
# ifdef CONFIG_HAVE_DOUBLE # ifdef CONFIG_HAVE_DOUBLE
double dvalue; double_t dvalue;
# endif # endif
float fvalue; float fvalue;
@ -1055,7 +1056,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
# ifdef CONFIG_HAVE_DOUBLE # ifdef CONFIG_HAVE_DOUBLE
if (modifier >= L_MOD) if (modifier >= L_MOD)
{ {
/* Get the converted double value */ /* Get the converted double_t value */
dvalue = strtod(tmp, &endptr); dvalue = strtod(tmp, &endptr);
} }
@ -1079,13 +1080,13 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
{ {
/* We have to check whether we need to return a float or /* We have to check whether we need to return a float or
* a double. * a double_t.
*/ */
# ifdef CONFIG_HAVE_DOUBLE # ifdef CONFIG_HAVE_DOUBLE
if (modifier >= L_MOD) if (modifier >= L_MOD)
{ {
/* Return the double value */ /* Return the double_t value */
linfo("Return %f to %p\n", dvalue, pd); linfo("Return %f to %p\n", dvalue, pd);
*pd = dvalue; *pd = dvalue;
@ -1095,7 +1096,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
{ {
/* Return the float value */ /* Return the float value */
linfo("Return %f to %p\n", (double)fvalue, pf); linfo("Return %f to %p\n", (double_t)fvalue, pf);
*pf = fvalue; *pf = fvalue;
} }

View File

@ -42,6 +42,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -131,7 +132,7 @@ struct arg
#ifdef CONFIG_LIBC_LONG_LONG #ifdef CONFIG_LIBC_LONG_LONG
unsigned long long ull; unsigned long long ull;
#endif #endif
double d; double_t d;
FAR char *cp; FAR char *cp;
} value; } value;
}; };
@ -493,7 +494,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
} }
else if (c >= 'e' && c <= 'g') else if (c >= 'e' && c <= 'g')
{ {
double value; double_t value;
int exp; /* Exponent of master decimal digit */ int exp; /* Exponent of master decimal digit */
int n; int n;
uint8_t sign; /* Sign character (or 0) */ uint8_t sign; /* Sign character (or 0) */
@ -542,14 +543,14 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
} }
else else
{ {
value = va_arg(ap, double); value = va_arg(ap, double_t);
} }
#else #else
value = va_arg(ap, double); value = va_arg(ap, double_t);
#endif #endif
ndigs = __dtoa_engine(value, &_dtoa, ndigs, ndigs = __dtoa_engine(value, &_dtoa, ndigs,
ndecimal); ndecimal);
exp = _dtoa.exp; exp = _dtoa.exp;
sign = 0; sign = 0;
@ -812,7 +813,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
#else /* !CONFIG_LIBC_FLOATINGPOINT */ #else /* !CONFIG_LIBC_FLOATINGPOINT */
if ((c >= 'E' && c <= 'G') || (c >= 'e' && c <= 'g')) if ((c >= 'E' && c <= 'G') || (c >= 'e' && c <= 'g'))
{ {
(void)va_arg(ap, double); (void)va_arg(ap, double_t);
pnt = "*float*"; pnt = "*float*";
size = sizeof("*float*") - 1; size = sizeof("*float*") - 1;
goto str_lpad; goto str_lpad;
@ -1228,7 +1229,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *stream,
break; break;
case TYPE_DOUBLE: case TYPE_DOUBLE:
arglist[i].value.d = va_arg(ap, double); arglist[i].value.d = va_arg(ap, double_t);
break; break;
case TYPE_CHAR_POINTER: case TYPE_CHAR_POINTER:

View File

@ -44,8 +44,9 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <debug.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <debug.h>
#include <nuttx/signal.h> #include <nuttx/signal.h>
@ -131,12 +132,19 @@ int nxsig_notification(pid_t pid, FAR struct sigevent *event,
info.si_signo = event->sigev_signo; info.si_signo = event->sigev_signo;
info.si_code = code; info.si_code = code;
info.si_errno = OK; info.si_errno = OK;
info.si_value = event->sigev_value;
#ifdef CONFIG_SCHED_HAVE_PARENT #ifdef CONFIG_SCHED_HAVE_PARENT
info.si_pid = rtcb->pid; info.si_pid = rtcb->pid;
info.si_status = OK; info.si_status = OK;
#endif #endif
/* Some compilers (e.g., SDCC), do not permit assignment of aggregates.
* Use of memcpy() is overkill; We could just copy the larger of the
* nt and FAR void * members in the union. memcpy(), however, does
* not require that we know which is larger.
*/
memcpy(&info.si_value, &event->sigev_value, sizeof(union sigval));
/* Send the signal */ /* Send the signal */
return nxsig_dispatch(pid, &info); return nxsig_dispatch(pid, &info);