d
script revamping
This commit is contained in:
parent
923958119a
commit
ffa42e2361
47
d
47
d
@ -9,22 +9,25 @@ for i in jq wget svd git; do
|
||||
command -v "$i" &>/dev/null || die "Missing the command line tool '$i'"
|
||||
done
|
||||
|
||||
case "$1" in
|
||||
download_all)
|
||||
./d download_mcufinder
|
||||
./d download_svd
|
||||
./d download_headers
|
||||
./d download_cubedb
|
||||
CMD=$1
|
||||
shift
|
||||
|
||||
case "$CMD" in
|
||||
download-all)
|
||||
./d download-mcufinder
|
||||
./d download-svd
|
||||
./d download-headers
|
||||
./d download-cubedb
|
||||
;;
|
||||
download_mcufinder)
|
||||
download-mcufinder)
|
||||
mkdir -p sources/mcufinder
|
||||
wget http://stmcufinder.com/API/getFiles.php -O sources/mcufinder/files.json
|
||||
wget http://stmcufinder.com/API/getMCUsForMCUFinderPC.php -O sources/mcufinder/mcus.json
|
||||
;;
|
||||
download_pdf)
|
||||
download-pdf)
|
||||
jq -r .Files[].URL < sources/mcufinder/files.json | wget -P sources/pdf/ -N -i -
|
||||
;;
|
||||
download_svd)
|
||||
download-svd)
|
||||
rm -rf ./sources/git/stm32-rs
|
||||
git clone --depth 1 https://github.com/stm32-rs/stm32-rs.git ./sources/git/stm32-rs
|
||||
(cd ./sources/git/stm32-rs; make svdformat)
|
||||
@ -34,7 +37,7 @@ case "$1" in
|
||||
cp $f sources/svd/$base.svd
|
||||
done
|
||||
;;
|
||||
download_headers)
|
||||
download-headers)
|
||||
for f in F0 F1 F2 F3 F4 F7 H7 L0 L1 L4 L5 G0 G4 WB WL; do
|
||||
rm -rf ./sources/git/STM32Cube$f
|
||||
git clone --depth 1 https://github.com/STMicroelectronics/STM32Cube$f sources/git/STM32Cube$f
|
||||
@ -46,27 +49,31 @@ case "$1" in
|
||||
rm sources/headers/system_*.h
|
||||
rm sources/headers/partition_*.h
|
||||
;;
|
||||
download_cubedb)
|
||||
download-cubedb)
|
||||
rm -rf sources/cubedb
|
||||
git clone --depth 1 https://github.com/embassy-rs/stm32cube-database.git sources/cubedb
|
||||
;;
|
||||
extract_all)
|
||||
peri=$2
|
||||
mkdir -p tmp/$peri
|
||||
install-chiptool)
|
||||
cargo install --git https://github.com/embassy-rs/chiptool
|
||||
;;
|
||||
extract-all)
|
||||
peri=$1
|
||||
shift
|
||||
echo $@
|
||||
|
||||
cargo build --release --manifest-path ../svd2rust/Cargo.toml
|
||||
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 ...
|
||||
RUST_LOG=info ../svd2rust/target/release/svd4rust extract-peripheral --svd sources/svd/stm32$f.svd --transform transform.yaml --peripheral $peri > tmp/$peri/$f.yaml 2> tmp/$peri/$f.yaml.out
|
||||
if [ $? -ne 0 ]; then
|
||||
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
|
||||
else
|
||||
rm tmp/$peri/$f.yaml.out
|
||||
echo OK
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user