1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Fix malloc/free references

This commit is contained in:
Ivan Grokhotkov 2014-12-01 00:34:28 +03:00
parent 39e087a19e
commit ea599139d5
5 changed files with 35 additions and 10 deletions

View File

@ -46,6 +46,11 @@ extern void (*__init_array_end)(void);
static cont_t g_cont; static cont_t g_cont;
static os_event_t g_loop_queue[LOOP_QUEUE_SIZE]; static os_event_t g_loop_queue[LOOP_QUEUE_SIZE];
extern "C" void abort()
{
while(1){}
}
extern "C" void esp_yield() extern "C" void esp_yield()
{ {
cont_yield(&g_cont); cont_yield(&g_cont);

View File

@ -17,20 +17,27 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
extern "C" {
#include "ets_sys.h"
#include "os_type.h"
#include "osapi.h"
#include "mem.h"
#include "user_interface.h"
}
void *operator new(size_t size) { void *operator new(size_t size) {
return malloc(size); return os_malloc(size);
} }
void *operator new[](size_t size) { void *operator new[](size_t size) {
return malloc(size); return os_malloc(size);
} }
void operator delete(void * ptr) { void operator delete(void * ptr) {
free(ptr); os_free(ptr);
} }
void operator delete[](void * ptr) { void operator delete[](void * ptr) {
free(ptr); os_free(ptr);
} }

View File

@ -1,37 +1,47 @@
#include <stdlib.h> #include <stdlib.h>
#include "stdlib_noniso.h" #include "stdlib_noniso.h"
char * itoa (int val, char *s, int radix) long atol_internal(const char* s)
{
return 0;
}
float atof_internal(const char* s)
{
return 0;
}
char * itoa (int val, char *s, int radix)
{ {
*s = 0; *s = 0;
return s; return s;
} }
char * ltoa (long val, char *s, int radix) char * ltoa (long val, char *s, int radix)
{ {
*s = 0; *s = 0;
return s; return s;
} }
char * utoa (unsigned int val, char *s, int radix) char * utoa (unsigned int val, char *s, int radix)
{ {
*s = 0; *s = 0;
return s; return s;
} }
char * ultoa (unsigned long val, char *s, int radix) char * ultoa (unsigned long val, char *s, int radix)
{ {
*s = 0; *s = 0;
return s; return s;
} }
char * dtostre (double __val, char *__s, unsigned char __prec, unsigned char __flags) char * dtostre (double __val, char *__s, unsigned char __prec, unsigned char __flags)
{ {
*__s = 0; *__s = 0;
return __s; return __s;
} }
char * dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) char * dtostrf (double __val, signed char __width, unsigned char __prec, char *__s)
{ {
*__s = 0; *__s = 0;
return __s; return __s;

View File

@ -5,6 +5,9 @@
extern "C"{ extern "C"{
#endif #endif
long atol_internal(const char*);
float atof_internal(const char*);
char* itoa (int val, char *s, int radix); char* itoa (int val, char *s, int radix);

0
cores/esp8266/user_config.h Executable file → Normal file
View File