Skip to main content
BlogIndustry ConferenceZephyr Developer Summit

Exploring Zephyr: Secure Code Execution, Board Support, OpenAMP, and Documentation Improvements

By October 9, 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:

WASM on Zephyr: Securely Running Code in Any Language – Daniel Mangum, Golioth

At the Zephyr Developer Summit, Daniel Mangum from Golioth presented an in-depth exploration of integrating WebAssembly (WASM) with the Zephyr RTOS to enhance security and flexibility in embedded systems. WASM, traditionally seen as an alternative to JavaScript in browsers, is gaining traction in embedded environments due to its lean runtime, robust sandboxing, and support for multiple programming languages.

Daniel detailed the structure of WASM modules, emphasizing how imports and exports enable seamless interaction between module code and the host environment. He highlighted the inclusion of the WebAssembly Micro Runtime (WAMR) as a Zephyr module, which simplifies running code compiled from any language within Zephyr applications. The talk covered the essential steps of decoding, validating, and executing WASM modules, and explained how instantiation and invocation processes work within the sandboxed environment.

A significant portion of the presentation focused on practical implementation, showcasing a demo where a WASM module was deployed on an NRF52840 development kit with an ESP32 for Wi-Fi. The module monitored temperature values and triggered alerts based on predefined thresholds, demonstrating how WASM can provide consistent logic across different execution contexts, such as microcontrollers and browser environments.

Daniel also discussed the advantages and limitations of using WASM in embedded systems. While WASM offers platform and language independence, enabling transferable computation across heterogeneous environments, it introduces additional complexity and memory overhead compared to native code. He compared WASM with alternatives like Lex and addressed concerns regarding debugging and performance, noting that while WASM may not always match the efficiency of C, its safety features and sandboxing capabilities offer significant benefits for specific use cases.

The session concluded with a Q&A segment where Mangum addressed questions about WASM’s footprint, performance comparisons with other scripting languages, and the potential impact of WASM on web development. He acknowledged the trade-offs involved in adopting WASM for embedded applications and emphasized its value in scenarios requiring dynamic code execution and secure, isolated environments.

Working with the Community: A Timeline for Adding Support for a New Board in Zephyr – Daniel Baluta, NXP Semiconductors

At the Zephyr Developer Summit, Daniel Baluta from NXP Semiconductors presented a comprehensive guide on upstreaming support for a new board in Zephyr OS. Recognizing that the existing Zephyr board porting guide may not suffice for newcomers, Daniel explored the complete timeline for upstreaming board patches with a focus on community interaction to optimize the process from the first iteration to final patch acceptance.

Daniel began by outlining the goals of the presentation and introduced the Zephyr development environment, including the release cycle and steps to get started with Zephyr development, such as obtaining the toolchain. He provided an overview of the newly introduced hardware module version two, emphasizing its streamlined approach to adding basic support for new boards.

Drawing from his experience with the Linux kernel community, Daniel shared his perspective on collaborating with the Zephyr community. He detailed the preparatory steps of adding toolchain support and integrating it into the Zephyr CI environment. The presentation covered how to organize board patches, focusing on code quality, documentation, and tests. Daniel highlighted the importance of writing good commit messages, splitting pull requests into manageable patches, and making the reviewer’s life easier to accelerate patch acceptance.

A significant portion of the talk was dedicated to a practical example of adding support for the i.MX Plus EVK board. Daniel demonstrated the steps involved in creating configuration files, defining device trees, and ensuring compatibility with the Zephyr SDK. He outlined a typical timeline, advising contributors to budget around five weeks for toolchain support, CI integration, and patch merging.

During the Q&A session, Daniel addressed questions about Zephyr’s Git workflow, emphasizing the need for a clean commit history and ensuring that each commit is individually acceptable and buildable. He also discussed the CI checks performed during pull requests, including compilation, static checks, and testing.

Zephyr and OpenAMP – Mohammed Billoo, MAB Labs Embedded Solutions

At the Zephyr Developer Summit, Mohammed Billoo from MAB Labs Embedded Solutions presented a detailed discussion on integrating Open Asymmetric Multi-Processing (OpenAMP) with Zephyr OS. OpenAMP is a valuable framework for environments where disparate processors run with shared resources, such as a microcontroller with an application processor on the same System-on-Chip (SoC). Mohammed demonstrated how to set up Zephyr to support OpenAMP, focusing on a Zynq Ultrascale+ MPSoC board containing a Cortex A53 running Embedded Linux and a Cortex R5 running Zephyr.

