Embedded C++ library / Prototype 2.0

CASTLE

C++ built for bounded systems.

A header-only toolkit for firmware where memory, timing, and failure behavior belong in the design, not in the surprises.

Brings modern C++ abstractions to embedded systems

01 / Design principles

CASTLE turns embedded constraints into visible choices: capacity in the type, outcomes in the return value, and storage where you can account for it.

Inspired by the Embedded Template Library (ETL) , CASTLE carries familiar C++ building blocks into a small-footprint, embedded-first library.

01

Capacity, made concrete

Fixed-size containers keep bounds close to the type that owns them.

02

Failure, made ordinary

Full, empty, and invalid states are represented through status values and boolean results.

03

Runtime, kept lean

No mandatory heap allocation, RTTI, exceptions, or STL dependency in public headers.

04

Predictable, by design

Plan memory, timing, and faults up front, following MISRA C++, AUTOSAR C++14, and CERT C++ guidance.

15module families
C++17language baseline
0mandatory heap
MITopen source license

03 / Get started

Drop in.
Set your bounds.

CASTLE is header-only. Add the include directory to your project, or use its CMake interface target to propagate the include path and C++17 requirement.

Read the documentation
quick-start.cpp
#include "castle/container/vector.hpp"
#include "castle/utility/optional.hpp"

castle::container::vector<uint16_t, 16U> samples;

if (samples.push_back(42U) == castle::status::ok)
{
    castle::optional<uint16_t> first = samples[0U];
}
Fixed capacity. Explicit outcome.C++17