Building a Modular Codebase with Zephyr RTOS and Devicetree
If there’s one thing the chip shortage has taught us, it’s to be ready to pivot to different hardware on a short timeline. I’ve found that the Zephyr Real-Time Operating System makes this much less painful for firmware engineers. It borrows many concepts from the Linux ecosystem, delivering Devicetree, Pin Control, and Kconfig to microcontroller-land.
In this talk I will detail how I use Zephyr to maintain one codebase that can be built for many different hardware combinations. Once a Kconfig and Devicetree overlay files have been created for each target, compiling the same project for Nordic, Espressif, or NXP chips (to name just a few) is simple. Changing vendors or models of sensor and other peripherals is a similar experience. The C code grabs all necessary hardware information like what pins are connected and which peripheral bus should be used for a particular build. From there it’s just a matter of changing the board name in the build command.
Join me for a tour of what this looks like in real-world examples where changing out a microcontroller or sensor no longer leads to premature hair loss and hypertension.