Skip to main content
BlogEventsIndustry ConferenceZephyr Developer Summit

Zephyr RTOS Explored: From System Design to Academic Applications

By August 20, 2024No Comments
Zephyr project developer summit - table discussion

The Embedded Open Source Summit took place from April 16-18 in Seattle, Washington, alongside the Open Source Summit North America. The Zephyr Developer Summit was part of the EOSS, aimed at developers using or considering Zephyr in embedded products. This year, we concentrated on supporting topics relevant to Zephyr users, upstream contributors, and maintainers.

More than 860 individuals from 721 organizations across 46 countries registered for the EOSS conference. The Zephyr track featured over 50 technical sessions, both in-person and on-demand, focusing on users, upstream developers, and maintainers.

Videos from the Zephyr Developer Summit are available on the Zephyr Project YouTube channel. We will highlight a few videos each week in a blog for easy access.

Zephyr project developer summit - table discussion

Today we are featuring:

Charging a Battery with Zephyr – Ricardo Rivera-Matos, Cirrus Logic, Inc.

In this presentation, Ricardo Rivera-Matos explores the integration of battery charging systems within the Zephyr real-time operating system. The session begins with a foundational overview of battery charging in embedded systems, including key terminology and system architecture. Rivera-Matos introduces the Zephyr Charger API, detailing its role in managing charging tasks and its evolution from earlier approaches to battery management in Zephyr.

The talk is divided into three main sections:

Charging fundamentals: An introduction to battery charging systems, including the components involved, such as charging peripherals and their control mechanisms. Ricardo explains the concept of charge profiles, which guide the charging process based on battery specifications.

  • Zephyr charger API overview: A deep dive into the recently integrated Charger API within Zephyr. The speaker discusses its design, features, and advantages over previous methods. The API, inspired by Linux’s power supply class, includes functionalities such as setting and retrieving properties, managing charge cycles, and handling charging status. Ricardo provides insights into how the API interacts with device tree properties and sample applications to demonstrate its practical use.
  • Sample application walkthrough: Ricardo walks through a sample application that demonstrates the Charger API in action. The example shows how to implement a charging task loop, manage power connection statuses, and handle different charging states.

Future improvements and potential expansions for the Charger API are also discussed, including the addition of GPIO-based charger drivers and enhanced support for telemetry.

 

Clock Management in Zephyr RTOS – Daniel DeGrasse, NXP

In this presentation, Daniel DeGrasse discusses the current state and future improvements of clock management within the Zephyr RTOS. The talk begins with an overview of Zephyr’s existing clock control APIs, highlighting their capabilities and limitations. Current APIs support basic functionalities like querying and setting clock rates, gating, and configuring clocks, but they often require complex dependency management, large flash footprints, and lack a generic mechanism for transitioning clocks to lower power states.

Daniel proposes a new clock management framework aimed at addressing these challenges, particularly for smaller embedded devices. The proposed framework introduces a layered approach, with a clock driver layer handling hardware-specific details and a clock management layer abstracting these details for broader use.

Key features of the proposal include:

Hierarchical clock management: The new framework organizes clock nodes hierarchically in the device tree, enabling better code reuse and clearer descriptions of clock hierarchies.

Power state transitions: The framework supports transitioning between different power states, allowing for enhanced power savings by powering down unused clock sources and propagating notifications of clock changes to dependent systems.

Extensible and configurable APIs: The proposed APIs allow for runtime clock configuration and optional runtime rate calculations, providing flexibility for different use cases while minimizing software overhead.

Implementation details: Daniel walks through the proposed implementation, including how clock nodes are defined, configured, and notified of changes, as well as how the framework can be integrated into existing systems with minimal impact on flash and RAM usage.

The talk concludes with a discussion on potential challenges, such as handling dynamic clock frequency changes and the need for runtime validation of clock configurations. 

 

Inter Process Confusion – Navigating Zephyr’s IPC APIs – Andy Ross, Google

In this talk, Andy Ross provides a detailed exploration of the various Inter-Process Communication (IPC) APIs available within the Zephyr Real-Time Operating System (RTOS). Designed for developers who are familiar with basic threading and synchronization techniques in Zephyr, the session aims to clarify the purpose and optimal use cases for the multitude of IPC primitives provided by the OS.

Andy begins by discussing the fundamental need for IPC in Zephyr, which arises from its multithreaded nature. He explains that while Zephyr offers a robust set of tools for synchronization and communication between threads, the sheer variety can be overwhelming, leading to suboptimal design choices in applications. 

The talk emphasizes the importance of selecting the right IPC primitives to manage thread synchronization and communication effectively, especially in resource-constrained environments.

Key topics covered include:

Basic IPC Primitives: A review of fundamental synchronization tools such as semaphores, mutexes, and condition variables. Ross explains their use cases, performance implications, and when to prefer one over the other.

Advanced IPC mechanisms: An overview of more complex IPC structures like FIFOs, message queues, pipes, and the relatively newer K_event and K_poll APIs. Ross details their implementation, advantages, and trade-offs.

Common Pitfalls: Andy highlights typical synchronization mistakes, such as improper use of polling and race conditions that can arise when combining IPC primitives inappropriately. He also provides insights on how to avoid these pitfalls.

User space considerations: The talk touches on the impact of using IPC primitives in user space, where system calls introduce significant overhead, altering the performance characteristics of these mechanisms.

Practical recommendations: Andy concludes with practical advice on choosing the right IPC tools based on the specific needs of an application, urging developers to rely on simpler, well-established primitives where possible and to use more complex constructs like condition variables only when necessary.

This talk serves as a comprehensive guide for navigating Zephyr’s IPC landscape, helping developers make informed decisions to improve the efficiency and reliability of their threaded applications.

 

Learn Operating Systems Theory While Working with Zephyr – Lenka Kosková Třísková, Technical University of Liberec

In this talk, Lenka Kosková Třísková discusses an innovative approach to teaching operating systems theory using the Zephyr RTOS as a practical learning tool. At the Technical University of Liberec, Zephyr is integrated into the curriculum not to teach its specific application in embedded systems but to illustrate the general principles of operating system design and development.

The course, aimed at second-year university students with varying levels of programming and hardware knowledge, is divided into 14 lessons, each lasting about 90 minutes. The lessons cover essential topics such as kernel functionality, system calls, thread creation, synchronization, memory management, and device management. Zephyr was chosen over other operating systems like Linux due to its relative simplicity, multi-architecture support, and suitability for teaching fundamental concepts in a manageable context.

Lenka outlines how the course is structured, with each lesson providing a mix of theoretical background and hands-on exercises. Students learn to configure Zephyr, understand its kernel, create and manage threads, and explore memory and device management. The course also introduces students to advanced topics such as scheduling, synchronization mechanisms (e.g., mutexes and semaphores), and file systems. The ultimate goal is to build a foundation that prepares students for more complex operating systems like Linux in later years.

The talk also highlights the open source nature of the course materials, which are available on GitLab for the broader Zephyr and academic communities. Lenka invites feedback and collaboration to further enhance the course content and make it a valuable resource for anyone interested in operating systems education.

 

Watch the rest of the Zephyr Developer Summit videos here. The schedule and links to the slides can be found here. Photos from the EOSS can be found here.

For more information about the 2024 event, stay tuned by subscribing to the Zephyr quarterly newsletter or connect with us on @ZephyrIoT, Zephyr Project LinkedIn or the Zephyr Discord Channel to talk with community and TSC members.