Written by Derek Snell, Senior Systems & Applications Engineer, NXP
When you use the last egg, I bet you throw out the egg carton. Sometimes, my wife doesn’t toss it. As a preschool teacher, she doesn’t see an egg carton as trash, she sees it as something that can be made into a beautiful craft. She taps into her creativity and collection of tubes, jars, buttons, felt, cardboard, pipe cleaners and paper. I’ve seen her turn an egg carton into a cute caterpillar that is easy and fun to make with her class.
Although I can’t compete with my wife’s creativity, I am a fan of reusing strategies and components whenever possible.
During application development, code reuse is one of the major benefits and attractions for using open-source software. When developing application-specific software, our time and innovation should be spent on that which will differentiate; not on the common building blocks and components that are already available. In the analogy with my wife, we want to create the ‘caterpillar’, not the egg crate. But a major question with code reuse, particularly when that code originates elsewhere, is “Can we depend on it?” Especially when these ‘caterpillars’ need to go to production, we have concerns about the quality of the reused code, how vetted it is and whether or not it will be stable.
Zephyr RTOS also benefits from code reuse. Learn more about what makes Zephyr unique at the blog post “Zephyr OS LTS 2 Release Adds Full Platform Support for i.MX RT600 Crossover MCUs”. But the Zephyr Project also integrates other open source modules, for those instances when the wheel does not need to be reinvented and code reuse can be leveraged.
For example, Zephyr integrates LVGL for graphics, Mbed TLS crypto library and MCUboot for secure bootloader and firmware updates. In addition, NXP’s product portfolio strongly aligns with Zephyr RTOS. As a founding member, NXP is committed to Zephyr, and contributes to the project by upstreaming code to the Zephyr repository. Much of this code is focused on enabling Zephyr and its features on NXP hardware, and the foundation of that hardware support is reused from MCUXpresso SDK. NXP also contributes by testing Zephyr releases on the same board farm used to test the SDK. Today over 5000 Zephyr test cases are run on 17 platforms in the board farm.
Zephyr RTOS provides a set of drivers for common hardware-related features, like Flash and UART drivers. These Zephyr drivers are written to be hardware agnostic and enable Zephyr applications to easily port across the supported hardware platforms. These Zephyr drivers are built on a hardware abstraction layer (HAL), illustrated in the figure below. NXP’s HAL consists of the peripheral drivers and device support directly from the MCUXpresso SDK. That code reuse delivers all the same quality from the testing and production use (discussed earlier), providing a robust and proven foundation for the HAL.
To see specific examples of NXP’s Zephyr software layers, check out the complete blog here.
- Learn more about NXP’s supported platforms: www.nxp.com/zephyr.
- Join us for a closer look at Zephyr OS with this series of on-demand sessions: www.nxp.com/zephyrseries
- Learn more and download the Zephyr OS LTS 2 release today: https://www.zephyrproject.org/developer-resources/#current-release
- Log in to Zephyr’s Discord community and connect with us, ask questions and more: https://chat.zephyrproject.org/