Yocto Project Discussions
 help / color / mirror / Atom feed
From: Peter Hoyes <peter.hoyes@arm.com>
To: yocto@lists.yoctoproject.org
Cc: diego.sueiro@arm.com, Peter Hoyes <Peter.Hoyes@arm.com>
Subject: [meta-zephyr][PATCH 5/5] zephyr-kernel: Add 'zephyr' toolchain variant
Date: Tue,  6 Sep 2022 14:17:02 +0100	[thread overview]
Message-ID: <20220906131702.310027-5-peter.hoyes@arm.com> (raw)
In-Reply-To: <20220906131702.310027-1-peter.hoyes@arm.com>

From: Peter Hoyes <Peter.Hoyes@arm.com>

Add an option to build applications using the Zephyr SDK by specifying
ZEPHYR_TOOLCHAIN_VARIANT="zephyr". This mode works with the zephyr or
poky distros (TCMODE is ignored), allowing Zephyr applications to be
built alongside a Linux stack.

Provide a toolchain-specific inc file for the Zephyr SDK, which
configures the dependencies and CMake appropriately.

Add Zephyr toolchain variant to CI configuration for qemu-cortex-a53,
qemu-cortex-m3 and qemu-x86. Update README.txt

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
---
 .gitlab-ci.yml                                    |  9 +++++++--
 README.txt                                        | 10 +++++++---
 ci/zephyr-toolchain.yml                           | 11 +++++++++++
 .../zephyr-kernel/zephyr-toolchain-zephyr.inc     | 15 +++++++++++++++
 4 files changed, 40 insertions(+), 5 deletions(-)
 create mode 100644 ci/zephyr-toolchain.yml
 create mode 100644 meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-zephyr.inc

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 22a8ef9..145aefd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -79,6 +79,9 @@ nrf52840dk-nrf52840:
 
 qemu-cortex-a53:
   extends: .build
+  parallel:
+    matrix:
+      - TOOLCHAIN: [default, zephyr-toolchain]
 
 qemu-cortex-m0:
   extends: .build
@@ -90,7 +93,8 @@ qemu-cortex-m3:
   extends: .build
   parallel:
     matrix:
-      - TESTING: testimage
+      - TOOLCHAIN: [default, zephyr-toolchain]
+        TESTING: testimage
 
 qemu-cortex-r5:
   extends: .build
@@ -102,7 +106,8 @@ qemu-x86:
   extends: .build
   parallel:
     matrix:
-      - TESTING: testimage
+      - TOOLCHAIN: [default, zephyr-toolchain]
+        TESTING: testimage
 
 stm32mp157c-dk2:
   extends: .build
diff --git a/README.txt b/README.txt
index ec860fd..4776a8a 100644
--- a/README.txt
+++ b/README.txt
@@ -14,9 +14,6 @@ This layer depends on:
     Python layer (meta-openembedded/meta-python)
         git://git.openembedded.org/meta-openembedded
 
-Modify local conf by adding:
-    DISTRO="zephyr"
-
 Add "meta-openembedded/meta-oe" to BBLAYERS
 Add "meta-openembedded/meta-python" to BBLAYERS
 Add "meta-zephyr-core" and "meta-zephyr-bsp" to BBLAYERS
@@ -25,6 +22,13 @@ Building and Running Zephyr Samples
 ===================================
 
 You can build Zephyr samples. There are several sample recipes.
+
+To use the Yocto toolchain, modify local conf by adding:
+    DISTRO="zephyr"
+
+To use the Zephyr pre-built toolchain, modify local conf by adding:
+    ZEPHYR_TOOLCHAIN_VARIANT = "zephyr"
+
 For example, to build the Zephyr "philosophers" sample:
     
     $ MACHINE=qemu-x86 bitbake zephyr-philosophers
diff --git a/ci/zephyr-toolchain.yml b/ci/zephyr-toolchain.yml
new file mode 100644
index 0000000..ab8baa3
--- /dev/null
+++ b/ci/zephyr-toolchain.yml
@@ -0,0 +1,11 @@
+header:
+  version: 11
+
+# The Zephyr toolchain is standalone and does not depend on TCMODE or TCLIB, so
+# validate that it is possible to build Zephyr applications alongside a
+# poky-based Linux distro
+distro: poky
+
+local_conf_header:
+  zephyr-toolchain: |
+    ZEPHYR_TOOLCHAIN_VARIANT = "zephyr"
diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-zephyr.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-zephyr.inc
new file mode 100644
index 0000000..9987e3c
--- /dev/null
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-zephyr.inc
@@ -0,0 +1,15 @@
+# Additional definitions to use the Zephyr SDK
+
+# Configure usage of the Zephyr SDK
+INHIBIT_DEFAULT_DEPS = "1"
+DEPENDS += "zephyr-sdk-native"
+export ZEPHYR_SDK_INSTALL_DIR="${STAGING_DIR_NATIVE}${prefix}/zephyr-sdk"
+OE_TERMINAL_EXPORTS += "ZEPHYR_SDK_INSTALL_DIR"
+
+# The Zephyr SDK does not require a CMake toolchain file
+EXTRA_OECMAKE:append = " -DCMAKE_TOOLCHAIN_FILE="
+deltask generate_toolchain_file
+
+# Provide a suitable location to store the toolchain capabilites cache
+ZEPHYR_USER_CACHE_DIR = "${B}/.cache"
+EXTRA_OECMAKE:append = " -DUSER_CACHE_DIR=${ZEPHYR_USER_CACHE_DIR}"
-- 
2.25.1



  parent reply	other threads:[~2022-09-06 13:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 13:16 [meta-zephyr][PATCH 1/5] Cleanup README.txt files Peter Hoyes
2022-09-06 13:16 ` [meta-zephyr][PATCH 2/5] CI: Use the matrix to ovleray additional Kas files Peter Hoyes
2022-09-06 13:17 ` [meta-zephyr][PATCH 3/5] zephyr-kernel: Factor out Yocto toolchain specific variables Peter Hoyes
2022-09-06 13:17 ` [meta-zephyr][PATCH 4/5] zephyr-sdk: Add recipe to download and build the Zephyr SDK Peter Hoyes
2022-09-06 13:17 ` Peter Hoyes [this message]
2022-09-07 20:08 ` [meta-zephyr][PATCH 1/5] Cleanup README.txt files Jon Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220906131702.310027-5-peter.hoyes@arm.com \
    --to=peter.hoyes@arm.com \
    --cc=diego.sueiro@arm.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox