Getting Started with ZephyrOS
ZephyrOS is an open source RTOS targeted towards embedded systems that includes community support for many Microchip development boards. This class will introduce an engineer to the coding environment, SDK, and debug tools available within the ZephyrOS ecosystem. Using hands-on examples, the engineer will gain experience with useful OS primitives and tasks, explore the hardware's Device Tree, build and deploy to target hardware.
Upon completion, you will:
- Learn how to install and navigate a ZephyrOS project
- Gain an understanding of the basic ZephyrOS commands and mechanics
- Create a new ZephyrOS project structure, ready for a clean application build
- Use Zephyr's
westtool to build and debug project code for a given target - Become familiar with the usage of built-in kernel APIs for message queues, semaphores, and tasks
- Gain insight into the ZephyrOS Devicetree system including sources and overlays
Prerequisites
The lab material assumes you have prior experience with:
- Any embedded RTOS (Real Time Operating System)
- C language programming
Conventions
Code blocks use the following conventions to mark changes and important lines:
Highlighted lines (yellow background) indicate lines that have been modified.
int a = 1;
int b = 2;
int c = a + b;
Green lines indicate newly added code.
int a = 1;
int b = 2;
int c = a + b;
int d = c * 2;
Red lines indicate code that should be deleted.
int a = 1;
int b = a / 0;
int c = a + 1;
Bold lines indicate a line of particular importance.
int a = 1;
void importantFunction(void);
Shell session blocks show the full prompt in a muted color so you can see which terminal you are in. The Copy button copies only the command, not the prompt. Selecting text manually also skips the prompt.
(.venv) $ west build -p always -b same54_xpro .
(.venv) $ west flash
uart:~$ kernel threads list
(.venv) PS C:\Users\you\zephyrproject> west build -p always -b same54_xpro .
Relevant information about a specific topic.
A critical detail that could cause issues if overlooked.
A helpful suggestion or shortcut that can make your workflow easier.
Software Requirements
The following software is required for all labs.
- Visual Studio Code
- Serial Monitor extension - install from the VSCode Extensions tab: marketplace.visualstudio.com
- Zephyr SDK and host tools
All needed software will be pre-installed for the in-person class. For future reference, the completed lab code can be found at: github.com/sarpuser/getting-started-with-zephyr