What is Zephyr?

  Zephyr Project is a small, scalable real-time operating system for use on resource-constrained systems supporting multiple architectures.  Developers are able to tailor their optimal solution. As a true open source project, the community can evolve the Zephyr Project to support new hardware, developer tools, sensor and device drivers.  Advancements in security, device management capabilities, connectivity stacks and file systems can be easily implemented.

官方网站:https://www.zephyrproject.org/

开发环境、SDK、OS

安装要求与相关设置

Ubuntu安装所依赖的软件包

$ sudo apt-get install git make gcc g++ python3-ply ncurses-dev python3-yaml dfu-util device-tree-compiler

Zephyr SDK

运行安装SDK(先加权后执行)

$ chmod +x zephyr-sdk-0.9.1-setup.run
$ ./zephyr-sdk-0.9.1-setup.run

   Verifying archive integrity... All good.

   Uncompressing SDK for Zephyr  100%

   Enter target directory for SDK (default: /opt/zephyr-sdk/):

   Installing SDK to /opt/zephyr-sdk

   Creating directory /opt/zephyr-sdk

   Success

   [*] Installing x86 tools...

   [*] Installing arm tools...

   [*] Installing arc tools...

    [*] Installing iamcu tools...

   [*] Installing nios2 tools...

   [*] Installing xtensa tools...

   [*] Installing riscv32 tools...

   [*] Installing additional host tools...

   Success installing SDK. SDK is ready to be used.

设置SDK的环境变量,创建并将一下两条指令写入 ~/.zephyrrc 文件中

/* 此语句代表使用Zphyr GCC编译器 */
$ export ZEPHYR_GCC_VARIANT=zephyr
/* 此语句制定Zephyr SDK路径*/
$ export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk

运行Zephyr 小例程

根目录执行脚本,设置Zephyr 项目的环境变量

/zephyr-v1.8.0/$ source zephyr-env.sh

构建一个项目示例,在 $ZEPHYR_BASE/samples/hello_world 目录下执行 make

/zephyr-v1.8.0/samples/hello_world/$ make

构建一个项目示例,并自定义开发板并仿真(qemu_x86),在 $ZEPHYR_BASE/samples/hello_world/目录下执行 make BOARD=qemu_x86 qemu

/zephyr-v1.8.0/samples/hello_world/$ make BOARD=qemu_x86 qemu

构建一个项目示例,并自定义开发板并仿真(qemu_cortex_m3),在 $ZEPHYR_BASE/samples/hello_world/目录下执行 make BOARD=qemu_cortex_m3 ARCH=arm qemu

/zephyr-v1.5.0/samples/hello_world/$ make BOARD=qemu_cortex_m3 ARCH=arm qemu

注:qemu为模拟处理器(仿真),SDK 自带。

支持仿真的平台架构在/zephyr-v1.8.0/boards 目录中可以看到:文件夹命名为qemu_xxx

需要帮助请执行make help

/zephyr-v1.8.0/$ make help

---------END

04-21 00:39