git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14930 27425a3e-05d8-49a3-a47f-9c15f0e5edd8

This commit is contained in:
Giovanni Di Sirio 2021-10-21 10:03:37 +00:00
parent d694445930
commit bfebc16ac6
4 changed files with 22 additions and 60 deletions

View File

@ -1,9 +1,11 @@
# C++ wrapper files.
CHCPPSRC = $(CHIBIOS)/os/various/cpp_wrappers/ch.cpp \
$(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp
CHCPPSRC = $(CHIBIOS)/os/various/syscalls.c
CHCPPINC = $(CHIBIOS)/os/various/cpp_wrappers
CHCPPSRCPP = $(CHIBIOS)/os/various/cpp_wrappers/ch.cpp
CHCPPINC = $(CHIBIOS)/os/various/cpp_wrappers
# Shared variables
ALLCPPSRC += $(CHCPPSRC)
ALLCSRC += $(CHCPPSRC)
ALLCPPSRC += $(CHCPPSRCPP)
ALLINC += $(CHCPPINC)

View File

@ -1,41 +0,0 @@
#include <stdio.h>
#include <errno.h>
#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

View File

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

View File

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