diff --git a/os/various/cpp_wrappers/chcpp.mk b/os/various/cpp_wrappers/chcpp.mk index b1a546605..8d17a0724 100644 --- a/os/various/cpp_wrappers/chcpp.mk +++ b/os/various/cpp_wrappers/chcpp.mk @@ -1,9 +1,11 @@ -# C++ wrapper files. -CHCPPSRC = $(CHIBIOS)/os/various/cpp_wrappers/ch.cpp \ - $(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp +# C++ wrapper files. +CHCPPSRC = $(CHIBIOS)/os/various/syscalls.c + +CHCPPSRCPP = $(CHIBIOS)/os/various/cpp_wrappers/ch.cpp -CHCPPINC = $(CHIBIOS)/os/various/cpp_wrappers +CHCPPINC = $(CHIBIOS)/os/various/cpp_wrappers # Shared variables -ALLCPPSRC += $(CHCPPSRC) +ALLCSRC += $(CHCPPSRC) +ALLCPPSRC += $(CHCPPSRCPP) ALLINC += $(CHCPPINC) diff --git a/os/various/cpp_wrappers/syscalls_cpp.cpp b/os/various/cpp_wrappers/syscalls_cpp.cpp deleted file mode 100644 index d7d6d92a8..000000000 --- a/os/various/cpp_wrappers/syscalls_cpp.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -#include "osal.h" - -#include "syscalls_cpp.hpp" - -#ifdef __cplusplus -extern "C" { -#endif - -void _exit(int status){ - (void) status; - osalSysHalt("Unrealized"); - while(TRUE){} -} - -pid_t _getpid(void){ - return 1; -} - -#undef errno -extern int errno; -int _kill(int pid, int sig) { - (void)pid; - (void)sig; - errno = EINVAL; - return -1; -} - -void _open_r(void){ - return; -} - -void __cxa_pure_virtual() { - osalSysHalt("Pure virtual function call."); -} - -#ifdef __cplusplus -} -#endif diff --git a/os/various/cpp_wrappers/syscalls_cpp.hpp b/os/various/cpp_wrappers/syscalls_cpp.hpp deleted file mode 100644 index 681ce2cb2..000000000 --- a/os/various/cpp_wrappers/syscalls_cpp.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef SYSCALLS_CPP_HPP_ -#define SYSCALLS_CPP_HPP_ - -/* The ABI requires a 32-bit type.*/ -typedef int __guard; - -int __cxa_guard_acquire(__guard *); -void __cxa_guard_release (__guard *); -void __cxa_guard_abort (__guard *); - -void *__dso_handle = NULL; - -#endif /* SYSCALLS_CPP_HPP_ */ diff --git a/os/various/syscalls.c b/os/various/syscalls.c index b2052e954..ae52bdced 100644 --- a/os/various/syscalls.c +++ b/os/various/syscalls.c @@ -117,6 +117,19 @@ int _write_r(struct _reent *r, int file, char * ptr, int len) { /***************************************************************************/ +__attribute__((used)) +int _open_r(struct _reent *r, const char *p, int a, int b) { + + (void)r; + (void)p; + (void)a; + (void)b; + __errno_r(r) = EINVAL; + return -1; +} + +/***************************************************************************/ + __attribute__((used)) int _close_r(struct _reent *r, int file) { (void)r; @@ -181,9 +194,10 @@ void _exit(int status) { /***************************************************************************/ __attribute__((used)) -int _kill(int pid, int sig) { +int _kill_r(struct _reent *r, int pid, int sig) { (void) pid; (void) sig; + __errno_r(r) = EINVAL; return -1; }