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 文件定义的,当然也可以根据项目需要,只更新需要的模块

 

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