Merge branch 'feature/c++'
This commit is contained in:
commit
df8eaeec8c
29 changed files with 801 additions and 14 deletions
25
core/cplusplus_operators.cpp
Normal file
25
core/cplusplus_operators.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* Part of esp-open-rtos
|
||||
* BSD Licensed as described in the file LICENSE
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void *operator new(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void *operator new[](size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void operator delete(void * ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void * ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
|
@ -10,6 +10,8 @@
|
|||
#ifndef _COMMON_MACROS_H
|
||||
#define _COMMON_MACROS_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#define UNUSED __attributed((unused))
|
||||
|
||||
#ifndef BIT
|
||||
|
@ -45,7 +47,11 @@
|
|||
Important to note: IROM flash can only be accessed via 32-bit word
|
||||
aligned reads. It's up to the user of this attribute to ensure this.
|
||||
*/
|
||||
#define IROM __attribute__((section(".irom0.literal"))) const
|
||||
#ifdef __cplusplus
|
||||
#define IROM __attribute__((section(".irom0.literal")))
|
||||
#else
|
||||
#define IROM __attribute__((section(".irom0.literal"))) const
|
||||
#endif
|
||||
|
||||
#define INLINED inline static __attribute__((always_inline)) __attribute__((unused))
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ INLINED void gpio_set_interrupt(const uint8_t gpio_num, const gpio_inttype_t int
|
|||
/* Return the interrupt type set for a pin */
|
||||
INLINED gpio_inttype_t gpio_get_interrupt(const uint8_t gpio_num)
|
||||
{
|
||||
return FIELD2VAL(GPIO_CONF_INTTYPE, GPIO.CONF[gpio_num]);
|
||||
return (gpio_inttype_t)FIELD2VAL(GPIO_CONF_INTTYPE, GPIO.CONF[gpio_num]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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)();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue