From patchwork Tue Sep 6 13:16:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hoyes X-Patchwork-Id: 12363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78504C6FA83 for ; Tue, 6 Sep 2022 13:16:25 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.3895.1662470174968323997 for ; Tue, 06 Sep 2022 06:16:15 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: peter.hoyes@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B48E139F; Tue, 6 Sep 2022 06:16:20 -0700 (PDT) Received: from e125920.arm.com (unknown [10.57.88.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4EDA33F7B4; Tue, 6 Sep 2022 06:16:13 -0700 (PDT) From: Peter Hoyes To: yocto@lists.yoctoproject.org Cc: diego.sueiro@arm.com, Peter Hoyes Subject: [meta-zephyr][PATCH 1/5] Cleanup README.txt files Date: Tue, 6 Sep 2022 14:16:58 +0100 Message-Id: <20220906131702.310027-1-peter.hoyes@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 06 Sep 2022 13:16:25 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/57987 From: Peter Hoyes The README.txt files at the root and in meta-zephyr-core are identical, so replace the copy inside meta-zephyr-core with "See ../README.txt" to remove the need to keep two files in sync. Add a similar README.txt to meta-zephyr-bsp. Signed-off-by: Peter Hoyes --- meta-zephyr-bsp/README.txt | 1 + meta-zephyr-core/README.txt | 120 +----------------------------------- 2 files changed, 2 insertions(+), 119 deletions(-) create mode 100644 meta-zephyr-bsp/README.txt diff --git a/meta-zephyr-bsp/README.txt b/meta-zephyr-bsp/README.txt new file mode 100644 index 0000000..2644ed0 --- /dev/null +++ b/meta-zephyr-bsp/README.txt @@ -0,0 +1 @@ +See ../README.txt diff --git a/meta-zephyr-core/README.txt b/meta-zephyr-core/README.txt index 5a0ccc7..2644ed0 100644 --- a/meta-zephyr-core/README.txt +++ b/meta-zephyr-core/README.txt @@ -1,119 +1 @@ -Building Zephyr Images via bitbake recipes -========================================== - -More detailed and up-to-date information can be found here: - -https://wiki.yoctoproject.org/wiki/TipsAndTricks/BuildingZephyrImages - -Prerequisites: -============== - -This layer depends on: - Yocto distro (master) - git://git.yoctoproject.org/poky - 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" to BBLAYERS - -Building and Running Zephyr Samples -=================================== - -You can build Zephyr samples. There are several sample recipes. -For example, to build the Zephyr "philosophers" sample: - - $ MACHINE=qemu-x86 bitbake zephyr-philosophers - -You can then run the created "philosophers" image in qemu: - - $ runqemu qemu-x86 - -The same sample, for ARM image: - - $ MACHINE=qemu-cortex-m3 bitbake zephyr-philosophers - $ runqemu qemu-cortex-m3 - -The same sample, for Nios2 image: - - $ MACHINE=qemu-nios2 bitbake zephyr-philosophers - $ runqemu qemu-nios2 - -Flashing -================================= - -You can flash Zephyr samples to boards. Currently, the following MACHINEs -are supported: - * DFU: - - arduino-101-sss - - arduino-101 - - arduino-101-ble - * pyocd: - - 96b-nitrogen - -To flash the example you built with command e.g. - - $ MACHINE=96b-nitrogen bitbake zephyr-philosophers - -call similar command with explicit flash_usb command: - - $ MACHINE=96b-nitrogen bitbake zephyr-philosophers -c flash_usb - -dfu-util and/or pyocd need to be installed in your system. If you observe -permission errors or the flashing process seem to hang, follow those instructions: -https://github.com/pyocd/pyOCD/tree/master/udev - -By default, pyocd tries to flash all the attached probes. This behaviour can be -customised by defining the PYOCD_FLASH_IDS variable as a space-separated list -of IDs. Once that is set, the tool will only try to program these IDs. You can -query for the IDs by running `pyocd list` on your host while having the probes -attached. Besides setting this variable through the build's configuration or -metadata, you can also inject its value from command line with something like: - - $ PYOCD_FLASH_IDS=' ' BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE PYOCD_FLASH_IDS" bitbake -c flash_usb - -Building and Running Zephyr Tests -================================= -Presently only toolchains for ARM, x86, IAMCU and Nios2 are supported. -(For ARM we use CortexM3 toolchain) - -To run Zephyr Test using Yocto Image Tests, ensure following in local.conf: - - INHERIT += "testimage" - -You can build and test an individual existing Zephyr test. -This is done by appending the actual test name to the "zephyr-kernel-test", -for example: - - $ MACHINE=qemu-x86 bitbake zephyr-kernel-test-sleep - $ MACHINE=qemu-x86 bitbake zephyr-kernel-test-sleep -c testimage - -You can also build and run all Zephyr existing tests (as listed in the file -zephyr-kernel-test.inc). For example: - - $ MACHINE=qemu-x86 bitbake zephyr-kernel-test-all - $ MACHINE=qemu-x86 bitbake zephyr-kernel-test-all -c testimage -or - $ MACHINE=qemu-cortex-m3 bitbake zephyr-kernel-test-all - $ MACHINE=qemu-cortex-m3 bitbake zephyr-kernel-test-all -c testimage -or - $ MACHINE=qemu-nios2 bitbake zephyr-kernel-test-all - $ MACHINE=qemu-nios2 bitbake zephyr-kernel-test-all -c testimage - - -Contributing -============ - -Patches for meta-zephyr should be sent to the yocto@lists.yoctoproject.org -mailing list. See https://lists.yoctoproject.org/g/yocto for subscription -details and the list archive. Please add [meta-zephyr] to the subject so -the patches are identifable. - -Git can be configured to send mails appropriately when using git send-email: - -$ git config --local sendemail.to yocto@lists.yoctoproject.org -$ git config --local format.subjectPrefix meta-zephyr][PATCH +See ../README.txt From patchwork Tue Sep 6 13:16:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hoyes X-Patchwork-Id: 12364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76AE9ECAAA1 for ; Tue, 6 Sep 2022 13:16:25 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.3842.1662470181141141583 for ; Tue, 06 Sep 2022 06:16:21 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: peter.hoyes@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 14A6A139F; Tue, 6 Sep 2022 06:16:27 -0700 (PDT) Received: from e125920.arm.com (unknown [10.57.88.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D37103F7B4; Tue, 6 Sep 2022 06:16:19 -0700 (PDT) From: Peter Hoyes To: yocto@lists.yoctoproject.org Cc: diego.sueiro@arm.com, Peter Hoyes Subject: [meta-zephyr][PATCH 2/5] CI: Use the matrix to ovleray additional Kas files Date: Tue, 6 Sep 2022 14:16:59 +0100 Message-Id: <20220906131702.310027-2-peter.hoyes@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906131702.310027-1-peter.hoyes@arm.com> References: <20220906131702.310027-1-peter.hoyes@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 06 Sep 2022 13:16:25 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/57988 From: Peter Hoyes Adopt the jobs-to-kas helper script from meta-arm, which uses Gitlab's parellel matrix to overlay additional Kas files on top of the base Kas file (based on $CI_JOB_NAME). This allows multiple combinations of Kas file overlays to be easily tested with minimal boilerplate. Signed-off-by: Peter Hoyes --- .gitlab-ci.yml | 15 ++++++++++++--- ci/jobs-to-kas | 31 +++++++++++++++++++------------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index addd04c..22a8ef9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,11 +80,17 @@ nrf52840dk-nrf52840: qemu-cortex-a53: extends: .build -qemu-cortex-m0/testimage: +qemu-cortex-m0: extends: .build + parallel: + matrix: + - TESTING: testimage -qemu-cortex-m3/testimage: +qemu-cortex-m3: extends: .build + parallel: + matrix: + - TESTING: testimage qemu-cortex-r5: extends: .build @@ -92,8 +98,11 @@ qemu-cortex-r5: qemu-nios2: extends: .build -qemu-x86/testimage: +qemu-x86: extends: .build + parallel: + matrix: + - TESTING: testimage stm32mp157c-dk2: extends: .build diff --git a/ci/jobs-to-kas b/ci/jobs-to-kas index 7057970..296bb0d 100755 --- a/ci/jobs-to-kas +++ b/ci/jobs-to-kas @@ -1,19 +1,26 @@ #! /bin/bash -# Read a GitLab CI job name on $1 and transform it to a -# list of Kas yaml files +# This script is expecting an input of machine name, optionally followed by a +# colon and a list of one or more parameters separated by commas between +# brackets. For example, the following are acceptable: +# qemu-x86 +# qemu-cortex-m3: [testimage] +# qemu-cortex-a53: [zephyr-toolchain, testimage] +# +# Turn this list into a series of yml files separated by colons to pass to kas set -e -u -# Read Job namne from $1 and split on / -IFS=/ read -r -a PARTS<<<$1 +FILES="ci/$(echo $1 | cut -d ':' -f 1).yml" -# Prefix each part with ci/ -PARTS=("${PARTS[@]/#/ci/}") +for i in $(echo $1 | cut -s -d ':' -f 2 | sed 's/[][,]//g'); do + # Given that there is no yml file for default, we can simply ignore those + # parameters. They are necessary to pass in so that matrix can correctly + # setup all of the permutations of each individual run. + if [[ $i == 'default' ]]; then + continue + fi + FILES+=":ci/$i.yml" +done -# Suffix each part with .yml -PARTS=("${PARTS[@]/%/.yml}") - -# Print colon-separated -IFS=":" -echo "${PARTS[*]}" +echo $FILES From patchwork Tue Sep 6 13:17:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hoyes X-Patchwork-Id: 12367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63FA9ECAAD5 for ; Tue, 6 Sep 2022 13:16:35 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.3996.1662470188309462777 for ; Tue, 06 Sep 2022 06:16:28 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: peter.hoyes@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3873C139F; Tue, 6 Sep 2022 06:16:34 -0700 (PDT) Received: from e125920.arm.com (unknown [10.57.88.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E8A833F7B4; Tue, 6 Sep 2022 06:16:26 -0700 (PDT) From: Peter Hoyes To: yocto@lists.yoctoproject.org Cc: diego.sueiro@arm.com, Peter Hoyes Subject: [meta-zephyr][PATCH 3/5] zephyr-kernel: Factor out Yocto toolchain specific variables Date: Tue, 6 Sep 2022 14:17:00 +0100 Message-Id: <20220906131702.310027-3-peter.hoyes@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906131702.310027-1-peter.hoyes@arm.com> References: <20220906131702.310027-1-peter.hoyes@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 06 Sep 2022 13:16:35 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/57989 From: Peter Hoyes 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 --- .../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" From patchwork Tue Sep 6 13:17:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hoyes X-Patchwork-Id: 12365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63FF5C6FA83 for ; Tue, 6 Sep 2022 13:16:35 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.3774.1662470190700347229 for ; Tue, 06 Sep 2022 06:16:30 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: peter.hoyes@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A2410139F; Tue, 6 Sep 2022 06:16:36 -0700 (PDT) Received: from e125920.arm.com (unknown [10.57.88.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A51B93F7B4; Tue, 6 Sep 2022 06:16:29 -0700 (PDT) From: Peter Hoyes To: yocto@lists.yoctoproject.org Cc: diego.sueiro@arm.com, Peter Hoyes Subject: [meta-zephyr][PATCH 4/5] zephyr-sdk: Add recipe to download and build the Zephyr SDK Date: Tue, 6 Sep 2022 14:17:01 +0100 Message-Id: <20220906131702.310027-4-peter.hoyes@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906131702.310027-1-peter.hoyes@arm.com> References: <20220906131702.310027-1-peter.hoyes@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 06 Sep 2022 13:16:35 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/57990 From: Peter Hoyes The Zephyr SDK (https://github.com/zephyrproject-rtos/sdk-ng) provides pre-built toolchains for all of Zephyr's supported architectures. Add a recipe to download SDK v0.14.2, in preparation for adding an option to build Zephyr applications using this toolchain instead of the Yocto-built one. Signed-off-by: Peter Hoyes --- .../zephyr-sdk/zephyr-sdk_0.14.2.bb | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 meta-zephyr-core/recipes-devtools/zephyr-sdk/zephyr-sdk_0.14.2.bb diff --git a/meta-zephyr-core/recipes-devtools/zephyr-sdk/zephyr-sdk_0.14.2.bb b/meta-zephyr-core/recipes-devtools/zephyr-sdk/zephyr-sdk_0.14.2.bb new file mode 100644 index 0000000..c893652 --- /dev/null +++ b/meta-zephyr-core/recipes-devtools/zephyr-sdk/zephyr-sdk_0.14.2.bb @@ -0,0 +1,35 @@ +SUMMARY = "Zephyr SDK Bundle" +DESCRIPTION = "Official SDK built using crosstool-ng, distributed by the \ +Zephyr project" +COMPATIBLE_HOST = "(x86_64|aarch64).*-linux" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +INHIBIT_DEFAULT_DEPS = "1" +# CMake is required by the setup script +DEPENDS += "cmake" + +SDK_ARCHIVE = "zephyr-sdk-${PV}_linux-${BUILD_ARCH}.tar.gz" +SDK_NAME = "${BUILD_ARCH}" +SRC_URI = "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${PV}/${SDK_ARCHIVE};subdir=${S};name=${SDK_NAME}" + +SRC_URI[x86_64.sha256sum] = "2ff0e4d79bffe1468247a3e1958aa9183a0252225ab721cf1c37188bd4b649a2" +SRC_URI[aarch64.sha256sum] = "cbb616a50e940388ea737788d48dcea3624a85bb3ee04d9aae105496a21ae75e" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +ZEPHYR_SDK_DIR = "${prefix}/zephyr-sdk" + +do_install() { + install -d ${D}${prefix} + cp -r ${S}/zephyr-sdk-${PV} ${D}${ZEPHYR_SDK_DIR} + + # Install host tools + ${D}${ZEPHYR_SDK_DIR}/setup.sh -h +} + +SYSROOT_DIRS += "${ZEPHYR_SDK_DIR}" +INHIBIT_SYSROOT_STRIP = "1" +BBCLASSEXTEND = "native" From patchwork Tue Sep 6 13:17:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hoyes X-Patchwork-Id: 12366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65716ECAAA1 for ; Tue, 6 Sep 2022 13:16:35 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.3845.1662470192734991462 for ; Tue, 06 Sep 2022 06:16:32 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: peter.hoyes@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A4C75139F; Tue, 6 Sep 2022 06:16:38 -0700 (PDT) Received: from e125920.arm.com (unknown [10.57.88.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A2B4C3F7B4; Tue, 6 Sep 2022 06:16:31 -0700 (PDT) From: Peter Hoyes To: yocto@lists.yoctoproject.org Cc: diego.sueiro@arm.com, Peter Hoyes Subject: [meta-zephyr][PATCH 5/5] zephyr-kernel: Add 'zephyr' toolchain variant Date: Tue, 6 Sep 2022 14:17:02 +0100 Message-Id: <20220906131702.310027-5-peter.hoyes@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906131702.310027-1-peter.hoyes@arm.com> References: <20220906131702.310027-1-peter.hoyes@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 06 Sep 2022 13:16:35 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/57991 From: Peter Hoyes 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 --- .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}"