Mohammed began by outlining the motivation behind his work, highlighting the increasing complexity of heterogeneous multiprocessor systems where multiple microcontrollers and processors coexist on a single silicon die. He emphasized the benefits of distributing workloads across different microcontrollers and processors to enhance speed and reduce latency. The presentation covered the OpenAMP framework, detailing its core components: remoteproc and RPMsg, which facilitate communication between Linux and microcontrollers.

He explained the system architecture of his project, illustrating how Zephyr interacts with OpenAMP on the Zynq Ultrascale+ MPSoC board. Mohammed shared his experiences transitioning from FPGA engineering to embedded software, providing insights into the practical challenges and solutions encountered during the integration process. He demonstrated the setup process, including configuring the toolchain, defining device trees, and ensuring proper communication between the Cortex A53 and Cortex R5 processors.

A significant portion of the talk focused on the implementation steps, such as enabling remoteproc and RPMsg in the Zephyr configuration, setting up shared memory regions, and configuring the Inter-Processor Interrupts (IPI) for communication. Mohammed showcased a practical example where a Zephyr binary running on the Cortex R5 communicates with Embedded Linux on the Cortex A53, sending and receiving messages to demonstrate successful interaction.

He also addressed common issues and resolutions, such as handling firmware loading errors, ensuring correct memory configurations, and managing IPC connections. He highlighted the importance of accurate device tree configurations and shared memory setups to prevent communication faults and segmentation errors. Additionally, he discussed the challenges of debugging OpenAMP interactions and the need for effective tooling to streamline the development process.

During the Q&A session, Mohammed answered questions about performance limitations of OpenAMP, such as throughput constraints due to non-zero copy mechanisms, and discussed potential improvements for zero-copy transfers. He also elaborated on the boot process synchronization between Zephyr and Linux, emphasizing the importance of proper firmware residency and initialization sequences to ensure seamless operation.

Mohammed concluded by outlining the next steps, including upstreaming board support to Zephyr and documenting the integration process to assist other developers. 

Zephyr Documentation BoF – Benjamin Cabé, The Linux Foundation

Benjamin Cabé from The Linux Foundation led a Birds of a Feather (BoF) session at the Zephyr Developer Summit 2024, focused on enhancing Zephyr documentation. The session provided an opportunity for discussing and brainstorming ways to make Zephyr documentation more efficient, leveraging community input to implement several recent improvements.

Benjamin began by reflecting on the feedback from past surveys and community interactions, highlighting common complaints such as difficulty navigating the documentation, poor search functionality, and challenges in finding specific code samples for subsystems and boards. In response, the documentation team has made significant strides, including an improved search experience and better discoverability of code samples.

The presentation detailed the use of the Sphinx documentation framework, emphasizing its extensibility through dedicated annotations. This allows for consistent metadata addition to sample documentation, enhancing the ability to sort and describe each sample effectively. Benjamin showcased examples where metadata links samples to relevant APIs, improving navigability and user experience.

He also discussed ongoing efforts to standardize documentation practices, such as listing build options and dependencies systematically to provide clarity on subsystem functionalities. The integration of Google Programmable Search was introduced as a means to enhance search accuracy and speed, with statistics showing improved query handling and user satisfaction.

During the open discussion, Benjamin encouraged participants to share ideas and draw inspiration from other open-source projects. Topics included improving consistency in documentation, managing image assets, and defining clear target audiences for different documentation sections. The importance of maintaining a clean and organized documentation structure was emphasized to support both new contributors and experienced developers.

Benjamin concluded by outlining future areas for improvement, such as creating end-to-end code samples, enhancing the user interface for searching boards and SoCs, and potentially developing tools to better integrate documentation with community feedback channels. He highlighted the importance of community collaboration in driving these enhancements and expressed hope for continued engagement in future BoF sessions.

Overall, Benjamin Cabé’s BoF session provided valuable insights into the ongoing efforts to improve Zephyr’s documentation, demonstrating a commitment to making the platform more accessible and user-friendly through community-driven initiatives.

 

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.