Arduino Core for Zephyr beta released – Let’s give it a try!

Last July, Arduino announced plans to switch from the soon-to-be deprecated Arm Mbed to Zephyr RTOS, and the company has now outed the first beta release of “Arduino Core for Zephyr OS” for a range of boards.

From the user’s perspective, this should not change anything. However, there are massive changes under the hood and Arduino sketches are built and executed differently with the Arduino Core for Zephyr.  Some highlights of the new Zephyr-based Arduino core implementation include:

  • Dynamic sketch loading – Sketches are compiled as ELF files and dynamically loaded by a precompiled Zephyr-based firmware.
  • Zephyr subsystems support threading, inter-process communication, and real-time scheduling.
  • Fast compiling and smaller binaries since a thin layer of user code and libraries are compiled, while the rest of the ZephyrOS is already binary.

You can get started straightaway with the code and instructions on GitHub. You’ll need Arduino 2.x.x for this to work. I myself tried the instructions with Arduino 2.3.2.

The first step is to add “https://downloads.arduino.cc/packages/package_zephyr_index.json” to the “Additional boards manager URLs” field in the Preferences window.

Arduino Zephyr board manager URLs

We can then search for Zephyr in the Boards Manager tab and install “Arduino Zephyr Boards (llext)”.

Arduino Zephyr Boards llext

The description mentions five boards are supported at this stage: Arduino Portenta H7 (STM32H7), Arduino GIGA R1 (STM32H7), Arduino Nano 33 BLE (Nordic Semi nRF52840), Renesas EK-RA8D1 (Renesas RA8D1) evaluation kit, and NXP FRDM-MCXN947 development board for MCX N94/N57 microcontrollers.

When we look for a board we’ll now see both “Arduino Mbed OS” and “Arduino Zephyr” boards. I selected “Arduino Portenta H7 – Arduino Zephyr Board…”.

Arduino Portenta H7 Arduino Zephyr Board

Alternatively, we can just type Zephyr to list all supported boards.

Arduino IDE Zephyr Boards List

The Arduino Portenta H7 (Zephyr) will still show as Arduino Portenta H7 in the top right of the Arduino IDE. Since I don’t have any of the supported boards, I just tried to compile the Blink sketch

Arduino Zephyr Blink

It just worked, and I could not see any difference against compiling the Blink sample with the Mbed OS-based Arduino core, except by default, there’s no output in the console for the Mbed OS build. If I turn on verbose compile. We can see how the binaries are built differently:

  • Mbed OS

  • Zephyr OS


The list of files and sizes are also different:

Mbed OS:


Zephyr OS:


I assume Blink.ino.hex for Zephyr is the application only, and the final binary to be uploaded is the Blink.ino.elf (177KB).  That’s quite smaller than the 432KB used by the Mbed Blink demo. Both are pretty huge sizes for a Blink demo compared to bare metal programming, but that’s the cost of using an RTOS.

As mentioned in the title and the introduction, Arduino core for Zephyr is still in beta, and some demos with libraries are not going to compile properly.

DHT sketch fail Arduino Zephyr

One such example is the 10_TEMP_HUMI.ino sketch that fails to build the following error:


But if I switch to Arduino Portenta H7 – Mbed OS, the same sketch builds without issues. Arduino library maintainers will have some work to do, and that’s probably why the Arduino Code for Zephyr OS was released as beta. Most end users should probably keep on using the Arduino code for Mbed OS for now.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

Radxa Orion O6 Armv9 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
1 Comment
oldest
newest
zoobab
22 days ago

Is there a way to replace ZephyrOS by another OS, let’s say Linux for the bigger boards?

Boardcon EM3562 Rockchip RK3562 SBC with 8 analog camera inputs