-
Notifications
You must be signed in to change notification settings - Fork 4
/
d
executable file
·60 lines (52 loc) · 1.38 KB
/
d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -ex
cd $(dirname $0)
CMD=$1
shift
case "$CMD" in
download-all)
echo TODO $CMD
;;
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 svd/ch32*`; do
echo $f
svd_path=$f
f=${f#"svd/ch32"}
f=${f%".svd.patched"}
echo -n processing $f ...
if test -f transforms/$peri.yaml; then
trans_args="--transform transforms/$peri.yaml"
fi
if chiptool extract-peripheral $trans_args --svd $svd_path --peripheral $peri $@ > tmp/$peri/$f.yaml 2> tmp/$peri/$f.err; then
rm tmp/$peri/$f.err
echo OK
else
if grep -q 'peripheral not found' tmp/$peri/$f.err; then
echo No Peripheral
else
echo OTHER FAILURE
fi
rm tmp/$peri/$f.yaml
fi
done
;;
gen)
rm -rf build/data
echo "TODO: More chips to be added"
cargo run -p ch32-data-gen && cargo run -p ch32-metapac-gen -- "CH32X03*" "CH32V*" "CH32L*" CH641 CH643
;;
ci)
echo TODO $CMD
;;
*)
echo "unknown command"
;;
esac