Bob McWhirter 21f31372a6 Adjust the d script.
Extract some peripherals for U5.
Update parse.py for some U5 perculiarities.
2021-11-02 12:02:38 -04:00

49 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
cd $(dirname $0)
die() { echo "$*" 1>&2; exit 1; }
for i in jq wget svd git; do
command -v "$i" &>/dev/null || die "Missing the command line tool '$i'"
done
CMD=$1
shift
case "$CMD" in
download-all)
rm -rf ./sources/
git clone https://github.com/embassy-rs/stm32-data-sources.git ./sources/
;;
install-chiptool)
cargo install --git https://github.com/embassy-rs/chiptool
;;
extract-all)
peri=$1
shift
echo $@
rm -rf tmp/$peri
mkdir -p tmp/$peri
for f in `ls sources/svd`; do
f=${f#"stm32"}
f=${f%".svd"}
echo -n processing $f ...
if chiptool extract-peripheral --svd sources/svd/stm32$f.svd --peripheral $peri $@ > tmp/$peri/$f.yaml 2> tmp/$peri/$f.err; then
rm tmp/$peri/$f.err
echo OK
else
rm tmp/$peri/$f.yaml
echo FAIL
fi
done
;;
*)
echo "unknown command"
;;
esac