Categories
IoT Zephyr

Zephyr Weekly Update – Gotta love ’em snippets

Welcome to the second edition of the Zephyr Weekly Update series covering the week of March 24-31, 2023. In this series, I try to highlight some of the noteworthy changes that made it into Zephyr over the past week.

This week is all about snippets, a couple interesting new boards, and as always lots of activity on the drivers front. Let’s dive right in!

Snippets

The most significant update this week is the introduction of Snippets.

If you’re like me, you’ve probably often found yourself reusing similar snippets of configuration (sometimes alongside corresponding devicetree overlays) to add a bit of functionality to your project. Things like overriding the default physical UART and Zephyr console to use a USB CDC-ACM UART one instead, enabling your favorite debugging combo (shell, custom log levels, …), etc.

However, the current build system lacked an extensible and composable solution that allows for capturing and naming such “snippets”, so that they can be referenced at build time, as opposed to copied repeatedly across your various projects.

Enter snippets! Snippets help streamline your project’s configuration by allowing you to define commonly used settings and then reference them when needed. This way, you can maintain a cleaner, more organized project structure while reducing the risk of errors caused by manual copy-pasting or inconsistent configurations across various parts of your project.

If it’s still not 100% clear to you how snippets can help you, check out this sample. It demonstrates how adding and enabling a USB CDC-ACM console to your project is now just a west build -S cdc-acm-console […] away. This will, behind the scenes, automagically:

  • add a cdc-acm-uart to an existing zephyr_udc0 node.
  • override the chosen zephyr,console so that it uses it.
  • set the proper KConfig options so that the USB device stack automatically boots up and is properly configured and will of course enable the new USB-based console.

Boards and SoC support

Arduino Giga R1 Wi-Fi
Arduino Giga R1 Wi-Fi

STM32H573I-DK Discovery kit
STM32H573I-DK Discovery kit
  • Support for the Arduino Giga board dropped shortly before I started this weekly update. It’s an impressive dual-core board from Arduino, which was recently announced and supported in Zephyr from day 1! As of this week, it is now also possible to use it for BLE [cf1ee6f615]
  • STMicroelectronics will soon be releasing a new Discovery Kit (STM32H573I-DK) for their STM32H573IIK3Q MCU.
    Commit [1f23bd7cf7] added support for this Arm Cortex-M33 based board featuring 2 MB of flash memory, and 640 KB of SRAM. It also has an LCD display and a Wi-Fi module, so it’s getting on my wish list!
    • In fact, it goes beyond just this specific board, as support for the complete STM32H5 series has been added [3b1dd7380b]
  • Added remote flashing support for MEC172xEVB_ASSY6906 board [efb3ccf2db]
  • Implemented cache management API for ARM Cortex-A and Cortex-R [98d4faf099]

Drivers

Texas Instruments BP-BASSENSORSMKII BoosterPack™
Texas Instruments BP-BASSENSORSMKII BoosterPack™
  • The TMD2620 proximity sensor is the kind of sensor you could find in your phone for detecting when to turn the screen off due to it being close to your ear. Commit [924ac2265d] added support for it, including the integration with Zephyr’s Power Management system.
    • A code sample has also been added so you can easily try things out.
  • A new experimental driver is available for UART emulation [6180f96799].
  • The BP-BASSENSORSMKII Booster Pack from Texas Instruments is a feature-packed shield with tons of sensors (6-axis inertial sensor, 3-axis magnetometer, optical light sensor, temperature, humidity, …) that can be useful in building automation scenarios.
    Commit [524f01b60c] added support for it 🙂
  • Fabio from Google added an interesting new “longpress” input device that helps deal with making the difference between long-press and short-press events. Press a button for less than a configurable delay? That’s a short press! Otherwise, that’s a long press, and it will emit a different key event [5b36b4fa16]
  • Also related to input drivers, it’s now possible to use the newly added kscan input driver to listen for input events and report them on a kscan API. This allows porting kscan drivers to Zephyr’s input APIs while maintaining compatibility with the existing kscan-based applications. [a9735abf84]
  • Added flash readout and write protection support for STM32F4 [d652da5acb] [b6078cc906].
  • Added documentation for the Battery Charging 1.2 driver [24d5bac58f]
  • Added i2s domain clock support for STM32 devices [87f3e331a6]
  • New emulator for the PI3USB9201 USB charging detector [9b8c4ee847]
  • Added driver for Intel’s ADSP watchdog [ea405eb49e]
  • Several improvements around I3C [1f757bc67f] [2f02d6ca81] [62f22f8d3b].

Bluetooth

  • Expanded AICS (Audio Input Control Service) API support to include audio [33bf1fa0c6]

Miscellaneous

You may be familiar with the Pmod standard interface that allows to easily attach peripherals to development boards. A new GPIO nexus has been added, allowing you to define your Pmod port as a node in your device tree [9d50b143ae]


I hope you find this update useful. Please share your thoughts in the comments and don’t hesitate to share the article widely to help spread the love for Zephyr! 🪁

If you enjoyed this article, don’t forget to subscribe to this blog to be notified of upcoming publications! And of course, you can also always find me on Twitter and Mastodon.

By Benjamin Cabé

Benjamin Cabé is a technology enthusiast with a passion for empowering developers to build innovative solutions. He has invented an award-winning open source and open hardware artificial nose that he likes to use as an educational platform for people interested in diving into the world of embedded development.
He is currently a Developer Advocate for the Zephyr Project at the Linux Foundation and lives near Toulouse, France, where he enjoys baking sourdough bread with the help of his artificial nose.

Leave a Reply

Your email address will not be published. Required fields are marked *