Module Design
The blob module is a small, allocation-free library for reading and validating the binary
gateway tables described in Configuration. It never copies the underlying data;
instead it operates on ::etl::span<uint8_t const> views into the memory region that holds the
blob.
Components
HeaderPlain data structure describing the blob header (
version,magic,size).checkHeader()validates the version and magic number and populates the declared data size.BlobWraps a validated blob span and exposes a forward (input) iterator over its configurations. The constructor calls
checkHeader()and verifies that the memory region size matchesHEADER_SIZE + size; on failure it logs an error and yields an empty span. Iteration advances by each configuration’s declared size and stops once the span is exhausted.ConfigRepresents a single configuration as a
typeand adataspan.Config::from_bytes()parses a configuration header (vialoadConfigHeader()), rejectsUNKNOWNtypes and inconsistent sizes, and returns a span bounded to the configuration’s extent.utilFree functions for higher-level access:
load()performs full validation,config()looks up the first configuration of a given type,checkCrc()verifies a configuration’s trailing CRC, and theloadColumn()template safely reinterprets a sized byte run as a typed column.
Loading and validation flow
The recommended entry point is load(). It performs the full sequence of checks and returns a
span that is guaranteed to reference a structurally valid, CRC-verified blob (or an empty span on
failure):
Design rationale
Zero-copy and allocation-free. All access is span-based, making the module suitable for constrained embedded targets and safe to use on read-only memory such as flash.
Fail-safe. Every parsing step is size-checked, and CRC validation guards against corruption. Invalid input collapses to an empty span rather than producing undefined behaviour.
Lazy iteration. Configurations are decoded on demand by the
Blobiterator, so the cost of parsing is paid only for the configurations that are actually inspected.