zephyr 环境设置

2016/03/08 注:今天搜了一下,有个blog也记录了几乎一样的内容,参考:

http://coldnew.github.io/blog/2016/02/21_zephyr/?utm_source=tuicool&utm_medium=referral

zephyr 是 Linux 基金会推出的面向物联网的 RTOS,与 Linux 相比 footprint 非常小。虽然是第一版,但是源代码是风河的 Rocket,应该本身就是比较成熟了。

目前在本地的环境上试了一下。

下面是相关的记录。

可参考:

https://www.zephyrproject.org/doc/getting_started/getting_started.html


1. 代码的下载

$ git clone https://gerrit.zephyrproject.org/r/zephyr zephyr-project

2. SDK 下载

$ wget https://nexus.zephyrproject.org/content/repositories/releases/org/zephyrproject/zephyr-sdk/0.7.2-i686/zephyr-sdk-0.7.2-i686-setup.run

这是个自解压包,直接执行:

$ chmod +x zephyr-sdk-0.7.2-i686-setup.run
$ ./zephyr-sdk-0.7.2-i686-setup.run

注:这里可以选择安装在如$HOME目录,所以可以不用 sudo


3. 设置配置文件

设置 $HOME下的 .zephyrrc 文件,这里的 /opt/zephyr-sdk 需要sdk的安装目录。

$ cat <<EOF > ~/.zephyrrc
export ZEPHYR_GCC_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
EOF

4. 编译测试程序

编译之前要执行代码库里的脚本:

$ source zephyr-env.sh


4.1. 编译 zephyr/samples/hello_world/nanokernel

$ make -C zephyr/samples/hello_world/nanokernel qemu

最后编译完成后会启动 qemu 虚拟环境,显示 hello, world 这一句话。


4.2. 编译 zephyr/samples/hello_world/microkernel

$ make -C zephyr/samples/hello_world/microkernel qemu

最后编译完成后会启动 qemu 虚拟环境,显示 hello, world 这一句话。


4.2. 编译 针对ARM的 zephyr/samples/hello_world/microkernel
$ cd zephyr/samples/hello_world/microkernel
$ make distclean
$ make BOARD=qemu_cortex_m3  ARCH=arm qemu 

4.2. 编译其他 samples

如 shell 的使用示例:

$ cd zephyr/samples/shell

$  make BOARD=qemu_cortex_m3  ARCH=arm qemu 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值