代码拉取完成,页面将自动刷新
#!/bin/bash
#
# Fetch new code for an entire MCU series from an upstream STM repository.
if [ $# -ne 2 ]; then
echo "usage: $0 <mcu> <src>"
echo ""
echo "eg: $0 STM32WB path/to/STM32CubeWB"
echo "where STM32CubeWB is from https://github.com/STMicroelectronics/STM32CubeWB.git"
exit 1
fi
mcu=$1
gitsrc=$2
cmsis=CMSIS/${mcu}xx
hal=${mcu}xx_HAL_Driver
if [ ! -d $cmsis ]; then
echo "WARNING: $cmsis is not an existing directory, assuming a new MCU series"
mkdir -p $cmsis
fi
if [ ! -d $hal ]; then
echo "WARNING: $hal is not an existing directory, assuming a new MCU series"
mkdir -p $hal
fi
# CMSIS: remove any old files and copy across the new ones.
echo "Fetching CMSIS to $cmsis"
rm -rf $cmsis/Include
rm -rf $cmsis/Source
cp -r $gitsrc/Drivers/CMSIS/Device/ST/${mcu}xx/Include $cmsis/
cp -r $gitsrc/Drivers/CMSIS/Device/ST/${mcu}xx/Source $cmsis/
rm -rf CMSIS/${mcu}xx/Source/Templates/*/linker
# HAL: remove any old files and copy across the new ones.
echo "Fetching HAL to $hal"
rm -rf $hal/Inc
rm -rf $hal/Src
cp -r $gitsrc/Drivers/${mcu}xx_HAL_Driver/Inc $hal/
cp -r $gitsrc/Drivers/${mcu}xx_HAL_Driver/Src $hal/
# Make sure tr and exand don't expect UTF-8, because these files aren't
export LC_CTYPE=C
for dir in $cmsis $hal; do
# Process the new source code to:
# - remove trailing white-space
# - convert to unix line-endings
# - expand tabs with 4 spaces
# - convert non-ascii chars to ascii equivalent (should only be in comments)
echo "Processing source code in $dir"
for file in $(find $dir -name "*.[chs]"); do
chmod 644 $file
cat $file | awk "{sub(/[\t ]*$/,\"\")}1" | expand -t 4 | tr \\200\\205\\211\\221\\222\\223\\224\\226\\231\\244\\261\\265\\302\\327\\342 \'??\'\'\"\"\\-\'??u?x\' > tmp$$
/bin/mv tmp$$ $file
done
done
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。