Update SVD files #1
@ -21,9 +21,39 @@ features = ["rt"]
|
|||||||
|
|
||||||
The `rt` feature is optional and recommended. It brings in support for `cortex-m-rt`.
|
The `rt` feature is optional and recommended. It brings in support for `cortex-m-rt`.
|
||||||
|
|
||||||
For full details on the autgenerated API, please see the
|
For full details on the autgenerated API, you can read the
|
||||||
[svd2rust documentation](https://docs.rs/svd2rust/0.19.0/svd2rust/#peripheral-api).
|
[svd2rust documentation](https://docs.rs/svd2rust/latest/svd2rust/).
|
||||||
|
|
||||||
## Regenerating the PAC
|
## Regenerating the PAC
|
||||||
|
|
||||||
You can regenerate the PAC by running the `gen-helper.sh` helper script.
|
If you want to re-generate the PAC, for example if the register file `va416xx.svd` changes
|
||||||
|
or the `svd2rust` version is updated, you can do some using the following these steps:
|
||||||
|
|
||||||
|
1. Make sure all necessary tools are installed: [`svd2rust`](https://docs.rs/svd2rust/latest/svd2rust/),
|
||||||
|
[`svdtools`](https://github.com/rust-embedded/svdtools) and [`form`](https://crates.io/crates/form).
|
||||||
|
You can install all tools with `cargo`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo install --locked svd2rust svdtools form
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Patch the vendor-provided SVD file `svd/va41xx.svd`. This can be done using `svdtools` in
|
||||||
|
conjunction with the `svd/va416xx-patch.yml` file.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
svdtools patch svd/va416xx-patch.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Use `svd2rust` to generate the Rust library
|
||||||
|
|
||||||
|
```sh
|
||||||
|
svd2rust -i svd/va416xx.svd.patched
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Use the `form` tool to split the generated `lib.rs` into individual modules.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
form -i lib.rs -o src/
|
||||||
|
```
|
||||||
|
|
||||||
|
The `gen-helper.sh` automates steps 2-4.
|
||||||
|
@ -15,12 +15,28 @@ if [ -x "$(${svd2rust_bin} --version)" ]; then
|
|||||||
"Install it with cargo install svd2rust"
|
"Install it with cargo install svd2rust"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
${svd2rust_bin} -i svd/va416xx-base.svd
|
|
||||||
|
if ! command -v form &> /dev/null
|
||||||
|
then
|
||||||
|
echo "form tool was not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v svdtools &> /dev/null
|
||||||
|
then
|
||||||
|
echo "svdtools was not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
svdtools patch svd/va416xx-patch.yml
|
||||||
|
${svd2rust_bin} -i svd/va416xx.svd.patched
|
||||||
|
|
||||||
result=$?
|
result=$?
|
||||||
if [ $result -ne 0 ]; then
|
if [ $result -ne 0 ]; then
|
||||||
echo "svd2rust failed with code $result"
|
echo "svd2rust failed with code $result"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf src
|
rm -rf src
|
||||||
form -i lib.rs -o src/ && rm lib.rs
|
form -i lib.rs -o src/ && rm lib.rs
|
||||||
cargo fmt
|
cargo fmt
|
||||||
|
8
va416xx/svd/va416xx-patch.yml
Normal file
8
va416xx/svd/va416xx-patch.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
_svd: va416xx.svd
|
||||||
|
|
||||||
|
# Read-only access for a write-only register does not really make sense..
|
||||||
|
DMA:
|
||||||
|
CFG:
|
||||||
|
_modify:
|
||||||
|
MASTER_ENABLE:
|
||||||
|
access: read-write
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user