CANopen device-driver codegen¶
This chapter captures the requirements for the CANopen device-driver
codegen toolchain: a layered set of crates that translates CANopen
Electronic Data Sheet (EDS, CiA 306) files into strongly-typed Rust
driver modules at build time, with zero runtime INI parsing and no
dependency on the taktora-connector-can runtime.
The decomposition is the peer of Device-driver codegen for CANopen, executing the lift foreseen by Future CANopen support via ... (ADR_0073) (now closed by Lift OD IR to fieldbus-od-c... (ADR_0078)):
Top-level umbrella feature — CANopen device-driver codeg... (FEAT_0060) — peer to Device-driver codegen toolc... (FEAT_0050) (EtherCAT codegen). The umbrella is build-time only and orthogonal to CAN (SocketCAN) reference c... (FEAT_0046) “CAN reference connector”; the runtime adapter that wires generated devices into the connector is a follow-on spec.
Shared OD core — Shared OD core (FEAT_0061) lifts the OD IR (Identity, DictEntry, DataType, PdoEntry, PdoMap, AccessRights) out of
ethercat-esiinto a newfieldbus-od-corecrate so both parsers share it.Capability-cluster sub-features — one per crate-layer concern, each
:satisfies:CANopen device-driver codeg... (FEAT_0060).Requirements — concrete shall-clauses that
:satisfies:a capability-cluster feature.
This round covers EDS only. DCF (Device Configuration File) support and a live-bus verifier are explicitly out of scope; the architecture preserves the option to add either later (see Anti-goals and cross-cutting traceability).
The umbrella decomposes into eight capability clusters, each on its own page (see the toctree): the shared OD core (Shared OD core (FEAT_0061)), the EDS parser (EDS parser (FEAT_0062)), the codegen IR and backend trait (Codegen IR and backend trait (FEAT_0063)), the taktora-connector-can backend (taktora-connector-can codeg... (FEAT_0064)), the runtime trait surface (Runtime trait surface (FEAT_0065)), the build helper (Build helper (build.rs glue) (FEAT_0066)), CLI inspection (CLI inspection (cargo subco... (FEAT_0067)), and EDS ↔ SDO-dump verification (EDS ↔ SDO-dump verification (FEAT_0068)). The deliberately rejected anti-goals and the umbrella-level traceability tables live on Anti-goals and cross-cutting traceability.
Top-level umbrella¶
A layered set of Rust crates that consumes CANopen EDS files (CiA 306) and emits strongly-typed driver modules at build time. The toolchain is organised as five layers that depend only leftwards:
The |
Requirements at a glance¶
ID |
Title |
Status |
Satisfies |
|---|---|---|---|
Shared OD core |
open |
||
EDS parser |
open |
||
Codegen IR and backend trait |
open |
||
taktora-connector-can codegen backend |
open |
||
Runtime trait surface |
open |
||
Build helper (build.rs glue) |
open |
||
CLI inspection (cargo subcommand) |
open |
||
EDS ↔ SDO-dump verification |
open |
||
No transport-specific types in fieldbus-od-core |
open |
||
no_std + alloc, no mandatory serde |
open |
||
OD type surface |
open |
||
ethercat-esi re-exports lifted types |
open |
||
canopen-eds uses fieldbus-od-core types |
open |
||
Pure parse function with no I/O |
open |
||
no_std + alloc, no upstream coupling |
open |
||
serde-derive INI backend |
open |
||
Parse errors carry line and column |
open |
||
Unknown sections captured as RawSection |
open |
||
Liberal parsing — warn and continue on quirks |
open |
||
IR carries identity, OD, PDO comm + maps |
open |
||
CodegenBackend trait shape |
open |
||
Naming policy is owned by codegen, not the backend |
open |
||
Revision collision handled deterministically |
open |
||
Common PDO entry types deduplicated |
open |
||
Emission target is proc_macro2 TokenStream |
open |
||
One EDS file equals one device |
open |
||
Backend crate is the sole canopen-eds-rt dependency |
open |
||
One device struct per EDS file |
open |
||
Identity const emitted per device |
open |
||
PDO declarations emitted as sum types |
open |
||
Dummy entries skipped in PDO payload structs |
open |
||
Generated module root exposes a registry |
open |
||
Bring-up SDO writes emitted from EDS |
open |
||
Object dictionary emission is a default-off cargo feature |
open |
||
Generated code compiles under no_std + alloc |
open |
||
CanOpenDevice trait shape |
open |
||
CanOpenConfigurable trait shape for bring-up |
open |
||
Traits live in canopen-eds-rt, not taktora-connector-can |
open |
||
Frame payloads use heapless::Vec<u8, 8> |
open |
||
Frame-per-PDO dispatch shape |
open |
||
CanOpenError variant surface |
open |
||
RPDO rejected outside Operational state |
open |
||
Builder API shape |
open |
||
Output written to OUT_DIR |
open |
||
Cargo rerun-if directives emitted per EDS input |
open |
||
Generated output passes through prettyplease |
open |
||
Parser warnings surface as cargo warnings |
open |
||
cargo eds expand emits one device's generated code |
open |
||
cargo eds list enumerates devices in a glob |
open |
||
CLI shares the parser and codegen crates |
open |
||
Verifier ingests EDS plus JSON SDO-dump |
open |
||
Diagnostic output names the differing field |
open |
||
Verifier reuses the parser |
open |
||
Verifier exits non-zero on mismatch |
open |
||
SDO-dump JSON schema versioned |
open |
||
NO DCF support this round |
rejected |
||
NO CAN-FD payload support in PdoOut |
rejected |
||
NO proc-macro front-end |
rejected |
||
NO unification of EtherCAT and CANopen runtime traits |
rejected |
||
NO runtime EDS parsing |
rejected |
||
NO modification of taktora-connector-can runtime |
rejected |
||
NO automatic vendor library scraping |
rejected |
||
NO live-bus verifier this round |
rejected |