Wednesday, 17 May 2023

Starting a new Zephyr project using West

Zephyr and its package manager West are getting a lot of attention these days. Unfortunately the rapid pace of software development isn't always matched with documentation and West in particular is pretty obscure.

When starting a new project, I tend to set-up the environment first with a "Hello World" type example and then write software from there. With this in mind, here's a minimal west.yaml file that you can use to build your project on top of, but separate from, Zephyr:

manifest:
  version: "0.13"

  remotes:
    - name: FOO
      url-base: https://github.com/FOO
    - name: zephyrproject
      url-base: https://github.com/zephyrproject-rtos

  defaults:
    remote: FOO

  projects:
    - name: zephyr
      remote: zephyrproject
      path: zephyr
      west-commands: scripts/west-commands.yml
      revision: main

  self:
    path: BAR

  1. Copy & paste the above into a west.yaml file in the root of your FOO/BAR repository
  2. Copy a Zephyr sample from https://github.com/zephyrproject-rtos/zephyr/tree/main/samples into the root of your FOO/BAR repository. I use hello_world.
  3. Install west - see any number of web tutorials about how to do this
  4. Create an empty directory somewhere and cd into it
  5. Run west init -m https://github.com/FOO/BAR
  6. Run west update
  7. Run west build BAR to build the sample which is now completely detached from Zephyr

No comments:

Post a Comment