-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathd
executable file
·63 lines (55 loc) · 1.57 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
60
61
62
#!/bin/bash
set -ex
cd $(dirname $0)
CMD=$1
shift
case "$CMD" in
download-all)
git clone --depth 1 --branch v1.6.0 https://github.com/hpmicro/hpm_sdk.git
;;
install-chiptool)
cargo install --git https://github.com/ch32-rs/chiptool
;;
extract-all)
peri=$1
shift
echo $@
rm -rf tmp/$peri
mkdir -p tmp/$peri
for f in `ls svd/HPM*`; do
echo $f
svd_path=$f
f=${f#"svd/HPM"}
f=${f%"_svd.xml"}
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
RUST_BACKTRACE=1 cargo run -p hpm-data-gen
RUST_BACKTRACE=1 cargo run -p hpm-metapac-gen -- "HPM53*" "HPM67*" "HPM64*" "HPM62*" "HPM63*" "HPM68*" "HPM6E*"
;;
prepare-publish)
cd build/hpm-metapac/
cp -v ../../README.md .
cp -v ../../LICENSE* .
find src -iname '*.rs' -exec rustfmt -v {} \;
;;
*)
echo "unknown command"
;;
esac