Table of Contents
ChibiOS/LIB – High‑Level Extensions for ChibiOS RTOS Kernels
ChibiOS/LIB is an extension library that adds higher‑level mechanisms on top of the ChibiOS/RT and ChibiOS/NIL kernels.
It provides portable, architecture‑independent components such as queues, allocators, delegates, and dynamic object management, allowing you to build more complex applications while keeping the underlying kernel small and deterministic.
In Brief
- Portable – entirely architecture‑ and compiler‑independent; works across all supported ChibiOS ports.
- Enhances both RT and NIL – adds high‑level constructs to ChibiOS/RT and ChibiOS/NIL, using the same library.
- Clean, modular code base – designed to be easy to read, audit, and integrate.
- Single commercial license – the commercial version covers both RT and NIL; there is no need to purchase it twice.
Added Functionalities
For a detailed description of functionalities, please refer to the reference manuals. In brief:
Binary Semaphores
Two‑state semaphores (taken / released), a useful variant of counting semaphores for simple synchronization patterns.
Mailboxes
Queues of messages between Thread/ISR and Thread/ISR, where messages are pointer‑sized values. Suitable for passing references or small tokens with well‑defined ownership.
Pipes
Character queues between threads, typically used for stream‑oriented communication or simple byte‑based protocols.
Objects FIFOs
Copy‑less exchange of fixed‑size messages between Thread/ISR and Thread/ISR. Messages can have any size (fixed per FIFO), avoiding extra copies for efficient data transfer.
Core Allocator
A very fast allocator for memory blocks from a global heap:
- Two‑way allocator: blocks can be allocated from top downward or from base upward.
- Useful for partitioning memory regions or implementing specialized allocators on top.
Heap Allocator
A classic alloc/free scheme for variable‑size memory blocks, suitable for components that require dynamic, size‑flexible allocation.
Pool Allocator
An efficient way to allocate and free fixed‑size blocks:
- Ideal for objects of uniform size (control blocks, small data structures).
- Predictable performance and simple fragmentation behavior.
Objects Factory
Dynamic allocation and management of kernel or custom objects:
- Objects can be created, named, and then used by reference or by name.
- Includes a reference counter; objects automatically disappear when the last reference is released.
- Simplifies dynamic resource management in larger applications.
Dynamic Threading (RT only)
Support for dynamically allocated threads:
- Available on ChibiOS/RT only (not supported on NIL).
- Allows creation and destruction of threads at runtime when combined with the provided allocators.
- Useful for applications that need flexible, dynamic workloads on top of the static kernel.
Delegate Threads
Mechanism to call functions in the context of another thread:
- Code can request that a function be executed by a dedicated “delegate” thread.
- Particularly useful for integrating non‑reentrant or legacy code that must always run in a specific thread context.
- Helps avoid explicit locking in callers and reduces the risk of reentrancy issues.
Job Queues
Infrastructure to send job structures to one or more job‑server threads for execution:
- Jobs encapsulate work items (function + data).
- One or more worker threads dequeue jobs and execute them.
- Helps structure systems with asynchronous work offloading, load distribution, and clear separation between producers and workers.
Object Caches
Caches for frequently used objects with automatic aging:
- Keep a pool of reusable objects to reduce allocation/free overhead.
- Older or least‑recently used objects are automatically discarded when the cache needs to shrink or make room.
- Useful for performance‑sensitive components that still benefit from dynamic allocation patterns.
Explore the features set and comparison with core RT/NIL features.
