FW: [platformio/platformio-core] ZephyrProject integration (#1613)

Nashif, Anas


Please try and give feedback directly in the github issue.


From: Ivan Kravets <notifications@...>
Reply to: platformio/platformio-core <reply+AABL6MJFWZJEWCBOTKRR2TF33W3VNEVBNHHBGJB67E@...>
Date: Saturday, 16 November 2019 at 18:23
To: platformio/platformio-core <platformio-core@...>
Cc: Anas Nashif <anas.nashif@...>, Mention <mention@...>
Subject: Re: [platformio/platformio-core] ZephyrProject integration (#1613)

Hey all,

We have a piece of good news. We've finally added support for Zephyr RTOS and would be glad to get some feedback. It was the most complicated integration for the last 6 years :) We even did some changes to our PlatformIO Core Build API. So, the only latest development version of PlatformIO Core will be compatible with Zephyr. All our efforts were directed on keeping the same workflow which we have with other frameworks (ARM mbed, ESP-IDF, Arduino, etc.). It means that we are still fully independent from operating system and IDE. No need to install any software, make, cmake, ninja, toolchains, different Python packages, other system-related tools.


We did pure native integration and PlatformIO build system will be used. It's based on top of SCons and is super fast and smart. You can use Python language to control and extend the build process using Advanced Scripting or quick shortcuts with build_*** options for platformio.ini.

The source code is here https://github.com/platformio/zephyr/tree/v2.0-branch/scripts/platformio
It actually parses Zephyr CMake configuration and constructs PlatformIO build environment. This is a good solution because of no need to do any changes to default Zephyr tools, scripts, and source code.

P.S: Thanks, @valeros, for the great professional work on this! 馃憤

Supported IDE and OS

You have a choice between 10+ different IDEs and all popular operating systems (Windows, macOS, Linux 32/64, Linux ARMv6+). Any combination of IDE+OS provides the same reproducibility with ZERO changes.

Supported dev/platforms

Currently, 3 development platforms are Zephyr-enabled:

聽聽聽聽聽聽聽聽 https://github.com/platformio/platform-nordicnrf52

聽聽聽聽聽聽聽聽 https://platformio.org/platforms/ststm32

聽聽聽聽聽聽聽聽 https://github.com/platformio/platform-ststm32

Support for other dev/platforms and boards will be added next week.

How to try it?

1.聽聽聽聽聽聽 You need to have the latest development version of PlatformIO Core. If you use CLI, just run pio upgrade --dev. Or, open PlatformIO IDE for VSCode, click on "terminal icon" on the bottom toolbar and run the same command pio upgrade --dev. It should be 4.1.1-b1 or above.

2.聽聽聽聽聽聽 You will need to use a development version of dev/platform mentioned above.

Project Examples

See projects with zephyr- prefix:

聽聽聽聽聽聽聽聽 https://github.com/platformio/platform-nordicnrf52/tree/develop/examples

聽聽聽聽聽聽聽聽 https://platformio.org/platforms/ststm32/tree/develop/examples

聽聽聽聽聽聽聽聽 https://github.com/platformio/platform-ststm32/tree/develop/examples

You can open/import any project and try it. The only change which you need to do is switching platform to development version:

platform = https://github.com/platformio/platform-nordicnrf52.git
framework = zephyr
board = ...
platform = https://github.com/platformio/platform-ststm32.git
framework = zephyr
board = ...
platform = https://github.com/platformio/platform-sifive.git
framework = zephyr
board = ...


We will provide soon extra information in our documentation on how to configure Zephyr RTOS within the PlatformIO project. In short, you can use any example from Zephyr repository with small changes:

1.聽聽聽聽聽聽 Create zephyr folder in the root of PlatformIO project and move here all related Zephyr's files (CMakeLists.txt, prj.conf, sample.yaml)

2.聽聽聽聽聽聽 Edit relative source paths in CMakeLists.txt, see example here https://github.com/platformio/platform-nordicnrf52/blob/develop/examples/zephyr-ble-beacon/zephyr/CMakeLists.txt#L7

The rest configuration should be done in CMakeLists.txt. It's the same when you use the official Zephyr build tools.


Below are a few demos from different IDEs with PIO Unified Debugger and SiFive HiFive1 Rev B board:

PlatformIO IDE for VSCode

Screen Shot 2019-11-17 at 00 31 44

CLion with PlatformIO plugin

Screen Shot 2019-11-17 at 00 27 34

Old-school Eclipse

Screen Shot 2019-11-17 at 00 43 04

Your feedback is very important to us.

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Join {devel@lists.zephyrproject.org to automatically receive all group messages.