Expand description
Code generator for ral crate
§How to install
$ cargo install ral-gen
§How to use
$ cargo ral-gen --svd <SVD file> --overrides <YML file> --out <Target dir>
or short form
$ cargo ral-gen -i <SVD file> -e <YML file> -o <Target dir>
§Overrides
Overrides can be specified in separate yaml
file of the following structure
name: <alternate device name> // Must be identifier
description: <alternate device description>
peripherals:
<peripheral name>: // as can be found in .svd file
name: <alternate peripheral name> // Must be identifier
description: <alternate peripheral description>
features: // List of features for conditional compilation, e.g. packaging names
- <feature1> // to exclude peripheral if it's not available
- <feature2>
clusters:
<cluster name>: // as can be found in .svd file
name: <alternate cluster name> // Must be identifier
description: <alternate cluster description>
features: // List of features for conditional compilation, e.g. packaging names
- <feature1> // to exclude cluster if it's not available
- <feature2>
registers:
<register name>: // as can be found in .svd file
name: <alternate register name> // Must be identifier
description: <alternate register description>
features: // List of features for conditional compilation, e.g. packaging names
- <feature1> // to exclude register if it's not available
- <feature2>
uses: // use expressions required for field type overrides
- crate_name::types::CustomType
fields:
<field name>: // as can be found in .svd file
name: <alternate field name> // Must be identifier
description: <alternate field description>
type: CustomType // Required use expression must be specified in register's uses section
All fields are optional
§What will be generated
Module structure described in ral crate documentation will be generated
Also Cargo.toml
will be generated with content
[package]
name = "<device name in lowercase>"
description = "<device description if present>"
version = "<ral-gen version>"
edition = "2018"
[dependencies]
ral = "<ral-gen version with patch section zeroed>"
[features]
feature1 = []
feature2 = []
Functions§
- Generates module structure