Manage Zephyr Dependencies With a West Manifest and Workspace
Pin Zephyr and its modules with a west.yml manifest so every build of your application uses the same revisions. Covers import, allowlists and updates.

A freestanding Zephyr application builds against whatever Zephyr checkout happens to be on the machine, and that is a problem the first time two people disagree about which one. A west manifest solves it. It is one YAML file that lists every Git repository your firmware depends on, each pinned to a revision, and west update makes the workspace match. This post builds a workspace application around Zephyr 4.2, restricts which of Zephyr's own modules get cloned, and shows how to move to a newer release. It follows on from the standalone application post.
The shape of a workspace application
A workspace application keeps your code in a Git repository that is also the west manifest repository. West's term for the workspace root is the topdir, and everything lives under it:
fw-workspace/
├── .west/
│ └── config
├── app/ <- your repository, holds west.yml
│ ├── west.yml
│ ├── CMakeLists.txt
│ ├── prj.conf
│ └── src/main.c
├── zephyr/ <- cloned by west update
└── modules/
└── hal/... <- cloned by west update.west/config records which folder holds the manifest. The zephyr/ and modules/ folders are created by west update, and they are not part of your repository. Commit only app/, and anyone can recreate the rest.
Write the manifest
The manifest, app/west.yml, imports Zephyr's own manifest and pins its revision:
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v4.2.0
import:
name-allowlist:
- cmsis_6
- hal_nordic
- segger
- mbedtls
self:
path: appEach part has a job:
| Key | Meaning |
|---|---|
remotes | A named base URL, so each project needs only a repository name |
projects | The repositories to clone, each with a revision |
revision | A tag, a branch or a full commit SHA |
import | Merge another manifest's projects into this one |
name-allowlist | Of the imported projects, take only the ones listed |
self | Where your own repository sits, relative to the topdir |
The import key is the important one. Zephyr's own west.yml lists around sixty modules, including HALs for every vendor. Importing all of them would clone gigabytes you never build. The name-allowlist takes only the named subset, and the build still works as long as your board's HAL is in the list. The manifest format is defined in the west manifest documentation.
Pinning to a tag such as v4.2.0 is the easy choice. Pinning to a commit SHA is stronger, because a tag can in principle be moved, and a SHA cannot.
Create the workspace
From an empty directory, clone only your repository and let west do the rest:
mkdir fw-workspace && cd fw-workspace
west init -m https://example.com/team/app.git --mr main
west update
west zephyr-export
pip install -r zephyr/scripts/requirements.txtwest init -m clones your repository, reads its west.yml, and writes .west/config. --mr main is the manifest revision of your own repository. west update then clones Zephyr at v4.2.0 and each allowed module. The output lists each project as it is fetched:
=== updating zephyr (zephyr):
--- zephyr: initializing
--- zephyr: fetching, need revision v4.2.0
=== updating hal_nordic (modules/hal/nordic):
=== updating cmsis_6 (modules/hal/cmsis_6):Paths and ordering vary with the manifest content. After this, west build -b <board> app works from the topdir.
See what you have
Two commands tell you the real state of the workspace:
west list
west manifest --resolvewest list prints every project with its path and revision. west manifest --resolve prints the fully merged manifest with imports expanded, which is the one to read when a module is missing:
zephyr zephyr v4.2.0 https://github.com/zephyrproject-rtos/zephyr
cmsis_6 modules/hal/cmsis_6 ...The revision column shows what the manifest asked for, not necessarily what is checked out, so also run west status after editing files by hand.
Add your own dependency
A library your firmware needs is another project. Add it beside Zephyr:
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v4.2.0
import:
name-allowlist: [cmsis_6, hal_nordic, segger, mbedtls]
- name: sensor-lib
url: https://example.com/team/sensor-lib.git
revision: 9f3c2b7a41d0e5b6c8a1d2f3e4b5a69788c0d1e2
path: modules/lib/sensor-liburl replaces remote when the repository is not under a shared base. If sensor-lib has a zephyr/module.yml, Zephyr's build finds it automatically and includes its CMake and Kconfig. Without that file it is only a checked-out folder, and you would add it with ZEPHYR_EXTRA_MODULES. The module post later in this ladder covers the file.
Move to a newer Zephyr
Upgrading is a manifest edit and an update:
cd app
git checkout -b bump-zephyr
## edit west.yml: revision: v4.3.0
git commit -am "Bump Zephyr to v4.3.0"
cd ..
west update
west build -p always -b nrf52840dk/nrf52840 appUse -p always after an update, because stale generated files from the old version survive in build/ otherwise. Read the migration guide for the release before committing, because Zephyr removes deprecated APIs on a published schedule.
Failure modes
**west update leaves a detached HEAD.** That is normal. West checks out the exact revision, and it never keeps a branch for you. Do work in a separate repository, not in zephyr/.
A module is missing at build time. The allowlist is too narrow. Compare the error's module name with west manifest --resolve, and add it to name-allowlist.
Two projects want different revisions of the same module. West stops with a duplicate project error. The importing manifest wins when you define a project of the same name before the import, so declare your override first.
Large first update. A shallow clone saves time. Use west update --narrow -o=--depth=1.
When not to use a manifest
A manifest is overhead for a throwaway sample. It is the wrong tool when you must patch Zephyr itself and track upstream, because then you want a fork as the remote, and the manifest points at your fork's branch. In that case the pinned revision is a branch, and reproducibility comes from the fork's own tags.
Keeping the manifest honest in a team
A manifest only helps if people treat it as the single source of truth. Three habits make that work.
Change versions only in the manifest. A developer who runs git checkout inside zephyr/ to try a fix has a workspace that no longer matches the file, and west update will move it back, possibly discarding their work. Experiments belong on a branch of your own fork, referenced from a separate manifest file.
Review manifest changes like code. A new line in projects brings an entire repository's code into your firmware. The pull request should say why it is needed and who maintains it. A pinned SHA in the diff is also easy to compare with the upstream history.
**Run west update in continuous integration from a clean directory.** If the job passes there, the manifest is complete. If it only passes on a developer machine, something is cached locally that the manifest does not describe. Pair this with a cache of the downloaded repositories to keep the job fast.
Using a second manifest file for experiments
West lets you point at an alternative manifest without editing the real one. Create west-experiment.yml that imports your main file and overrides one project:
manifest:
projects:
- name: zephyr
url: https://github.com/example-fork/zephyr
revision: fix-uart-timeout
import: true
self:
path: app
import: west.ymlActivate it with west config manifest.file west-experiment.yml followed by west update, and go back with west config manifest.file west.yml. The override has to come first for the importing rule to prefer it, so keep the fork project defined before the import. This gives you a one-command switch between the pinned release and a fork branch, without touching the committed manifest.


