zephyr-kernel: Add 'zephyr' toolchain variant

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>
Tested-by: Jon Mason <jon.mason@arm.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
This commit is contained in:
Peter Hoyes
2022-09-06 14:17:02 +01:00
committed by Naveen Saini
parent ba209c8392
commit c53f775d85
4 changed files with 40 additions and 5 deletions

View File

@@ -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

View File

@@ -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

11
ci/zephyr-toolchain.yml Normal file
View File

@@ -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"

View File

@@ -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}"