SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.52k stars 491 forks source link

Improved C++ support, support C++ exceptions #625

Closed joostn closed 6 years ago

joostn commented 6 years ago

These patches make it possible to link against libstdc++, and use C++ exceptions.

To use c++ exceptions, build a gcc 5.2.0 toolchain from https://github.com/espressif/crosstool-NG with -fexceptions and -frtti enabled. You can use my build script for mac: buildtoolchain.sh.zip

Add the following startup code to your application:

struct register_frame_info_object { long placeholder[ 10 ]; };
extern "C" void __register_frame_info (const void *begin, struct register_frame_info_object *ob);
extern char __eh_frame[];

extern "C" void user_init()
{
    static struct register_frame_info_object ob;
    __register_frame_info( __eh_frame, &ob );

[...]
}

More info: https://github.com/jcmvbkbc/crosstool-NG/issues/54 https://github.com/espressif/esp-idf/issues/459 https://github.com/SuperHouse/esp-open-rtos/issues/623

UncleRus commented 6 years ago

Thank you!