Add C++ support to Makefile, and proof-of-concept simple.cpp example

This is a work in progress based on @mikejac's work.

Missing:
* No 'new' operator.
* I don't think STL is currently supported.
This commit is contained in:
Angus Gratton 2015-08-10 15:51:57 +10:00
parent 372827ac42
commit cc97067fa1
5 changed files with 92 additions and 3 deletions

View file

@ -14,3 +14,18 @@ void IRAM *zalloc(size_t nbytes)
{
return calloc(1, nbytes);
}
extern void (*__init_array_start)(void);
extern void (*__init_array_end)(void);
/* Do things which should be done as part of the startup code, but aren't.
Can be replaced with _start() once we have open source startup code.
*/
void sdk_compat_initialise()
{
/* Call C++ constructors or C functions marked with __attribute__((constructor)) */
void (**p)(void);
for ( p = &__init_array_start; p != &__init_array_end; ++p)
(*p)();
}