How to configure your Zephyr project
As described in the recent article “Tools for Zephyr”, west is a tool used to handle different tasks like setting up the code base, building the system and also download and run the system. In this article we will look into the topic of setting up the code base.
There are different ways to handle the source code in a Zephyr project and they are described here (Workspaces) inside the Zephyr documentation. I prefer the so-called Forest Topology were you manage the included repositories in a west.yml file that you put under version control.
For this article the west.yml file is used, available in Zellacos github respository zephyrblog_root.
Inside the manifest-repo folder you find the file in the picture below:
In line 3 to 6 you specify the URL:s to the repositories you want to use in your workspace. In line 8 to 14 you specify the projects you want to checkout when issuing a “west update” command.
Line 8 specifies that the folder name should be “zephyr” and that is should clone the repository zephyrproject-rtos (line 9). With revision (line 10) you can specify the tag/branch/version you would like to use of the repository. Finally line 11 specifies wheter also any sub-modules should be fetched during “west update”.
So in this small example we will checkout the full zephyr source tree including sub-modules, plus a small project called zephyrblog_example1.
By issuing the following commands you can checkout, build and run a complete Zephyr workspace in a matter of minutes. Please note that you need to point “west init” to the directory where the west.yml is stored.
(Don’t forget to set ZEPHYR_TOOLCHAIN_VARIANT and ZEPHYR_SDK_INSTALL_DIR first)
git clone https://github.com/Zellaco/zephyrblog_root.git
cd zephyrblog_root
west init -l manifest-repo
west update
west build -b native_posix -t run zephyrblog_example1