Xilinx的開發工具SDK/Vitis都可以自動根據Vivado設計,創建軟件工程,自動配置各個外部設備的驅動程序。為了兼容舊版本工程,SDK/Vitis里提供了多個IP版本的驅動程序。如果在SDK/Vitis的軟件工程里查看代碼,驅動程序都是正確的。
如果沒有工程,也可以在安裝目錄下查看代碼,比如目錄Vitis\2020.2\data\embeddedsw\XilinxProcessorIPLib\drivers。這時候,需要自己選擇對應的版本。
第三方源代碼編輯器,比如Source Insight,可以創建自己的工程,查找所有符號表等。由于有多個IP版本的驅動程序,只能手動添加對應IP的驅動,到Source Insight工程。否則Source Insight能找到函數的多個實現,看起來有些麻煩。SDK/Vitis下大約有200個軟件模塊,全部手動添加的話,比較麻煩。
為了避免上述情況,可以把舊版本的驅動程序刪除。手動刪除舊版本,也比較繁瑣,也容易出錯。猶豫很久后,終于寫了一個Linux腳本,自動刪除SDK/Vitis下驅動程序的舊版本。當然,在刪除之前,請做好備份。萬一需要的情況下,需要恢復。如果是Linux環境,可以直接執行這個Linux腳本;如果是Windows環境,可以借助WSL執行。 SDK/Vitis在下列目錄,有多個版本的驅動。 請在下列目錄執行腳本。
Vitis/2020.2/data/embeddedsw/XilinxProcessorIPLib/drivers Vitis/2020.2/data/embeddedsw/ThirdParty/sw_services Vitis/2020.2/data/embeddedsw/ThirdParty/bsp Vitis/2020.2/data/embeddedsw/ThirdParty/sw_services Vitis/2020.2/data/embeddedsw/lib/sw_services Vitis/2020.2/data/embeddedsw/lib/bsp
腳本如下:
#!/bin/bash # Author: hankf@xilinx.com # 2021-07-28 # # Run this script in # Linux : # WSL on Windows: # /mnt/c/Xilinx/Vitis/2020.2/data/embeddedsw/XilinxProcessorIPLib/drivers # /mnt/c/Xilinx/Vitis/2020.2/data/embeddedsw/ThirdParty/sw_services # /mnt/c/Xilinx/Vitis/2020.2/data/embeddedsw/ThirdParty/bsp # /mnt/c/Xilinx/Vitis/2020.2/data/embeddedsw/ThirdParty/sw_services # /mnt/c/Xilinx/Vitis/2020.2/data/embeddedsw/lib/sw_services # /mnt/c/Xilinx/Vitis/2020.2/data/embeddedsw/lib/bsp function del_old_dir(){ echo "IP base name $1" for main_version in {1..10} do ip_dir_name_mai # echo "Directory main version: $ip_dir_name_main" # IP directory example: zdma_v1_12 for sub_version in {0..20} do ip_dir_name_main_sub=$ip_dir_name_main\_$sub_version # echo "Check IP Directory main_sub version $ip_dir_name_main_sub" if test -d $ip_dir_name_main_sub then # echo "Directory $ip_dir_name_main_sub exists" # echo "IP Directory length: ${#ip_dir_name_main_sub} " if [ ${#ip_dir_name_main_sub} -gt 5 ]; then ip_dir_name_main_sub_latest=$ip_dir_name_main_sub echo "Update IP Directory: $ip_dir_name_main_sub_latest" fi fi done done echo "Latest IP Directory: $ip_dir_name_main_sub_latest" if [ "$ip_dir_name_main_sub_latest" = "" ]; then echo "Latest IP Directory is null." return 0 fi if [ -d $ip_dir_name_main_sub ]; then echo "Latest IP Directory: $ip_dir_name_main_sub_latest does not exist." return 0 fi for main_version in {1..10} do ip_dir_name_mai # echo "Directory main version: $ip_dir_name_main" for sub_version in {0..20} do ip_dir_name_main_sub=$ip_dir_name_main\_$sub_version # echo "Check IP Directory main_sub version $ip_dir_name_main_sub" if test -d $ip_dir_name_main_sub then if [ "$ip_dir_name_main_sub" == "\" ]; then # double check it is not root direcoty. echo "Error: IP Directory: $ip_dir_name_main_sub is root directory." exit fi # echo "IP Directory: $ip_dir_name_main_sub length: ${#ip_dir_name_main_sub}" if [ ${#ip_dir_name_main_sub} -lt 5 ]; then # double check it is correct echo "Error: IP Directory: $ip_dir_name_main_sub is too short: ${#ip_dir_name_main_sub}" exit fi if [ $ip_dir_name_main_sub != $ip_dir_name_main_sub_latest ]; then # Delete IP Directory: dangerous echo "Delete old IP Directory: $ip_dir_name_main_sub" rm -rf ./$ip_dir_name_main_sub/* rmdir ./$ip_dir_name_main_sub fi fi done done } function get_sub_dir(){ check_dir=$1 # echo "Check Directory: $check_dir" if test -d $check_dir then echo "Check Directory: $check_dir" ip_dir_base_name=${check_dir%%_v[0-9]_*} # echo "IP Directory Base name: $ip_dir_base_name" ip_dir_base_name_rmv_slash=${ip_dir_base_name:2} echo "IP Directory Base name without slash: $ip_dir_base_name_rmv_slash" if [ "$1" != "" ]; then del_old_dir $ip_dir_base_name_rmv_slash fi fi } function getdir(){ echo $1 current_dir_name=`pwd` echo "Current Directory: $current_dir_name" # Make sure it is not in wrong directory. # echo "Current Directory length: ${#current_dir_name} " if [ ${#current_dir_name} -lt 10 ]; then echo "Current Directory is too short: $current_dir_name" echo "Please enter into Xilinx Vitis directory." return 0; fi xilinx_result=$(echo $current_dir_name | grep Xilinx) if [ "$xilinx_result" == "" ]; then echo "Current Directory does not includes Xilinx." echo "Please enter into Xilinx Vitis directory." return 0; else echo "Current Directory includes Xilinx." fi vitis_result=$(echo $current_dir_name | grep Xilinx) if [ "$vitis_result" == "" ]; then echo "Current Directory does not includes Vitis." echo "Please enter into Xilinx Vitis directory." return 0; else echo "Current Directory includes Vitis." fi for sub_dir in $1/* do get_sub_dir $sub_dir done } getdir . 審核編輯:湯梓紅
評論
查看更多