Skip to main content
BlogEventsIndustry ConferenceZephyr Developer Summit

Modular Firmware Design: Integrating Shell Over BLE and Microservices Architecture in Zephyr

By September 3, 2024No Comments

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.

Today we are featuring:

Microservices for Microcontrollers: Composable Software Architecture for Embedded Devices – Sam Friedman, Golioth

In his talk at the Zephyr Developer Summit, Sam Friedman of Golioth delivered a talk titled “Microservices for Microcontrollers: Composable Software Architecture for Embedded Devices.” The presentation focused on addressing the common challenges of firmware development, particularly the difficulties of managing tightly coupled monolithic codebases. These monolithic designs often lead to challenges in code reuse, where even small changes across different product versions require extensive modifications or result in copying large portions of the codebase, increasing the risk of bugs and wasting valuable development time.

Sam proposed an alternative approach inspired by the microservices architecture popular in the cloud computing world. He discussed how this concept could be adapted for embedded systems by breaking down firmware into fine-grained, loosely coupled modules or tasks. These tasks would communicate through well-defined Inter-Process Communication (IPC) mechanisms, allowing for easier testing, maintenance, and, most importantly, composability. Composability, a key benefit of this approach, enables developers to build complex applications by assembling small, reusable modules, thus facilitating code reuse across different products or versions.

In the Zephyr environment, this modular approach can be implemented using features like zbus, kconfig, and iterable sections. Friedman elaborated on how zbus, Zephyr’s implementation of a pub/sub messaging system, facilitates the communication between tasks without direct dependencies. He also explained the role of iterable sections in enabling tasks to register themselves during the build process, thereby reducing the need for centralized orchestration of task management.

The talk included a real-world example of a cold chain asset tracker, illustrating how this architecture could simplify adding or removing features, such as an over-temperature alarm, without disrupting the overall system. The modular design allows for easy updates and maintenance of the firmware across different product versions, ensuring long-term support for products in the field.

Sam emphasized the importance of maintaining loose coupling between tasks to maximize the benefits of a microservices-like architecture in embedded firmware development.

Open Source Contribution Update: Shell Over BLE – Luis Ubieda, Croxel, Inc.

At the Zephyr Developer Summit during the Open Source Summit North America, Luis Ubieda of Croxel, Inc. presented an insightful session on Shell Over BLE. This presentation covered the implementation and application of a Command-Line Interface (CLI) shell over Bluetooth Low Energy (BLE), enabling direct interaction with embedded devices, which is vital for issue diagnosis and adding key functionalities in Zephyr-based applications.

The session began with an overview of Bluetooth LE, emphasizing its importance in wireless communication for embedded systems. Ubieda detailed the basics of Zephyr Shell and how BLE can serve as a backend for it, allowing for wireless shell access to embedded devices. He explained the significant advantage of utilizing the Zephyr Shell over BLE for developers who frequently (re)write custom command-based protocols or implement CLI-like interfaces in their applications.

The presentation also discussed the implementation of this feature using Nordic’s Uart over BLE (NUS) service. Luis elaborated on the benefits of routing shell commands and logging subsystems over BLE, highlighting its flexibility and ease of integration into existing Zephyr projects. He provided a live demo showcasing a Zephyr-based firmware device with Shell over BLE, demonstrating practical applications such as sensor data retrieval and LED control via wireless commands.

Luis concluded by discussing the upstream contribution status of this feature to the Zephyr Project, emphasizing that it is now part of the mainline code, addressing a longstanding request in the Zephyr community. He also provided insights into potential security implications, stressing the importance of implementing appropriate authentication and encryption when using Shell over BLE in production environments.

This session is particularly beneficial for developers interested in incorporating wireless shell capabilities into their Zephyr-based projects, offering a comprehensive guide on leveraging this powerful feature for enhanced device interaction and management.

 

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.