前言
由于我只在ubuntu下开发zephyr,所以所有的实践都是针对ubuntu系统的(ubuntu18.04)
Update Your Operating System
sudo apt-get update && sudo apt-get upgrade //Ensure your host system is up to date before proceeding.
Install Requirements and Dependencies
sudo apt-get install --no-install-recommends git cmake ninja-build gperf \ ccache dfu-util device-tree-compiler wget \ python3-pip python3-setuptools python3-wheel xz-utils file make gcc \ gcc-multilib
关键(针对CMake):由于Zephyr requires a recent version of CMake, 我在上面的install中没有加上cmake, 而从从CMake官网下载最新版(有二进制或者源码安装,都可以,比较方便的是用二进制安装方式安装)来安装, 因为通过sudo apt-get install安装的CMake版本可能会比较低,而官方要求CMake version 3.13.1 or higher is required.
官方给出的如何在系统中存在旧版本的CMake下让Zephyr使用新版本CMake的解决办法如下(但是,最好还是删除旧版的CMake,然后安装最新版):
CMake version 3.13.1 or higher is required. Check what version you have by using cmake --version
. If you have an older version, there are several ways of obtaining a more recent one:
-
Use
pip
: (方法1)pip3 install --user cmake
-
Download and install from the pre-built binaries provided by the CMake project itself in the CMake Downloads page. For example, to install version 3.13.1 in
~/bin/cmake
: (方法2)mkdir $HOME/bin/cmake && cd $HOME/bin/cmake wget https://github.com/Kitware/CMake/releases/download/v3.13.1/cmake-3.13.1-Linux-x86_64.sh yes | sh cmake-3.13.1-Linux-x86_64.sh | cat echo "export PATH=$PWD/cmake-3.13.1-Linux-x86_64/bin:\$PATH" >> $HOME/.zephyrrc