Picolibc: C Libraries for Smaller Embedded Systems

Picolibc is a set of standard C libraries, both libc and libm, designed for smaller embedded systems with limited ROM and RAM. Picolibc includes code from Newlib and AVR Libc. Picolibc has been tested on RISC-V and ARM processors.

Picolibc was previously named newlib-nano, but that name has another definition within newlib and so the Picolibc name was adopted instead.

Current Status

Version 1.4.7 was released 2020-10-25

Releases

Picolibc packages are available in the dist directory here

Version 1.4.7 Release Notes

  1. Fix numerous libm exception and errno bugs. The math functions are all now verified to match the C19 and Posix standards in this area.

  2. Change behavior of 'gamma' function to match glibc which returns lgamma for this function. Applications should not use this function, they should pick either lgamma or tgamma as appropriate.

  3. Fix fma/fmaf on arm and RISC-V so that the machine-specific versions are used when the hardware has support. Also fix the math library to only use fma/fmaf when it is supported by the hardware.

  4. Fix numerous nano-malloc bugs, especially with unusual parameters.

  5. Change nano-malloc to always clear returned memory.

  6. Improve nano-realloc to perform better in various ways, including merging adjacent free blocks and expanding the heap.

  7. Add malloc tests, both a basic functional test and a stress test.

  8. Improve build portability to Windows. Picolibc should now build using mingw.

  9. Use hardware TLS register on ARM when available.

  10. Support clang compiler. Thanks to Denis Feklushkin denis.feklushkin@gmail.com and Joakim NohlgÄrd joakim@nohlgard.se.

  11. Avoid implicit float/double conversions. Check this by having clang builds use -Wdouble-promotion -Werror=double-promotion flags

  12. Have portable code check for machine-specific overrides by matching filenames. This avoids building libraries with duplicate symbols and retains compatibility with newlib (which uses a different mechanism for this effect).

  13. Patches to support building with CompCert, a formally verified compiler. Thanks to Sebastian Meyer meyer@absint.com.

Documentation

There's a bunch of documentation written in common mark, which this ikiwiki instance doesn't handle, so for now here are links to the pages rendered at github:

Debian Packages

Pre-built Debian packages for Debian unstable are available upstream

There are four Picolibc packages in the archive:

  • picolibc-riscv64-unknown-elf. RISC-V embedded libraries, built using gcc-riscv64-unknown-elf.

  • picolibc-arm-none-eabi. ARM embedded libraries, built using gcc-arm-none-eabi

  • picolibc-xtensa-lx106-elf. ESP8266 Xtensa lx106 embedded libraries, built using gcc-xtensa-lx106-elf.

  • picolibc-aarch64-linux-gnu. 64-bit ARM embedded libraries, built using gcc-aarch64-linux-gnu (that's the only compiler for this architecture).

Source Code

You can find Picolibc in either my git repository or github

As Picolibc is a combination of code from both Newlib and AVR-libc, the licensing of the source code is fairly complicated, but the general result is similar to the BSD 3-clause or MIT license.

Contributing

Changes to picolibc code, or to the picolibc build environment, can be submitted in the github project above, or to the picolibc mailing list. Changes to code shared with newlib should also be submitted to newlib.