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 3/5] zephyr-kernel: Factor out Yocto toolchain specific variables
Date: Tue,  6 Sep 2022 14:17:00 +0100	[thread overview]
Message-ID: <20220906131702.310027-3-peter.hoyes@arm.com> (raw)
In-Reply-To: <20220906131702.310027-1-peter.hoyes@arm.com>

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

Create ZEPHYR_TOOLCHAIN_VARIANT variable with an unchanged default value
of 'yocto'.

To support providing different configuration for different toolchain
variants, require a toolchain-specific inc file.

Create zephyr-toolchain-yocto.inc, and factor out all variables that are
specific to building using the Yocto toolchain.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
---
 .../zephyr-kernel/zephyr-kernel-common.inc       | 15 +++------------
 .../zephyr-kernel/zephyr-toolchain-yocto.inc     | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 12 deletions(-)
 create mode 100644 meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-yocto.inc

diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
index a970abf..5c9d9e5 100644
--- a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
@@ -7,8 +7,8 @@ inherit ${ZEPHYR_INHERIT_CLASSES}
 # filesystem.
 IMAGE_NO_MANIFEST = "1"
 
-ZEPHYR_GCC_VARIANT="yocto"
-ZEPHYR_SYSROOT="${STAGING_DIR_TARGET}"
+ZEPHYR_TOOLCHAIN_VARIANT ?= "yocto"
+require zephyr-toolchain-${ZEPHYR_TOOLCHAIN_VARIANT}.inc
 
 ZEPHYR_MAKE_OUTPUT = "zephyr.elf"
 ZEPHYR_MAKE_BIN_OUTPUT = "zephyr.bin"
@@ -16,13 +16,9 @@ ZEPHYR_MAKE_EFI_OUTPUT = "zephyr.efi"
 
 EXTRA_OECMAKE = "\
     -DZEPHYR_BASE=${ZEPHYR_BASE} \
-    -DZEPHYR_GCC_VARIANT=yocto \
     -DBOARD=${BOARD} \
     -DARCH=${ARCH} \
-    -DCROSS_COMPILE=${CROSS_COMPILE} \
-    -DZEPHYR_SYSROOT=${ZEPHYR_SYSROOT} \
-    -DZEPHYR_TOOLCHAIN_VARIANT=yocto \
-    -DEXTRA_CPPFLAGS=${CPPFLAGS} \
+    -DZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT} \
     -DZEPHYR_MODULES=${ZEPHYR_MODULES} \
     "
 
@@ -34,8 +30,6 @@ export ZEPHYR_BASE="${S}/zephyr"
 
 DEPENDS += "gperf-native"
 
-CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
-
 DEPENDS:append:qemuall = " qemu-native qemu-helper-native"
 
 # The makefiles are explicit about the flags they want, so don't unset
@@ -49,12 +43,9 @@ python () {
     d.delVar('LDFLAGS')
 }
 
-OE_TERMINAL_EXPORTS += "CROSS_COMPILE"
 OE_TERMINAL_EXPORTS += "BOARD"
 OE_TERMINAL_EXPORTS += "ZEPHYR_SRC_DIR"
 OE_TERMINAL_EXPORTS += "ZEPHYR_BASE"
-OE_TERMINAL_EXPORTS += "ZEPHYR_SYSROOT"
-OE_TERMINAL_EXPORTS += "ZEPHYR_GCC_VARIANT"
 
 IMAGE_FSTYPES = "elf bin"
 
diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-yocto.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-yocto.inc
new file mode 100644
index 0000000..b167695
--- /dev/null
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-yocto.inc
@@ -0,0 +1,16 @@
+# Additional definitions to use the Yocto toolchain
+
+ZEPHYR_GCC_VARIANT="yocto"
+ZEPHYR_SYSROOT="${STAGING_DIR_TARGET}"
+CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
+
+EXTRA_OECMAKE:append = " \
+    -DZEPHYR_GCC_VARIANT=${ZEPHYR_GCC_VARIANT} \
+    -DCROSS_COMPILE=${CROSS_COMPILE} \
+    -DZEPHYR_SYSROOT=${ZEPHYR_SYSROOT} \
+    -DEXTRA_CPPFLAGS=${CPPFLAGS} \
+    "
+
+OE_TERMINAL_EXPORTS += "CROSS_COMPILE"
+OE_TERMINAL_EXPORTS += "ZEPHYR_SYSROOT"
+OE_TERMINAL_EXPORTS += "ZEPHYR_GCC_VARIANT"
-- 
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 ` Peter Hoyes [this message]
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 ` [meta-zephyr][PATCH 5/5] zephyr-kernel: Add 'zephyr' toolchain variant Peter Hoyes
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-3-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