Ubuntu 16.04 配置 zephyr 1.14 开发环境

mingdu.zheng at gmail dot com
https://blog.csdn.net/zoomdy/article/details/89556132

官方文档

基本上参照官方文档就可以了,有几个依赖包的版本不一致,需要特别处理一下。

https://docs.zephyrproject.org/1.14.0/getting_started/index.html

首先更新系统

不清楚不更新会怎样,还是按照要求更新一下吧。

sudo apt-get update
sudo apt-get upgrade

安装依赖包

注意: 官方文档包含了 cmake 和 device-tree-compiler,但是 Ubuntu 16.04 默认安装的 cmake 和 device-tree-compiler 版本过低,这里要忽略 cmake 和 device-tree-compiler 的安装,后续补装。

sudo apt-get install --no-install-recommends git ninja-build gperf ccache dfu-util wget \
python3-pip python3-setuptools python3-wheel xz-utils file make gcc gcc-multilib

安装 cmake

pip3 install --user cmake

安装 device-tree-compiler

默认安装的 device-tree-compiler 版本是 1.4.0,但是 zephyr-1.14 需要 1.4.6 及以上版本。

wget https://mirrors.tuna.tsinghua.edu.cn/ubuntu/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.7-3_amd64.deb
sudo dpkg -i device-tree-compiler_1.4.7-3_amd64.deb

更新 setuptools

zephyr-1.14 要求 setuptools 版本在 40.0 及以上,更新 setuptools。

pip3 install setuptools

忽略 SDK 的安装

下载 SDK 实在太慢,自己下载 ARM GCC 吧。

忽略 west 的安装

不要引入太多的自动化,自动化会隐藏一些细节,我希望把这些细节搞清楚,搞清楚了以后再自动化。

安装 python 依赖包

在这步之前,一定要把 setuptools 更新好,pyocd 需要 setuptools 在 40.0 及以上版本。

pip3 install --user -r zephyr/scripts/requirements.txt

配置编译器

echo "export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb" > ~/.zephyrrc
echo "export GNUARMEMB_TOOLCHAIN_PATH=\"/home/user/gcc-arm-none-eabi-5_4-2016q3\"" >> ~/.zephyrrc

make 编译 hello world

首先配置一下环境,zephyr-env.sh 在 zephyr 源代码根目录下,注意路径问题。默认情况下,cmake 生成 makefile 。

source zephyr-env.sh

然后开始编译,采用 make 编译。

cd samples/hello_world
mkdir build && cd build
cmake -DBOARD=reel_board ..
make

ninja 编译 hello world

首先配置一下环境,zephyr-env.sh 在 zephyr 源代码根目录下,注意路径问题。通过参数 -GNinja 告知 cmake 生成 ninja 文件。

source zephyr-env.sh

然后开始编译,采用 make 编译。

cd samples/hello_world
mkdir build && cd build
cmake -GNinja -DBOARD=reel_board ..
ninja
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值