THIS IS AN EXPERIMENTAL PROJECT
Do not rely on this project to generate your types. The codebase is provided as an experiment to demonstrate a proposal that is a way to generate code from DSDL IDL files in a way that is more structured and rigorous than the current solution Nunavut which uses templated, textual expansion from an AST. Nunavut is the production-facing product. This project provides no claims to correctness. It provides only the sketch of an idea.
llvm-dsdl provides command-line tooling for Cyphal DSDL:
dsdlc: DSDL compiler and multi-language code generatordsdld: DSDL language server (LSP over stdio JSON-RPC)
If you are contributing to the project itself (build system, internals, tests, release process), use CONTRIBUTING.md.
Download the latest release artifacts from:
Then place the binaries you need on your PATH (dsdlc, dsdld).
git clone https://github.com/OpenCyphal-Garage/llvm-dsdl.git
cd llvm-dsdl
git submodule update --init --recursive
cmake --workflow --preset install-bin-release-ciInstalled binaries are placed under:
build/matrix/ci/install/bin
Show help:
dsdlc --helpShow version:
dsdlc --versiondsdlc --target-language <lang> [options] <root_namespace_or_files...><lang> can be:
astmlircobj
These languages are experimental and generate only with --experimental-languages:
cpprustgotspython
examples/showroom is a namespace of plausible vendor-specific drone datatypes
— sealed types packed into a classic-CAN frame, delimited types that grow across minor versions,
unions, services, and a mission plan sized for a UDP datagram — generated into every language and
profile:
cmake --build <build-dir> --target showroomThe rendered pages, pairing each definition with its wire-layout facts and the generated declaration
in each language, are published at
the Showroom section of the user manual. They
are generated from the compiler's own output rather than committed; showroom-docs produces them
locally, into docs/showroom/.
AST output:
dsdlc --target-language ast path/to/root_namespaceMLIR output:
dsdlc --target-language mlir path/to/root_namespaceGenerate C output:
dsdlc --target-language c path/to/root_namespace --outdir out/cGenerate C++ output (std, pmr, autosar, or both where both means std + pmr); std and
pmr are C++20:
dsdlc --target-language cpp --experimental-languages path/to/root_namespace --cpp-profile both --outdir out/cppGenerate AUTOSAR-oriented C++14 output, binding its span to CETL's:
dsdlc --target-language cpp --experimental-languages path/to/root_namespace --cpp-profile autosar --vocabulary examples/vocabulary/cpp-autosar-cetl.yaml --outdir out/cpp-autosarGenerate Rust output:
dsdlc --target-language rust --experimental-languages path/to/root_namespace \
--rust-crate-name my_dsdl_types \
--rust-profile std \
--outdir out/rustGenerate Go output:
dsdlc --target-language go --experimental-languages path/to/root_namespace \
--go-module example.com/my/dsdl \
--outdir out/goGenerate TypeScript output:
dsdlc --target-language ts --experimental-languages path/to/root_namespace \
--ts-module my_dsdl_types \
--outdir out/tsGenerate Python output:
dsdlc --target-language python --experimental-languages path/to/root_namespace \
--py-package my_dsdl_types \
--outdir out/pythonGenerate objects, assembled inside dsdlc for the host or for a named target, with the C headers
beside them:
dsdlc --target-language obj path/to/root_namespace \
--target-triple riscv32-unknown-elf \
--outdir out/objUse --lookup-dir (repeatable) when your definitions import other namespaces:
dsdlc --target-language c path/to/root_namespace \
--lookup-dir path/to/lookup_a \
--lookup-dir path/to/lookup_b \
--outdir out/cdsdlc also reads DSDL_INCLUDE_PATH and CYPHAL_PATH.
For the standard uavcan.* namespace, dsdlc ships an embedded catalogue for
mlir and codegen targets (c, cpp, rust, go, ts, python, obj). Types
that reference core uavcan definitions resolve without needing external
uavcan source roots. Use --no-embedded-uavcan to disable this behaviour.
A + target names that catalogue directly, generating standard types without a
public_regulated_data_types checkout:
dsdlc --target-language c --outdir out/c +uavcan.node.Heartbeat.1.0Run dsdlc --help for the full option set.
dsdld is an LSP server over stdio. The editor or client drives configuration
through LSP settings.
Run it directly:
dsdldlocal lspconfig = require("lspconfig")
lspconfig.dsdld.setup({
cmd = { "/absolute/path/to/dsdld" },
filetypes = { "dsdl" },
settings = {
roots = { "/absolute/path/to/root_namespace" },
lookupDirs = { "/absolute/path/to/lookup_namespace" },
lint = { enabled = true },
ai = { enabled = false, mode = "off" },
trace = "basic",
},
})dsdlc: unknown argument:
- run
dsdlc --helpand verify spelling/order of options
Import resolution failures:
- add
--lookup-direntries - verify namespace roots and file naming follow DSDL conventions
dsdld not responding in editor:
- verify editor points to the correct
dsdldbinary path - verify workspace
roots/lookupDirssettings
