Cleanup README.txt files
PATCH 1/5 Cleanup README.txt files
From: Peter Hoyes <[email protected]>
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.
--- 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
meta-zephyr-bsp/README.txt new file +1 -0
@@ -0,0 +1 @@ +See ../README.txt
meta-zephyr-core/README.txt +1 -119
120 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 2/5 CI: Use the matrix to ovleray additional Kas files
From: Peter Hoyes <[email protected]>
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.
--- .gitlab-ci.yml | 15 ++++++++++++--- ci/jobs-to-kas | 31 +++++++++++++++++++------------ 2 files changed, 31 insertions(+), 15 deletions(-)
.gitlab-ci.yml +12 -3
@@ -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
ci/jobs-to-kas +19 -12
@@ -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
Signature · 1 line
2.25.1
PATCH 3/5 zephyr-kernel: Factor out Yocto toolchain specific variables
In reply to Peter HoyesFrom: Peter Hoyes <[email protected]>
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.
--- .../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
meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +3 -12
@@ -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"
meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-yocto.inc new file +16 -0
@@ -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"
Signature · 1 line
2.25.1
PATCH 4/5 zephyr-sdk: Add recipe to download and build the Zephyr SDK
In reply to Peter HoyesFrom: Peter Hoyes <[email protected]>
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.
--- .../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
meta-zephyr-core/recipes-devtools/zephyr-sdk/zephyr-sdk_0.14.2.bb new file +35 -0
@@ -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"
Signature · 1 line
2.25.1
PATCH 5/5 zephyr-kernel: Add 'zephyr' toolchain variant
In reply to Peter HoyesFrom: Peter Hoyes <[email protected]>
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
--- .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
.gitlab-ci.yml +7 -2
@@ -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
README.txt +7 -3
@@ -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
ci/zephyr-toolchain.yml new file +11 -0
@@ -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"
meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-zephyr.inc new file +15 -0
@@ -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}"
Signature · 1 line
2.25.1
I ran this series though CI and it passes
See https://gitlab.com/jonmason00/meta-zephyr/-/pipelines/633557829
Thanks,
Jon
Quoted 151 lines · Peter Hoyes
From: Peter Hoyes <[email protected]>
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 <[email protected]>--- 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.txtmeta-zephyr-bsp/README.txt new file +1
-0@@ -0,0 +1 @@ +See ../README.txtmeta-zephyr-core/README.txt +1
-119@@ -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='<ID1> <ID2> <ID3>' BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE PYOCD_FLASH_IDS" bitbake <TARGET> -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 [email protected] -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 [email protected] -$ git config --local format.subjectPrefix meta-zephyr][PATCH +See ../README.txtSignature · 1 line
2.25.1