1 Star 0 Fork 0

wangfushenghui/stm32lib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fetch_from_upstream.sh 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
#!/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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangfushenghui/stm32lib.git
git@gitee.com:wangfushenghui/stm32lib.git
wangfushenghui
stm32lib
stm32lib
vendor

搜索帮助