Building block view¶
arc42 §5 — the building blocks that realise EtherCAT network-config cod... (FEAT_0080), showing
the codegen data flow from network.yaml through the parse and codegen
layers to the generated &'static tables consumed at runtime.
Structural overview¶
The toolchain is four layers that depend only leftwards. An integrator
authors network.yaml; the build-script glue (ethercat-netcfg SM-watchdog... (BB_0096) is the
SM-watchdog slice) drives the parse and codegen layers into OUT_DIR;
the consumer crate pulls in the emitted module via include!.
graph LR
yaml["network.yaml<br/>(integrator-authored)"]
esi["ESI files<br/>(vendored, pinned)"]
parser["ethercat-netcfg<br/>(parse layer)<br/>depends on ethercat-esi<br/>+ fieldbus-od-core"]
ir["NetworkConfig IR<br/>(typed, in-memory)"]
codegen["ethercat-netcfg-codegen<br/>(codegen layer)<br/>IR → TokenStream<br/>prettyplease formatting"]
build["ethercat-netcfg-build<br/>(build-script glue)<br/>invoked from build.rs<br/>writes to OUT_DIR"]
cli["ethercat-netcfg-cli<br/>(netcfg expand / fetch)<br/>vendor-and-pin action"]
out["OUT_DIR/network.rs<br/>pub static PDO_MAP<br/>EthercatRouting consts<br/>bring-up assertions"]
consumer["consumer crate<br/>include!(…/network.rs)"]
yaml --> parser
esi --> parser
parser --> ir
ir --> codegen
codegen --> build
build --> out
out --> consumer
yaml -.->|"netcfg fetch"| cli
cli -.->|"vendors + pins"| esi
5. Building blocks¶
One building block per crate of the pipeline — parse layer, codegen layer, build-script glue, CLI — mirroring the per-crate decomposition of the device-driver toolchain (ethercat-esi (parser crate) (BB_0060) – ethercat-esi-verify (EEPROM... (BB_0066)), plus the SM-watchdog resolution slice (ethercat-netcfg SM-watchdog... (BB_0096)), which cuts across the parse and codegen layers and is kept as its own block because it carries the safety argument of Output-slave watchdog enabl... (AOU_0016). Each block records the crate’s job, public surface, and the dependencies it is and is not allowed to carry; the capability-cluster features (Network-config parser and IR (FEAT_0081) – Validation and bring-up ass... (FEAT_0085)) and their decisions describe the why.
The parse crate. Turns one |
The code generator. |
The |
The |
The parse-layer code that, at |