zehpyr 搭建開發環境遇到的一些問題

問題一: west build指令提示不支持build 操作

問題描述如下:

 解決:

官網描述參考: https://docs.zephyrproject.org/latest/guides/west/troubleshooting.html

根據官網描述,build、flash等指令屬於擴展指令,這些擴展指令必須在west workspace中

有兩種解決方法:

  1. Run the command from inside a workspace (e.g. the zephyrproject directory you created when you got started).

    For example, create your build directory inside the workspace, or run west flash --build-dir YOUR_BUILD_DIR from inside the workspace.  運行時指定通過 --build-dir 指定workspace

  2. Set the ZEPHYR_BASE environment variable and re-run the west extension command. If set, west will use ZEPHYR_BASE to find your workspace.  使用環境變量ZEPHYR_BASE  指定workspace

 

問題二:某些模塊的頭文件找不到

描述:例如運行hello_world samples程序時,執行下列指令

cd samples/hello_world
mkdir build && cd build
cmake -GNinja -DBOARD=nrf52_pca10040 ..

執行 ninja 構建編譯時,會報 類似 nrfx.h 頭文件找不到的問題,打開工程也確實找不到;

原因:開發板的HAL和一些lib是通過module的形式集成到zephyr中的,即zephyr源碼中未包含這部分內容,需要使用west update這樣的命令進行安裝,我在windows中下載實際體驗也是非常的慢。

解決:

  進入zephyr 工程根目錄,執行 west init -l   

  然後, west update 更新開發板的HAL和lib,  更新的內容由根目錄下的west.yaml 文件定義的,當然也可以根據項目需要,只更新需要的模塊

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章