Skip to content
Angus Gratton edited this page Jul 15, 2015 · 6 revisions

libc overview

Espressif's RTOS SDK provides libc functions as part of binary libmain.

esp-open-rtos replaces these with a newlib libc compiled from source.

crosstool-NG as used in esp-open-sdk provides a newlib 2.0 implementation. However it isn't thread-safe when used with FreeRTOS' preemptive threading model.

esp-open-rtos libc

For now we supply our own libc in the 'libc' directory. This is newlib 2.2.0 plus xtensa patches and a locking implementation patch. Using newlib 2.2.0 also allows pulling in the "nano" features for smaller malloc and I/O format implementation.

Source: https://github.com/projectgus/newlib-xtensa

Any commits that update the 'libc' directory list the newlib commit that the library was built from.

Configure arguments used for newlib:

../configure --with-newlib --enable-multilib --disable-newlib-io-c99-formats --disable-newlib-io-long-long --disable-newlib-io-float --disable-newlib-io-long-double --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 --prefix=/home/gus/dev/esp/rtos/open-rtos/libc/ --enable-newlib-nano-malloc --enable-newlib-nano-formatted-io

(Disabling some io features may be redundant given nano-formatted-io).

Using system libc

Pass OWN_LIBC=0 to make (see Build Process) to compile & link with the toolchain-provided "system" libc instead of the esp-open-rtos libc.

Clone this wiki locally