I mentioned manifests before, and now it’s time to talk about them. But what is a manifest, anyway? It’s simply a west.yml file that West uses to manage your project—for example, specifying the Zephyr version, directories, and the modules your project depends on. This way, we can avoid downloading the entire Zephyr project, including support for platforms we’re not using. But enough talk, let’s dive in!

Create a new directory and then another directory where you have to create a file called west.yml, this my friend is going to be your manifest

$ mkdir myProject
$ mkdir myProject/app
$ touch myProject/app/west.yml

open the west.yml file and write the most simple manifest

manifest:
  # lowest version of the manifest file schema that can parse this file’s data
  version: 0.8

To test our manifest init our project with the --local flag:

$ cd app
$ west init --local .
=== Initializing from existing manifest repository app
--- Creating /home/user/workspace/.west and local configuration file
=== Initialized. Now run "west update" inside /home/user/workspace.

The previous command only creates an upper directory called .west than for the moment will only have a config file, do not touch this file.

.
├── app
│   └── west.yml
└── .west
    └── config

Time to add our source files, which in our case will be the same files main.c, CMakeLists,txt and prj.conf from previous posts (I'm not going to repeat that a gain), but basically you will have the following structure

.
├── app
│   ├── CMakeLists.txt
│   ├── prj.conf
│   ├── src
│   │   └── main.c
│   └── west.yml
└── .west
    └── config

Next we modify our manifest file to add the zephyr source code and indicate which version we need

manifest:
  # lowest version of the manifest file schema that can parse this file’s data
  version: 0.8
  
  self:
    path: app
    
  projects:
    - name: zephyr
      # indicate the zephyr version we will use
      revision: v4.1.0
      # point to official github repo
      url: https://github.com/zephyrproject-rtos/zephyr
      # place zephyr source code into a directory called deps
      path: deps/zephyr

Run west update on myProject root directory

$ west update
=== updating zephyr (deps/zephyr):
--- zephyr: initializing
...

yeah!!, a new directory appears containing the zephyr source code

.
├── app
│   ├── CMakeLists.txt
│   ├── prj.conf
│   ├── src
│   │   └── main.c
│   └── west.yml
├── build
│   ├── build_info.yml
│       ...
├── deps
│   ├── modules
│   └── zephyr
└── .west
    └── config

Now, we just need the second most important part to be able to build our project, the corresponding HAL drivers for our particular CPU and microcontroller manufacturer, which in our case is a Cortex-M and Nordic Semi.

 manifest:
  # lowest version of the manifest file schema that can parse this file’s data
  version: 0.8
  
  self:
    path: app
    
  projects:
    - name: zephyr
      # indicate the zephyr version we will use
      revision: v4.1.0
      # point to official github repo
      url: https://github.com/zephyrproject-rtos/zephyr
      # place zephyr source code into a directory called deps
      # and get the cmsis and nordic HALs
      import:
        path-prefix: deps
        name-allowlist:
          - cmsis
          - hal_nordic

west update again just to notice that now deps/modules/ directory is not empty, it has the cmsis and the nordic sub-directories

.
├── app
│   ├── CMakeLists.txt
│   ├── prj.conf
│   ├── src
│   │   └── main.c
│   └── west.yml
├── build
│   ├── build_info.yml
│       ...
├── deps
│   ├── modules
│   │   ├── cmsis
│   │   └── nordic
│   └── zephyr
└── .west
    └── config

Time to build our project

$ west build -p always app
-- west build: making build dir /home/user/workspace/build pristine
...
Memory region         Used Size  Region Size  %age Used
           FLASH:       22754 B      1428 KB      1.56%
             RAM:        4432 B       188 KB      2.30%
        IDT_LIST:          0 GB        32 KB      0.00%
Generating files from /home/user/workspace/build/zephyr/zephyr.elf for board: nrf54l15dk

Working with remotes

Maybe you already have a base project you want to reuse, or a project with a manifest you’d like to clone. The good news is that West works seamlessly with Git. In the following lines, I’ll show you how to use a template we have in our official GitHub repository.

$ mkdir myProject
$ cd myProject
$ west init -m https://github.com/ModularMX/zephyr-template.git

After running the west init command, you’ll see the same file structure as before—this time with all the files we need. In the manifest file west.yml, you’ll need to add the packages you want to work with. By default, the manifest only includes CMSIS and the Nordic drivers, since in my case I mainly work with Nordic microcontroller. However, you can make your own adjustments just changing these lines in case using a different platform

name-allowlist:
  # place here all the packages you want to import
  - cmsis
  - hal_nordic

In the same way, in the CMakeLists.txt file you need to set the board you plan to use. if, unlike me, you aren’t using Nordic’s nRF54L15, just change it to another board of your preference, such as a Nucleo board.

# set enviroment variables like the board and the debug server
set(BOARD nrf54l15dk/nrf54l15/cpuapp) 

Then just update to download the Zephyr sour code and build for the first time

$ west update
$ west build app

Much better than before, you see, the manifest allows you to set only the parts of zephyr really needed by your project, you can find more details about west manifest in its official documentation West Manifests — Zephyr Project Documentation and also this nice tutorial in memfault Practical Zephyr - West workspaces (Part 6)