Practical Zephyr - Zephyr Basics (Part 1) | Interrupt

This is the start of a new article series about Zephyr’s basics: It will walk you through Zephyr’s build and configuration systems West, Kconfig and devicetree.


This is a companion discussion topic for the original entry at https://interrupt.memfault.com/blog/practical_zephyr_basics

Thanks so much Martin! This article is exactly what I needed as someone trying to figure out Zephyr. I’ve done bare metal C, but am new to RTOS in general.

At first I couldn’t get “West build” to work, but then found this post: How to build your Zephyr app in a standalone folder - Zephyr Project

Turns out I needed to source the helper file
source ~/zephyrproject/zephyr/zephyr-env.sh

I followed the setup instructions from the Zephyr website, instead of using the Nordic toolchain manager.
-Hunter

Great to hear, thanks! This first article is a little starter that really just serves as a “bring-up” to be able to follow along when diving into Kconfig and Devicetree. Using Nordic’s toolchain manager is just a short-cut for the setup. In the last article of this series we’ll revise our setup and see what we can truly do with West. Then, you’ll really only need to install tools, no more sources needed since it is all managed by West. Hope you’ll stick around for the last article!

I had to do some digging to find the new location for the west binaries.
Please also add the following path to the setup.sh
$ncs_install_dir/toolchains/$ncs_bin_version/usr/local/bin

Using ubuntu 22.04 i also have to install libpython3.9 which is available via ppa (deadsnakes)

But even after that i had still issues using the west flash command.
In the end i am relying on using VSCode inside of WSL( where all of this is happening ), to flash and debug. I am forwarding the usb device to it via usbpid. But still quite helpful what is happening in the blog post.

I cannot thank you enough for this article series, @martin. It absolutely saved my butt, as I’m trying to manually configure the Zephyr toolchain for ESP32 on a Docker image, and the official Getting Started guide does not define many crucial concepts and definitions. The official documentation is a great reference–IF you know what to look/search for. Your tutorials offer much-needed guidance on such definitions and what to look for when setting up the toolchains and board definitions/configs.

2 Likes

One more thing which may not be obvious for certain users : what is ‘sourcing‘ a script..

Here is a good link explaining this : Difference Between Sourcing and Executing a Shell Script | Baeldung on Linux

Also, I am worried that the part about toolchain manager may be outdated.

I followed instructions (on Win11) and go lost after installing the toolchain manager, as it no longer seems to be available.

I tried the instructions on a clean Ubuntu and also there the instructions don’t match : the separate toolchain manager seems to no longer exist. You can only install the toolchain from the nRF Connect extension. After doing so, I’ve found ‘west‘ is installed in

/home/<user>/ncs/toolchains/b2ecd2435d/usr/local/bin/west

so a different location from what is explained in the blogpost.. Then also the setup.sh script needs to be adjusted. Being out of date, this blogpost needs an update or it will create even more confusion.

There’s an update coming soon!