PlatformIO Community

How to set PlatformIO to use the latest branch of Zephyr

I am trying to use the latest Zephyr branch (v2.4.0) with my PlatormIO nordicnrf52 Zephyr project.

I have cloned https://github.com/zephyrproject-rtos/zephyr and I was wondering how I can set it to be used? I have tried, unsuccessfully to use information from https://community.platformio.org/t/set-package-repository-and-version-in-platformio-ini/14211/7.

On a related note when is Zephyr v2.4.0 going incorporated into PlatformIO?

Further information is needed on what the exact error was if you want to go that path.

Only the devs can answer that one. I’ve seen that @valeros has done an Arduino-core update for the nordicnrf52 platform. Maybe Zephyr is next?

I have cloned https://github.com/zephyrproject-rtos/zephyr to “/Users/mdcraver/opt/zephyr/”.

Using this I tried the following and gotten the following error.

framework = zephyr
platform_packages =
framework-zephyr @ file:///Users/mdcraver/opt/zephyr/.git

Tool Manager: Installing file:///Users/mdcraver/opt/zephyr/.git
Error: Could not find one of ‘package.json’ manifest files in the package
The terminal process “platformio ‘run’” terminated with exit code: 1.

You can create one based on the previous package.json (~/.platformio/packages/framework-zephyr/package.json). Example:

{
  "name": "framework-zephyr",
  "version": "2.20400.201023",
  "description": "Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures",
  "keywords": [
    "framework",
    "rtos",
    "hal"
  ],
  "homepage": "https://www.zephyrproject.org",
  "license": "Apache-2.0",
  "repository": {
    "type": "git",
    "url": "https://github.com/zephyrproject-rtos/zephyr"
  }
}

also don’t forget to copy over the ~/.platformio/packages/framework-zephyr/scripts/platformio folder again because that’s no in the main Zephyr repo.

Also note that Zephyr is actually multiple packages

framework-zephyr-canopennode

framework-zephyr-cmsis
framework-zephyr-fatfs
framework-zephyr-hal-nordic
framework-zephyr-hal-nxp
framework-zephyr-hal-st
framework-zephyr-hal-stm32
framework-zephyr-libmetal
framework-zephyr-littlefs
framework-zephyr-loramac-node
framework-zephyr-lvgl
framework-zephyr-mbedtls
..
framework-zephyr-mipi-sys-t
framework-zephyr-nffs
framework-zephyr-open-amp
..
framework-zephyr-segger
framework-zephyr-tinycbor
framework-zephyr-tinycrypt
framework-zephyr-trusted-firmware-m

so I think you also need to at least update framework-zephyr-hal-nordic to the 2.4.0, which is at https://github.com/zephyrproject-rtos/hal_nordic.

I did these things to use master branch of Zephyr:

  1. Make sure that Zephyr is already installed automatically via Platformio (path ~/.platformio/packages/framework-zephyr/ should exist)
  2. Clone Zephyr repo (f.e. to ~/Downloads/zephyr-repo/) and checkout to desired commit
  3. Add this line to platformio.ini:
    platform_packages = framework-zephyr @ file:///Users/myUser/Downloads/zephyr-repo/
  4. Copy package.json file and ./scripts/platformio folder from ~/.platformio/packages/framework-zephyr/ to your ~/Downloads/zephyr-repo/
  5. Remove ~/.platformio/packages/framework-zephyr/ folder
  6. Run clean and build, it should “install” your desired revision of Zephyr from ~/Downloads/zephyr-repo/ to ~/.platformio/packages/framework-zephyr/