PicoLibc 1.1 standard C library available

Keith Packard, active Debian developer, leader of the X.Org project and creator of many X extensions, including XRender, XComposite and XRandR, presented release of a new standard C library PicoLibc 1.1, developed for use on embedded devices with a limited amount of permanent storage and RAM. During development, part of the code was borrowed from the library newlib from the Cygwin project and AVR Libc, developed for Atmel AVR microcontrollers. PicoLibc Code spreads under BSD license. Library assembly is supported for ARM (32-bit), i386, RISC-V, x86_64 and PowerPC architectures.

Keith Packard began development after being unable to find a decent Libc option that could be used on embedded devices with little RAM. The project has been developing since last year. At the first stage, the project was a variant of newlib, the functions of stdio in which were replaced with a compact version from avrlibc (stdio in newlib was not suitable for its high resource consumption). Since Keith's current work involves ongoing work with the RISC-V architecture and development of tooling for embedded devices, he recently reviewed the state of libc implementations and concluded that with a little tweaking, the combination of newlib and avrlibc could be a good general-purpose solution. Initially, the project developed under the name β€œnewlib-nano”, but to avoid confusion with the Newlib library it was renamed PicoLibc.

In its current form, Picolibc has already done work to remove all code that is not supplied under a BSD license (this code was not used when building for embedded devices), which has significantly simplified the situation with the license for the project. The implementation of local streams has been moved from 'struct _reent' to the TLS mechanism (thread-local storage). The compact version of stdio, borrowed from the avrlibc library code, is activated by default (ATmel-specific assembler inserts are rewritten in C). The Meson toolkit was used for assembly, which made it possible not to be tied to newlib assembly scripts and to simplify the transfer of changes from newlib. Added a simplified version of the initialization code (crt0), attached to the executable file and executed before control is transferred to the main() function.

In Picolibc version 1.1:

  • Added auxiliary library to support the technology "semihosting"allows code running in a debugger or emulator environment to use the host system's I/O mechanisms;
  • For systems that support the open, close, read, and write system calls, tinystdio adds standardized POSIX stdio I/O interfaces, including the fopen and fdopen functions, as well as binding stdin/stdout/stderr to POSIX-defined file descriptors;
  • Recent changes from the newlib codebase have been carried over. Including added libm stubs for fev.h, which can be used on systems without floating point support;
  • Added an example of building the β€œHello world” application with picolibc for ARM and RISC-V systems;
  • Removed the newlib, libm and mathfp directories, which contained unused experimental code.

Source: opennet.ru

Add a comment