From a3832be0ae169755506db1ca639ea394c57fe6e4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 23 Nov 2018 14:22:55 +0100 Subject: improved handling for __cxa_.._virtual() functions --- lib/arduino-stub.cpp | 20 -------------------- lib/stdc++-minimal.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 20 deletions(-) create mode 100644 lib/stdc++-minimal.cpp (limited to 'lib') diff --git a/lib/arduino-stub.cpp b/lib/arduino-stub.cpp index 39bd9cc..201962f 100644 --- a/lib/arduino-stub.cpp +++ b/lib/arduino-stub.cpp @@ -22,7 +22,6 @@ #define ARDUINO_MAIN #include "Arduino.h" -#include "stdlib.h" int atexit(void (* /*func*/ )()) { return 0; } @@ -1042,22 +1041,3 @@ long map(long x, long in_min, long in_max, long out_min, long out_max) unsigned int makeWord(unsigned int w) { return w; } unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } - - -// ****************** -// this is from Arduino's abi.cpp - -extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); -extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); - -void __cxa_pure_virtual(void) { - // We might want to write some diagnostics to uart in this case - //std::terminate(); - abort(); -} - -void __cxa_deleted_virtual(void) { - // We might want to write some diagnostics to uart in this case - //std::terminate(); - abort(); -} diff --git a/lib/stdc++-minimal.cpp b/lib/stdc++-minimal.cpp new file mode 100644 index 0000000..50b1947 --- /dev/null +++ b/lib/stdc++-minimal.cpp @@ -0,0 +1,41 @@ +/* + * spreadspace avr utils + * + * + * Copyright (C) 2014-2018 Christian Pointner + * + * This file is part of spreadspace avr utils. + * + * spreadspace avr utils 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 3 of the License, or + * any later version. + * + * spreadspace avr utils 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 spreadspace avr utils. If not, see . + */ + +#include "stdlib.h" +#include "stdio.h" + +extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); +extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); + +void __cxa_pure_virtual(void) { + // this only works with serialio, it won't work with usbio + // because we would need to call usbio_task() ... + printf("PANIC: __cxa_pure_virtual() got called ..."); + for(;;); +} + +void __cxa_deleted_virtual(void) { + // this only works with serialio, it won't work with usbio + // because we would need to call usbio_task() ... + printf("PANIC: __cxa_deleted_virtual() got called ..."); + for(;;); +} -- cgit v1.2.3