Zephyr RTOS uses a Devicetree system to centralize hardware descriptions, replacing scattered HAL initialization code with structured .dts, .dtsi, and .overlay files. The .dts file defines the top-level board description, .dtsi files provide inheritable SoC and peripheral definitions, and app.overlay files let developers customize hardware configuration per project without modifying vendor files. At build time, these files are compiled into a devicetree_generated.h header, exposing macros that decouple application code from hardware specifics. A practical example walks through adding a custom LED on GPIO1 pin 22 using an overlay, demonstrating how aliases and compatible bindings enable hardware-agnostic firmware.

11m read timeFrom beningo.com
Post cover image
Table of contents
What is a Devicetree?The Devicetree Source File (.dts)The Devicetree Source Include File (.dtsi)The Devicetree Application Overlay File (.overlay)How Zephyr RTOS Builds and Uses the DevicetreeAdding an LED with an Application OverlayWriting Your app.overlayYour Next StepsAdditional Resources
1 Impression