Overview of zcbor
mainzcbor is a low-footprint CBOR (Concise Binary Object Representation) library written in C (C++ compatible), specifically designed for microcontrollers.
It provides two primary ways to work with CBOR:
- C Library: A standalone, lightweight library for encoding and decoding CBOR data. It can be used directly or as the foundation for generated code.
- Python Tooling: A script and module (
zcbor.py) used for schema-driven validation, data conversion (YAML/JSON/CBOR), and C code generation based on CDDL (Concise Data Definition Language) schemas.
Key use cases include:
- Using the C library for manual encoding/decoding in constrained environments.
- Using the Python tool to generate optimized C code that automatically validates data against a CDDL schema.
- Using the Python tool to validate or convert data formats (e.g., converting a YAML config to a CBOR payload for transmission).