Article
How Devicetree Connects Zephyr To Your Electronics
Bridging Hardware and Firmware: Devicetree in Zephyr and the nRF Connect SDK
Developing a custom electronic product involves more than designing a circuit board and writing software. The embedded software must also understand how the electronic components are interconnected, which hardware resources are available, and how those resources are intended to operate.
In relatively simple electronic products, this information has traditionally been incorporated directly into the application software. As embedded systems become more complex, however, maintaining a clear separation between the hardware configuration and the application software becomes increasingly valuable.
Zephyr, the embedded operating system that forms the foundation of Nordic Semiconductor’s nRF Connect SDK, addresses this challenge through a mechanism known as devicetree.
Describing the hardware to the software
A devicetree provides a structured, machine-readable description of the hardware that makes up an embedded system. It establishes relationships between the processor, its internal peripherals, and the external electronic components connected to it.
Consider a battery-powered wearable device containing a wireless microcontroller, measurement instrumentation, power-management circuitry, status indicators, and user controls. Each of these functions may have different communication interfaces, electrical characteristics, and operating requirements.
While the schematic describes how these components are electrically interconnected, the devicetree describes the hardware from the perspective of the embedded software.
This separation allows much of the application software to remain independent of the specific circuit board on which it operates. It also provides a foundation for supporting multiple hardware revisions, product variants, and development platforms without unnecessarily duplicating application software.
Zephyr Devicetree Documentation
More than a description of pin assignments
Although a devicetree describes many of the physical connections within an electronic product, its significance extends beyond identifying which processor pins are connected to which components.
Modern microcontrollers contain configurable hardware peripherals that may share internal resources. Individual pins may also have different electrical capabilities, power-management characteristics, and restrictions depending on how the processor is operating.
A connection that appears perfectly reasonable on a schematic may therefore introduce limitations that are not apparent until the embedded software is developed.
For example, a battery-powered device may need to enter a very low-power operating state and subsequently wake in response to user interaction. Whether that capability can be implemented may depend on the hardware resources selected during the circuit design.
Similarly, two communication interfaces that appear electrically independent may rely on a common internal processor resource, preventing them from operating simultaneously.
These are examples of why hardware configuration cannot be treated solely as a firmware implementation task. Decisions made during schematic development can directly influence the capabilities and limitations of the embedded software.
Approaches to creating a hardware description
The Zephyr ecosystem provides several approaches to establishing the hardware description for a custom electronic product.
These include developing a board definition directly from the electrical design, adapting an existing board definition, using integrated development environment tools, and employing graphical hardware configuration and pin-planning utilities.
Each approach offers different advantages depending on the nature of the product, the maturity of its electrical design, and the extent to which existing hardware and software assets can be reused.
An established product undergoing a minor hardware revision may benefit considerably from reusing its existing board definition. A substantially different electronic architecture may warrant a new hardware description. Graphical configuration tools can also help make complex processor capabilities more accessible during product development.
Nordic Semiconductor and the broader Zephyr development community provide a growing collection of tools and resources to support these activities.
However, the ability to generate a hardware configuration does not establish that the configuration satisfies the product’s requirements. Development tools can simplify the representation of engineering decisions, but they do not eliminate the need to make those decisions.
Nordic nRF Connect for VS Code
Hardware and firmware development are interdependent
Electronic product development is sometimes approached as a sequential process in which the electrical engineering team completes the circuit design before the embedded software team begins its work.
While this division of responsibilities may appear organizationally convenient, it can obscure important technical dependencies between the two disciplines.
Processor resource allocation, communication interfaces, power-management behavior, interrupt capabilities, and peripheral compatibility all have implications for both the electrical design and the embedded software architecture.
When these considerations are addressed independently, limitations may not become apparent until the first prototype circuit boards have been manufactured and firmware integration is underway.
At that stage, resolving an otherwise straightforward configuration problem may require modifying the circuit board, changing the software architecture, or compromising a product requirement.
Conversely, considering hardware and firmware requirements together during the early stages of development provides greater flexibility in evaluating architectural alternatives.
The devicetree is particularly interesting in this context because it represents a formal interface between the electrical design and the embedded software. It provides a common representation of engineering decisions that otherwise exist across schematics, semiconductor documentation, software configuration files, and product requirements.
Supporting the product throughout its lifecycle
The value of separating hardware configuration from application software becomes increasingly apparent as an electronic product evolves.
Electronic components become obsolete. Manufacturing requirements change. New product variants are introduced. Additional functionality may be required, and existing products may need to transition to newer processor architectures.
A well-structured embedded software architecture can reduce the extent to which these changes propagate throughout the application software.
However, achieving this degree of flexibility requires more than adopting an operating system or configuration framework. It requires deliberate decisions about the boundaries between hardware, device drivers, application software, and product-specific functionality.
These architectural decisions influence not only the initial development effort but also the long-term cost of maintaining, manufacturing, and extending the product.
For products expected to remain in production for many years, particularly medical and industrial equipment, these considerations can have substantial commercial significance.
Conclusion
Devicetree is more than a configuration mechanism within Zephyr. It represents a formal boundary between the physical construction of an electronic product and the software responsible for its operation. The quality of that boundary can influence development efficiency, hardware and software integration, product maintainability, and the ability to accommodate future design changes.
At Wolff Electronic Design, we approach electrical and embedded software engineering as interdependent aspects of electronic product development. By considering their interactions from the earliest stages of system architecture, we seek to reduce avoidable redesign, preserve architectural flexibility, and establish a foundation for the long-term evolution of the product.
