加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fw_gen.sh 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
zxystd 提交于 2020-02-27 00:24 . replace fw
#!/bin/sh
# fw_gen.sh
# IntelBluetoothFirmware
#
# Created by qcwap on 2020/2/26.
# Copyright © 2020 钟先耀. All rights reserved.
target_file="${PROJECT_DIR}/IntelBluetoothFirmware/FwBinary.cpp"
fw_files=${PROJECT_DIR}/IntelBluetoothFirmware/fw/*.*
rm -rf $target_file
echo "// IntelBluetoothFirmware\n\n// Copyright © 2020 钟先耀. All rights reserved." >$target_file
echo "#include \"FwData.h\"">>$target_file
for fw in $fw_files; do
fw_file_name=`basename $fw`
fw_var_name=${fw_file_name//./_}
fw_var_name=${fw_var_name//-/_}
echo "">>$target_file
echo "const unsigned char ${fw_var_name}[] = {">>$target_file
xxd -i <$fw >>$target_file
echo "};">>$target_file
echo "">>$target_file
echo "const long int ${fw_var_name}_size = sizeof(${fw_var_name});">>$target_file
done
echo "">>$target_file
echo "const struct FwDesc fwList[] = {">>$target_file
i=0;
for fw in $fw_files; do
fw_file_name=`basename $fw`
fw_var_name=${fw_file_name//./_}
fw_var_name=${fw_var_name//-/_}
echo "{IBT_FW(\"$fw_file_name\", $fw_var_name, ${fw_var_name}_size)},">>$target_file
let i+=1
done
echo "};">>$target_file
echo "const int fwNumber = $i;">>$target_file
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化