stm32-data/extract.sh
Ulf Lilleengen 18a99a3a3b Add RCC register for STM32F4 and STM32L4
Register block based in STM32F427ZI and STM32L4R9.

Use bool for reset registers.

Define clock mapping for RNG peripherals. There are no 1 <-> 1 mapping
of RNG peripheral to clock in the Cubedb sources. The mapping will
pre-select the clock source for RNG for now.
2021-06-03 11:33:24 +02:00

41 lines
881 B
Bash
Executable File

#!/bin/bash
echo "Usage: ./extract.sh all|<board_name> <peripheral>"
board=$1
peri=$2
mkdir -p regs/$peri
cargo build --release --manifest-path ../../svd2rust/Cargo.toml
transform="transform.yaml"
if [ -f "transform-$peri.yaml" ];
then
transform="transform-$peri.yaml"
fi
query="sources/svd";
if [ $board != "all" ];
then
query="sources/svd/stm32$board*.svd"
fi
for f in `ls $query`; do
f=${f##*/}
f=${f#"stm32"}
f=${f%".svd"}
echo -n processing $f ...
RUST_LOG=info ../../svd2rust/target/release/svd4rust extract-peripheral --svd sources/svd/stm32$f.svd --transform $transform --peripheral $peri > regs/$peri/$f.yaml 2> regs/$peri/$f.yaml.out
if [ $? -ne 0 ]; then
mv regs/$peri/$f.yaml.out regs/$peri/$f.err
rm regs/$peri/$f.yaml
echo FAIL
else
rm regs/$peri/$f.yaml.out
echo OK
fi
done