Skip to content

Repository files navigation

Morelibc

Picolibc is an excellent C runtime library for small or embedded systems. However sometimes we want more than what can be offered in Picolibc. This is where Morelibc comes in. Morelibc is an add-on to Picolibc that provides more of the standard C/POSIX programming interface which developers are accustomed to. Specifically Morelibc provides:

  • Multi-threaded concurrency through integration with FreeRTOS and including implementations of select and poll.
  • A virtual file system (VFS) providing a Unix-like directory structure, the ability to mount additional storage devices, and implement additional file system types.
  • A simple driver model for implementing hardware-specific drivers for storage (block) and communication (character) devices.
  • Dynamic linking support (i.e., DLLs or shared libraries) to allow libraries to be built, distributed, and installed without recompiling or reinstalling the firmware.

Supported platforms

  • Raspberry Pi RP2040 and RP2350

In theory, support can be added for any platform that supports Picolibc and FreeRTOS.

Integrations

This project also contains a number of optional components for integrating popular embedded system libraries with the Morelibc core.

  • FatFS: driver for FAT file system
  • littlefs: driver for littlefs file system
  • lwIP: socket programming interface
  • TinyUSB: drivers for CDC (serial) and MSC (storage) devices (USB device-side only)
  • Mbed-TLS: sockets with TLS support

Building

Toolchain

Download and extract the ARM GNU toolchain, if you don't already have it. Make sure the bin directory containing the compiler etc. is in your PATH environment variable.

Picolibc

Run the script build_picolibc.sh to build Picolibc. The script will install Picolibc into the GCC sysroot location, which is where you previously extracted the toolchain. See the Picolibc documentation for more info on building Picolibc, including installing its prerequisites.

Morelibc

Morelibc is built using CMake. To build the minimal example:

morelibc/example$ cmake -B build
morelibc/example$ cmake --build build

This will download FreeRTOS and Pico SDK to be self-contained. An established project can use its existing copies of these projects, although particular versions may matter.

MicroPythonRT is an example of using Morelibc in a larger project.

Documentation

About

Adds more of the standard C/POSIX programming interface to Picolibc.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages