[Vivado+Vitis(SDK) 2019.2] 在軟體開發環境中缺少一堆.h檔的解決方法

最近接手一個Zynq的開發板,新手上路肯定是要參考網路上豐富的文件,才會學得快,其中碰到一個似乎教學的作者沒有提及,但自己遇到的問題,也就是Build時缺少一堆.h檔案的錯誤提示。

(環境:Vivado 2019.2,Vitis 2019.2,Windows10)
網路上沒有提供清楚的解決方法,因此自己記錄下遇到的問題與解決的步驟
    1. 在Vitis(或SDK)創建Application Project,硬體平台選擇Vivado輸出的*.xsa檔案,並且將範例*.c檔匯入src資料夾下,開始Build,會出現以下的提示,重點在於紅色部分
22:54:01 **** Incremental Build of configuration Debug for project LED ****
make all 
make --no-print-directory pre-build
a9-linaro-pre-build-step
' '
make --no-print-directory main-build
'Building file: ../src/LED_test_tut_1C.c'
'Invoking: ARM v7 gcc compiler'
arm-none-eabi-gcc -Wall -O0 -g3 -c -fmessage-length=0 -MT"src/LED_test_tut_1C.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -IC:/Zynq_Book/first_zynq_design/SDK/first_zynq_system_wrapper/export/first_zynq_system_wrapper/sw/first_zynq_system_wrapper/standalone_domain/bspinclude/include -MMD -MP -MF"src/LED_test_tut_1C.d" -MT"src/LED_test_tut_1C.o" -o "src/LED_test_tut_1C.o" "../src/LED_test_tut_1C.c"
../src/LED_test_tut_1C.c:31:10: fatal error: xgpio.h: No such file or directory
 #include "xgpio.h"
          ^~~~~~~~~
compilation terminated.
make[1]: *** [src/subdir.mk:23: src/LED_test_tut_1C.o] Error 1
make: *** [makefile:34: all] Error 2

22:54:02 Build Finished (took 987ms)
    2. 這是在路徑下找不到*.h檔案的意思,但照理來說Vivado的xsa都包含這些了,因此查看在*.h目錄底下到底有甚麼檔案,我的路徑為:
C:\Zynq_Book\first_zynq_design\SDK\first_zynq_system_wrapper\export\first_zynq_system_wrapper\sw\first_zynq_system_wrapper\standalone_domain\bspinclude\include
    3. 發現只有一個檔案"xparameters.h",這為不正常的結果,因此再回到Vitis畫面,直接重新Build BSP一次,並等待執行完成。
    4. 再回到地2步驟的路徑去查看,會發現多出很多*.h檔案,回到Vitis,Build *.c檔案,結果為可以順利完成。

留言

這個網誌中的熱門文章

[Hyper-V] 讓 Windows 可以吃到超過 16TB 的硬碟!