-
Notifications
You must be signed in to change notification settings - Fork 1
Home
dgliu edited this page Feb 16, 2026
·
3 revisions
Modern C++17 header-only embedded infrastructure library for ARM-Linux industrial systems. Designed from scratch for LiDAR, robotics, and edge computing platforms. 43 headers, 1153 tests, ASan/TSan/UBSan clean.
newosp provides a complete foundation for building high-performance embedded applications with zero global state, stack-first allocation, and lock-free messaging. All modules are header-only with RAII resource management and type-safe error handling.
- Zero global state: All state encapsulated in objects (RAII)
- Stack-first allocation: Fixed-capacity containers, zero heap in hot paths
-
-fno-exceptions -fno-rtticompatible: Designed for embedded ARM-Linux -
Type-safe error handling:
expected<V,E>andoptional<T>vocabulary types - Header-only: Single CMake INTERFACE library, C++17 standard
- Lock-free messaging: MPSC ring buffer bus with priority-based admission control
- Template-based design patterns: Tag dispatch, variadic templates, CRTP, compile-time composition
| Module | Description |
|---|---|
platform.hpp |
Platform/architecture detection, compiler hints, OSP_ASSERT, SteadyNowUs, OSP_PRINTF_FMT
|
vocabulary.hpp |
expected, optional, FixedVector, FixedString, FixedFunction, function_ref, not_null, NewType, ScopeGuard
|
config.hpp |
Multi-format config parser (INI/JSON/YAML), template-based backend dispatch |
log.hpp |
Logging macros, compile-time level filtering (stderr backend) |
async_log.hpp |
Async logging backend (Per-Thread SPSC, severity routing, drop-stats reporting, auto-start) |
timer.hpp |
Timer task scheduler based on std::chrono::steady_clock
|
shell.hpp |
Remote debug shell (telnet/console/UART), IAC/ESC filtering, command history, auth |
inicpp.hpp |
INI file parser (forked from inifile-cpp, -fno-exceptions compatible) |
mem_pool.hpp |
Fixed-block memory pool (FixedPool<BlockSize, MaxBlocks>), embedded free list |
shutdown.hpp |
Async-signal-safe graceful shutdown, LIFO callbacks, pipe(2) wakeup |
| Module | Description |
|---|---|
bus.hpp |
Lock-free MPSC message bus (AsyncBus<PayloadVariant>), CAS publish, topic routing, ProcessBatchWith visitor dispatch |
node.hpp |
Lightweight pub/sub node (Node<PayloadVariant>), Bus injection, FNV-1a topic hash |
static_node.hpp |
Compile-time handler binding node (StaticNode<Payload, Handler>), dual-mode dispatch, 15x speedup |
worker_pool.hpp |
Multi-worker thread pool, AsyncBus + SPSC per-worker queues, AdaptiveBackoff |
spsc_ringbuffer.hpp |
Lock-free wait-free SPSC ring buffer (trivially_copyable, batch ops, FakeTSO) |
executor.hpp |
Scheduler (Single/Static/Pinned + RealtimeExecutor SCHED_FIFO) |
semaphore.hpp |
Lightweight semaphore (futex-based LightSemaphore/PosixSemaphore) |
data_fusion.hpp |
Multi-source data fusion (time alignment, interpolation) |
| Module | Description |
|---|---|
hsm.hpp |
Hierarchical state machine (LCA transitions, guard conditions, ForceTransition, zero heap) |
bt.hpp |
Behavior tree (Sequence/Fallback/Parallel, flat array storage, cache-friendly) |
| Module | Description |
|---|---|
socket.hpp |
TCP/UDP RAII wrapper (sockpp) |
io_poller.hpp |
epoll event loop (edge-triggered + timeout) |
connection.hpp |
Connection pool management (auto-reconnect, heartbeat) |
transport.hpp |
Network transport (v0/v1 frame protocol, SequenceTracker) |
shm_transport.hpp |
Shared memory IPC (lock-free SPSC, ARM memory ordering, CreateOrReplace crash recovery) |
serial_transport.hpp |
Industrial serial transport (CRC-CCITT, PTY testing, IEC 61508) |
net.hpp |
Network layer wrapper (address resolution, socket options) |
transport_factory.hpp |
Automatic transport selection (inproc/shm/tcp) |
| Module | Description |
|---|---|
service.hpp |
RPC service (request-response, ServiceRegistry, AsyncClient) |
discovery.hpp |
Node discovery (UDP multicast + static config, TopicAwareDiscovery) |
node_manager.hpp |
Node management + heartbeat monitoring |
node_manager_hsm.hpp |
HSM-driven node heartbeat state machine (Connected/Suspect/Disconnected) |
service_hsm.hpp |
HSM-driven service lifecycle (Idle/Listening/Active/Error/ShuttingDown) |
discovery_hsm.hpp |
HSM-driven discovery flow (Idle/Announcing/Discovering/Stable/Degraded) |
| Module | Description |
|---|---|
app.hpp |
Application/Instance two-tier model (MakeIID, HSM-driven) |
post.hpp |
Unified posting (AppRegistry + OspPost + OspSendAndWait) |
qos.hpp |
QoS configuration (Reliability/History/Deadline/Lifespan) |
lifecycle_node.hpp |
Lifecycle node (Unconfigured/Inactive/Active/Finalized, HSM-driven) |
| Module | Description |
|---|---|
watchdog.hpp |
Software watchdog (deadline monitoring, timeout callbacks) |
fault_collector.hpp |
Fault collection and reporting (FaultReporter POD injection, ring buffer) |
shell_commands.hpp |
Built-in diagnostic shell command bridge (zero-intrusion, 15 Register functions) |
process.hpp |
Process management (Subprocess spawn/pipe/wait, FindPidByName, Freeze/Resume/Kill) |
system_monitor.hpp |
Linux system health monitoring (CPU, memory, disk, temperature) |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application Layer β
β ββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ β
β β app.hpp β β lifecycle_node.hpp β β
β β post.hpp β β qos.hpp β β
β ββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββ¬ββββββββββββββββββββββββ
β β
v v
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Service & Discovery Layer β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββββββββ β
β β service.hpp β β discovery β β node_manager.hpp β β
β β service_hsm β β discovery_hsmβ β node_manager_hsm.hpp β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββββββββ β
ββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β β
v v
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Transport Layer β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β transport.hpp / shm_transport.hpp / serial_transport β β
β β transport_factory.hpp / data_fusion.hpp β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
v
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Network Layer β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β socket.hpp / connection.hpp β β
β β io_poller.hpp / net.hpp β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
v
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Core Communication Layer β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β bus.hpp / node.hpp / static_node.hpp β β
β β spsc_ringbuffer.hpp / worker_pool.hpp β β
β β executor.hpp / semaphore.hpp β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββ¬βββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β β
v v
ββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ
β State Machine & BT β β Reliability & System Layer β
β ββββββββββββββββββ β β ββββββββββββββββββββββββββββββ β
β β hsm.hpp β β β β watchdog.hpp β β
β β bt.hpp β β β β fault_collector.hpp β β
β ββββββββββββββββββ β β β shell_commands.hpp β β
ββββββββββββ¬ββββββββββββ β β process.hpp β β
β β β system_monitor.hpp β β
β β ββββββββββββββββββββββββββββββ β
β ββββββββββββ¬ββββββββββββββββββββββββ
β β
v v
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Foundation Layer β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β platform.hpp / vocabulary.hpp / async_log.hpp β β
β β config.hpp / log.hpp / inicpp.hpp β β
β β timer.hpp / shell.hpp / mem_pool.hpp / shutdown.hpp β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Quick-Start - Build instructions and hello world example
- Architecture - Detailed architecture design and module dependencies
- API-Foundation-Core - Foundation and Core Communication API reference
- API-Network-Transport - Network and Transport layer API reference
- API-State-Scheduler - State Machine, Behavior Tree, and Scheduler API reference
- API-Service-App - Service, Discovery, and Application layer API reference
- Performance - Benchmark results and performance analysis
- Examples - Example programs and usage patterns
- Lock-free MPSC Bus: 10M+ msg/s single-threaded, 5M+ msg/s multi-threaded (4 publishers)
- SPSC Ring Buffer: 50M+ ops/s (batch mode), wait-free on ARM Cortex-A
- Shared Memory IPC: 2.5M+ msg/s (4KB payload), zero-copy between processes
- Serial Transport: 115200 baud with CRC-CCITT, <1ms latency for 256B frames
- TCP Transport: 1M+ msg/s (small payloads), automatic reconnection and heartbeat
- Memory footprint: <100KB for core modules (bus + node + executor + transport)
- Zero heap allocation: Hot paths use stack-only fixed-capacity containers
- CMake >= 3.14
- C++17 compiler (GCC >= 7, Clang >= 5)
- Linux (ARM-Linux embedded platform)
MIT - see LICENSE