Experimental newlib support
August 19, 2025 ยท View on GitHub
Arm Toolchain for Embedded uses picolibc
as the standard C library. For compatibility with existing projects using
newlib, a separate package of newlib-based
library variants is provided.
Warning
newlib support in Arm Toolchain for Embedded is experimental
and may change in following releases.
Using pre-built newlib library package
-
Install Arm Toolchain for Embedded
-
Download corresponding
ATfE-newlib-overlaypackage and extract it on top of the main toolchain folder.- Note: The overlay package copies all the
newliblibrary variants into thelib/clang-runtimes/newlibsubdirectory, so that they do not collide with thepicolibcvariants inlib/clang-runtimes. It also adds thenewlib.cfginto thebindirectory, which switches the--sysrootto thenewlibsubdirectory above.
- Note: The overlay package copies all the
-
Add the
newlib.cfgconfig file to the command line to usenewliblibrary variants instead ofpicolibc. -
Add
-lrdimonand-lcrt0-rdimonto the command line to use semihosting or-lnosysand-lcrt0-nosysotherwise. -
You may use the provided default linker script by adding
-T redboot.ldto the command line.
Example:
$ clang --config=newlib.cfg --target=arm-none-eabi -march=armv7m -T redboot.ld -lrdimon -lcrt0-rdimon -o hello hello.c
Building newlib library package
Important
Building newlib package is only supported on Linux and macOS.
Configure the toolchain with the CMake setting
-DLLVM_TOOLCHAIN_C_LIBRARY=newlib to build a newlib-based version of
the toolchain.
If you also add -DLLVM_TOOLCHAIN_LIBRARY_OVERLAY_INSTALL=on then the
package-llvm-toolchain CMake target will generate the newlib
overlay package.
Note that the -DLLVM_TOOLCHAIN_LIBRARY_OVERLAY_INSTALL=on option
only generates the newlib package, but does not install it as part
of the install CMake target.
About newlib-nano
newlib-nano is provided as a separate package, and is meant to be equal
to using GCC with --specs=nano.specs. In order to use the nano version
of newlib, where the documentation in this file refers to newlib, replace
it with newlib-nano.