galileo: Replace non-halting core implementation of assert with the halting one from newlib

This patch modifies the include order to include headers from newlib
ahead of those from the core of Contiki.  The only header file names
that are common between Contiki and newlib are assert.h and config.h,
but the config.h files in Contiki are only located in ports for other
CPUs so they are irrelevant to this patch.  The motivation for this
patch is to cause files that include assert.h to include the one from
newlib that halts when an assertion fails.  The assert implementation
in the core of Contiki does not halt when an assertion fails.

This patch also adds newlib syscall stubs that are required by the
newlib assert implementation and the _exit syscall function that halts
the system.

Finally, this patch updates some other newlib syscall stubs to
properly indicate their status as unsupported syscalls.
This commit is contained in:
Michael LeMay 2015-07-23 14:17:55 -07:00 committed by Jesus Sanchez-Palencia
parent 06e25c487a
commit 17b855aac9
2 changed files with 27 additions and 3 deletions

View file

@ -12,7 +12,7 @@ PROJECT_SOURCEFILES += newlib-syscalls.c
CONTIKI_CPU=$(CONTIKI)/cpu/x86
include $(CONTIKI)/cpu/x86/Makefile.x86_quarkX1000
CFLAGS += -fno-stack-protector -nostdinc -isystem $(LIBC)/include -isystem $(LIBGCC_PATH)/include -isystem $(LIBGCC_PATH)/include-fixed
CFLAGS += -fno-stack-protector -nostdinc -I$(LIBC)/include -isystem $(LIBGCC_PATH)/include -isystem $(LIBGCC_PATH)/include-fixed
LDFLAGS += -nostdlib -L$(LIBC)/lib -L$(LIBGCC_PATH)/32
TARGET_LIBFILES += -lm -lc -lgcc

View file

@ -32,6 +32,7 @@
#include <errno.h>
#include "uart.h"
#include "helpers.h"
#define CONSOLE_OUTPUT_DEV QUARK_X1000_UART_1
@ -48,19 +49,42 @@ _close_r(struct _reent *ptr, int file)
return -1;
}
/*---------------------------------------------------------------------------*/
void
_exit(int status)
{
halt();
}
/*---------------------------------------------------------------------------*/
int
_getpid_r(struct _reent *ptr)
{
/* Stubbed function */
ptr->_errno = ENOTSUP;
return -1;
}
/*---------------------------------------------------------------------------*/
int
_isatty_r(struct _reent *ptr, int file)
{
/* Stubbed function */
ptr->_errno = ENOTSUP;
return 0;
}
/*---------------------------------------------------------------------------*/
int
_kill_r(struct _reent *ptr, int pid, int signal)
{
/* Stubbed function */
ptr->_errno = ENOTSUP;
return -1;
}
/*---------------------------------------------------------------------------*/
int
_read_r(struct _reent *ptr, int file, char *buf, int len)
{
/* Stubbed function */
ptr->_errno = ENOTSUP;
return 0;
return -1;
}
/*---------------------------------------------------------------------------*/
int
@ -107,7 +131,7 @@ _lseek_r(struct _reent *ptr, int file, int p, int dir)
{
/* Stubbed function */
ptr->_errno = ENOTSUP;
return 0;
return -1;
}
/*---------------------------------------------------------------------------*/
int