From 1f29aff77b6bbda0fecc636c8e33dcc2deab664e Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 22 Dec 2012 09:21:12 +0100 Subject: digital/ucoolib/ucoolib/arch: compile syscalls as C++ --- digital/ucoolib/ucoolib/arch/Module | 2 +- digital/ucoolib/ucoolib/arch/syscalls.cc | 36 +++++++ digital/ucoolib/ucoolib/arch/syscalls.newlib.c | 130 ------------------------ digital/ucoolib/ucoolib/arch/syscalls.newlib.cc | 130 ++++++++++++++++++++++++ digital/ucoolib/ucoolib/arch/syscalls_cc.cc | 36 ------- 5 files changed, 167 insertions(+), 167 deletions(-) create mode 100644 digital/ucoolib/ucoolib/arch/syscalls.cc delete mode 100644 digital/ucoolib/ucoolib/arch/syscalls.newlib.c create mode 100644 digital/ucoolib/ucoolib/arch/syscalls.newlib.cc delete mode 100644 digital/ucoolib/ucoolib/arch/syscalls_cc.cc (limited to 'digital') diff --git a/digital/ucoolib/ucoolib/arch/Module b/digital/ucoolib/ucoolib/arch/Module index f07eefca..6c23a203 100644 --- a/digital/ucoolib/ucoolib/arch/Module +++ b/digital/ucoolib/ucoolib/arch/Module @@ -1 +1 @@ -arch_SOURCES := arch.host.cc arch.stm32.cc syscalls.newlib.c syscalls_cc.cc +arch_SOURCES := arch.host.cc arch.stm32.cc syscalls.newlib.cc syscalls.cc diff --git a/digital/ucoolib/ucoolib/arch/syscalls.cc b/digital/ucoolib/ucoolib/arch/syscalls.cc new file mode 100644 index 00000000..030e7b40 --- /dev/null +++ b/digital/ucoolib/ucoolib/arch/syscalls.cc @@ -0,0 +1,36 @@ +// ucoolib - Microcontroller object oriented library. {{{ +// +// Copyright (C) 2012 Nicolas Schodet +// +// APBTeam: +// Web: http://apbteam.org/ +// Email: team AT apbteam DOT org +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// }}} + +namespace __gnu_cxx { + +/// Replaces the default verbose terminate handler. +/// Avoids the inclusion of code to inpect C++ objects. +void +__verbose_terminate_handler () +{ + while (1) + ; +} + +} //namespace __gnu_cxx diff --git a/digital/ucoolib/ucoolib/arch/syscalls.newlib.c b/digital/ucoolib/ucoolib/arch/syscalls.newlib.c deleted file mode 100644 index 308b4b1b..00000000 --- a/digital/ucoolib/ucoolib/arch/syscalls.newlib.c +++ /dev/null @@ -1,130 +0,0 @@ -/* ucoolib - Microcontroller object oriented library. {{{ - * - * Copyright (C) 2012 Nicolas Schodet - * - * APBTeam: - * Web: http://apbteam.org/ - * Email: team AT apbteam DOT org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * }}} */ -#include -#include -#include - -/** This is needed by C++ ABI, this simple definition will do. See: - * http://lists.debian.org/debian-gcc/2003/07/msg00057.html */ -void *__dso_handle = (void*) &__dso_handle; - -/** This function is called when a pure virtual function is called. This is - * needed by linker because when a abstract class constructor or destructor is - * called, object is not complete. Replace the one provided by the toolchain - * to avoid including the world. */ -void -__cxa_pure_virtual (void) -{ - while (1) - ; -} - -/** Increase program data space. */ -void * -_sbrk_r (struct _reent *ptr, int incr) -{ - extern char end; /* Defined in linker script. */ - static char *heap_end; - char *prev_heap_end; - if (heap_end == 0) - heap_end = &end; - prev_heap_end = heap_end; - heap_end += incr; - return (void *) prev_heap_end; -} - -/** Exit program, endless loop to stop program, to be improved. */ -void -_exit (int n) -{ - while (1) - ; -} - -/** Close a file, unimplemented. */ -int -_close_r (struct _reent *ptr, int fd) -{ - return -1; -} - -/** Status of open file, consider all files as character devices. */ -int -_fstat_r (struct _reent *ptr, int fd, struct stat *st) -{ - st->st_mode = S_IFCHR; - return 0; -} - -/** Get PID, minimal implementation. */ -int -_getpid_r (struct _reent *ptr) -{ - return 1; -} - -/** Whether file is a terminal, consider this is always true. */ -int -_isatty_r (struct _reent *ptr, int fd) -{ - return 1; -} - -/** Send a signal, no process, no signal. */ -int -_kill_r (struct _reent *ptr, int pid, int sig) -{ - ptr->_errno = EINVAL; - return -1; -} - -/** Set position in a file, no-op. */ -off_t -_lseek_r (struct _reent *ptr, int fd, off_t pos, int whence) -{ - return 0; -} - -/** Open a file, unimplemented. */ -int -_open_r (struct _reent *ptr, const char *file, int flags, int mode) -{ - return -1; -} - -/** Read from file, to be improved to read from stream. */ -int -_read_r (struct _reent *ptr, int fd, void *buf, size_t cnt) -{ - return 0; -} - -/** Write to file, to be improved to write to stream. */ -int -_write_r (struct _reent *ptr, int fd, const void *buf, size_t cnt) -{ - ptr->_errno = EBADF; - return -1; -} - diff --git a/digital/ucoolib/ucoolib/arch/syscalls.newlib.cc b/digital/ucoolib/ucoolib/arch/syscalls.newlib.cc new file mode 100644 index 00000000..1c12f177 --- /dev/null +++ b/digital/ucoolib/ucoolib/arch/syscalls.newlib.cc @@ -0,0 +1,130 @@ +/* ucoolib - Microcontroller object oriented library. {{{ + * + * Copyright (C) 2012 Nicolas Schodet + * + * APBTeam: + * Web: http://apbteam.org/ + * Email: team AT apbteam DOT org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * }}} */ +#include +#include +#include + +/** This is needed by C++ ABI, this simple definition will do. See: + * http://lists.debian.org/debian-gcc/2003/07/msg00057.html */ +void *__dso_handle = (void*) &__dso_handle; + +/** This function is called when a pure virtual function is called. This is + * needed by linker because when a abstract class constructor or destructor is + * called, object is not complete. Replace the one provided by the toolchain + * to avoid including the world. */ +extern "C" void +__cxa_pure_virtual (void) +{ + while (1) + ; +} + +/** Increase program data space. */ +extern "C" void * +_sbrk_r (struct _reent *ptr, int incr) +{ + extern char end; /* Defined in linker script. */ + static char *heap_end; + char *prev_heap_end; + if (heap_end == 0) + heap_end = &end; + prev_heap_end = heap_end; + heap_end += incr; + return (void *) prev_heap_end; +} + +/** Exit program, endless loop to stop program, to be improved. */ +extern "C" void +_exit (int n) +{ + while (1) + ; +} + +/** Close a file, unimplemented. */ +extern "C" int +_close_r (struct _reent *ptr, int fd) +{ + return -1; +} + +/** Status of open file, consider all files as character devices. */ +extern "C" int +_fstat_r (struct _reent *ptr, int fd, struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; +} + +/** Get PID, minimal implementation. */ +extern "C" int +_getpid_r (struct _reent *ptr) +{ + return 1; +} + +/** Whether file is a terminal, consider this is always true. */ +extern "C" int +_isatty_r (struct _reent *ptr, int fd) +{ + return 1; +} + +/** Send a signal, no process, no signal. */ +extern "C" int +_kill_r (struct _reent *ptr, int pid, int sig) +{ + ptr->_errno = EINVAL; + return -1; +} + +/** Set position in a file, no-op. */ +extern "C" off_t +_lseek_r (struct _reent *ptr, int fd, off_t pos, int whence) +{ + return 0; +} + +/** Open a file, unimplemented. */ +extern "C" int +_open_r (struct _reent *ptr, const char *file, int flags, int mode) +{ + return -1; +} + +/** Read from file, to be improved to read from stream. */ +extern "C" int +_read_r (struct _reent *ptr, int fd, void *buf, size_t cnt) +{ + return 0; +} + +/** Write to file, to be improved to write to stream. */ +extern "C" int +_write_r (struct _reent *ptr, int fd, const void *buf, size_t cnt) +{ + ptr->_errno = EBADF; + return -1; +} + diff --git a/digital/ucoolib/ucoolib/arch/syscalls_cc.cc b/digital/ucoolib/ucoolib/arch/syscalls_cc.cc deleted file mode 100644 index 030e7b40..00000000 --- a/digital/ucoolib/ucoolib/arch/syscalls_cc.cc +++ /dev/null @@ -1,36 +0,0 @@ -// ucoolib - Microcontroller object oriented library. {{{ -// -// Copyright (C) 2012 Nicolas Schodet -// -// APBTeam: -// Web: http://apbteam.org/ -// Email: team AT apbteam DOT org -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// }}} - -namespace __gnu_cxx { - -/// Replaces the default verbose terminate handler. -/// Avoids the inclusion of code to inpect C++ objects. -void -__verbose_terminate_handler () -{ - while (1) - ; -} - -} //namespace __gnu_cxx -- cgit v1.2.3