Keith Packard, an active Debian developer, X.Org project leader, and creator of numerous X extensions including XRender, XComposite, and XRandR, announces the release of a new standard C library , developed for use on embedded devices with limited permanent storage and RAM. In the development, part of the code was borrowed from the library from the Cygwin project and , which was developed for Atmel AVR microcontrollers. The code of PicoLibc is licensed under BSD. The library supports builds for ARM (32-bit), i386, RISC-V, x86_64, and PowerPC architectures.
Keith Packard started development after failing to find a suitable Libc option for use on embedded devices with low RAM. The project has been evolving since last year. Initially, the project was a version of newlib, with stdio functions replaced by a compact version from avrlibc (the stdio in newlib was too resource-hungry). Since Keith's current work involves ongoing engagement with RISC-V architecture and the development of tools for embedded devices, he recently reviewed the state of libc implementations and concluded that with minor adjustments, a combination of newlib and avrlibc could become a good universal solution. The project was initially developed under the name "newlib-nano" but was renamed to PicoLibc to avoid confusion with the Newlib library.
In its current form, Picolibc has already seen the removal of all code not provided under the BSD license (this code was not used in the builds for embedded devices), which significantly simplified the project's licensing situation. The implementation of local threads has been switched from 'struct _reent' to the TLS mechanism (). The compact version of stdio, borrowed from the avrlibc library code, is enabled by default (ATmel-specific assembly inserts have been rewritten in C). The Meson toolchain is used for builds, allowing for independence from newlib’s build scripts and simplifying the transfer of changes from newlib. A simplified initialization code (crt0) has been added, which is attached to the executable and runs before control is handed over to the main() function.
In version Picolibc 1.1:
- An auxiliary library has been added to support the technology ““, allowing code running in a debugger or emulator environment to utilize the input/output mechanisms of the host system;
- For systems that support the open, close, read, and write system calls, standardized POSIX input/output interfaces have been added to tinystdio, including the functions fopen and fdopen, as well as binding stdin/stdout/stderr to specific POSIX file descriptors;
- Recent changes from the newlib codebase have been migrated. This includes the addition of stubs for libm , which can be used on systems without support for floating-point computations;
- An example of building a “Hello world” application with picolibc for ARM and RISC-V systems has been added;
- Directories newlib, libm, and mathfp containing unused experimental code have been removed.
Source: opennet.ru
