Skip to content

Commit d7d98d0

Browse files
authored
Use libc from newlib (#1752)
* Use newlib libc library This change adds libcmin.a, which is created from newlib libc by selectively removing some of the object files (mostly related to heap management). The list of files is available in tools/sdk/lib/make_libcmin.sh. Files which are not needed are commented out. This change adds support for various functions which were missing, like sscanf, strftime, etc. * Fix some of the time functions * Redirect stdout to serial * Implement __putc_r * Switch to custom newlib build Built from https://github.com/igrr/newlib-xtensa using: ./configure --with-newlib --enable-multilib --disable-newlib-io-c99-formats --enable-newlib-supplied-syscalls --enable-target-optspace --program-transform-name="s&^&xtensa-lx106-elf-&" --disable-option-checking --with-target-subdir=xtensa-lx106-elf --target=xtensa-lx106-elf --enable-newlib-nano-formatted-io --enable-newlib-reent-small --prefix=path-to-arduino-core/tools/sdk/libc CROSS_CFLAGS="-DMALLOC_PROVIDED -DSIGNAL_PROVIDED -DABORT_PROVIDED" make make install * Update tests
1 parent d28c551 commit d7d98d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+14937
-565
lines changed

cores/esp8266/heap.c

+21
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,27 @@
66
#include <stdlib.h>
77
#include "umm_malloc/umm_malloc.h"
88
#include <c_types.h>
9+
#include <sys/reent.h>
10+
11+
void* _malloc_r(struct _reent* unused, size_t size)
12+
{
13+
return malloc(size);
14+
}
15+
16+
void _free_r(struct _reent* unused, void* ptr)
17+
{
18+
return free(ptr);
19+
}
20+
21+
void* _realloc_r(struct _reent* unused, void* ptr, size_t size)
22+
{
23+
return realloc(ptr, size);
24+
}
25+
26+
void* _calloc_r(struct _reent* unused, size_t count, size_t size)
27+
{
28+
return calloc(count, size);
29+
}
930

1031
void* ICACHE_RAM_ATTR pvPortMalloc(size_t size, const char* file, int line)
1132
{

0 commit comments

Comments
 (0)