Skip to contentSkip to conversation

zephyr-flash-dfu.bbclass: Add missing do_flash_usb dependency on do_deploy

PATCH Superseded Andrei Gherzan 2 participants 15 messages Feb 15, 2021 – Feb 16, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/14 zephyr-flash-dfu.bbclass: Add missing do_flash_usb dependency on do_deploy

From: Andrei Gherzan <[email protected]>

---
 classes/zephyr-flash-dfu.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
classes/zephyr-flash-dfu.bbclass +1 -1
index 32f589a..b4f3d49 100644
@@ -59,7 +59,7 @@ python do_flash_usb() {
     bb.utils.unlockfile(lock)
 }
 
-addtask do_flash_usb
+addtask do_flash_usb after do_deploy
 
 do_flash_usb[nostamp] = "1"
 do_flash_usb[vardepsexclude] = "BB_ORIGENV"
Signature · 1 line
2.30.1
#1 lore raw

PATCH 2/14 zephyr-flash-pyocd.bbclass: Add missing do_flash_usb dependency on do_deploy

From: Andrei Gherzan <[email protected]>

---
 classes/zephyr-flash-pyocd.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
classes/zephyr-flash-pyocd.bbclass +1 -1
index 04500af..eca30c9 100644
@@ -10,7 +10,7 @@ python do_flash_usb() {
         session.board.target.reset()
 }
 
-addtask do_flash_usb
+addtask do_flash_usb after do_deploy
 
 do_flash_usb[nostamp] = "1"
 do_flash_usb[vardepsexclude] = "BB_ORIGENV"
Signature · 1 line
2.30.1
#2 lore raw

PATCH 3/14 Cleanup superflous new lines

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

---
 classes/zephyrtest.bbclass          | 2 --
 conf/distro/zephyr.conf             | 1 -
 conf/machine/include/tune-arc.inc   | 1 -
 conf/machine/include/tune-iamcu.inc | 1 -
 conf/machine/include/tune-nios2.inc | 1 -
 5 files changed, 6 deletions(-)
classes/zephyrtest.bbclass +0 -2
index 3acc4c3..248fd15 100644
@@ -51,5 +51,3 @@ python testdata_clean() {
 }
 
 addtask do_testdata_write before do_build after do_deploy
-
-
conf/distro/zephyr.conf +0 -1
index a98da32..6ecd421 100644
@@ -1,4 +1,3 @@
-
 DISTRO = "zephyr"
 DISTRO_NAME = "Zephyr"
 DISTRO_VERSION = "1.0"
conf/machine/include/tune-arc.inc +0 -1
index 4bb6f4f..ff841e7 100644
@@ -18,4 +18,3 @@ AVAILTUNES += "no-sdata"
 TUNEVALID[nodata] = "ARC no-delete-null-pointer-checks"
 TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'no-delete-null-pointer-checks', ' -fno-delete-null-pointer-checks', '', d)}"
 AVAILTUNES += "no-delete-null-pointer-checks"
-
conf/machine/include/tune-iamcu.inc +0 -1
index 6935375..20a93a6 100644
@@ -9,4 +9,3 @@ TUNE_ARCH = "i586"
 TUNEVALID[iamcu] = "Intel MCU"
 
 PACKAGE_EXTRA_ARCHS_tune-iamcu = "iamcu"
-
conf/machine/include/tune-nios2.inc +0 -1
index c74326d..e8662eb 100644
@@ -1,4 +1,3 @@
-
 # Nios2 Architecture Definition
 
 DEFAULTTUNE ?= "nios2"
Signature · 1 line
2.30.1
#3 lore raw

PATCH 4/14 zephyr-kernel-src: Restructure recipe

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

* Restructure recipe to use include files as opposed to a bbclass. The latter is unnatural when defining versions, sources etc.
* Make the zephyr-kernel-src follow the version as defined by PREFERRED_VERSION_zephyr-kernel.
* Make the setup of the zephyr-kernel-src.inc extensible for multiple versions.

---
 classes/zephyr-kernel-src.bbclass             | 37 -------------------
 .../zephyr-kernel/zephyr-kernel-src-2.4.0.inc | 10 +++++
 ...kernel-src_2.4.bb => zephyr-kernel-src.bb} |  9 +----
 .../zephyr-kernel/zephyr-kernel-src.inc       | 20 ++++++++++
 4 files changed, 32 insertions(+), 44 deletions(-)
 delete mode 100644 classes/zephyr-kernel-src.bbclass
 create mode 100644 recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.4.0.inc
 rename recipes-kernel/zephyr-kernel/{zephyr-kernel-src_2.4.bb => zephyr-kernel-src.bb} (80%)
 create mode 100644 recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc
classes/zephyr-kernel-src.bbclass deleted +0 -37
deleted file mode 100644
index c6c8d61..0000000
@@ -1,37 +0,0 @@
-#Set relevant variables based on Zephyr kernel version
-
-PREFERRED_VERSION_zephyr-kernel ??= "2.4.0"
-
-SRCREV_FORMAT = "default_cmsis"
-SRCREV_default = "7a3b253ced7333f5c0269387a7f3ed1dee69739d"
-SRCREV_cmsis = "542b2296e6d515b265e25c6b7208e8fea3014f90"
-SRCREV_nordic = "d8a6ea9695ddf792bb18bb6035c13b1daac5d79c"
-SRCREV_stm32 = "f0e11398128ac9abdff713da5d3035e6c96e9b86"
-SRCREV_open-amp = "de1b85a13032a2de1d8b6695ae5f800b613e739d"
-SRCREV_libmetal = "9d4ee2c3cfd5f49861939447990f3b7d7bf9bf94"
-SRCREV_tinycrypt = "3e9a49d2672ec01435ffbf0d788db6d95ef28de0"
-
-SRC_URI = "git://github.com/zephyrproject-rtos/zephyr.git;protocol=https;branch=v2.4-branch;name=default \
-           git://github.com/zephyrproject-rtos/cmsis.git;protocol=https;destsuffix=git/modules/cmsis;name=cmsis \
-           git://github.com/zephyrproject-rtos/hal_nordic.git;protocol=https;destsuffix=git/modules/hal/nordic;name=nordic \
-           git://github.com/zephyrproject-rtos/hal_stm32.git;protocol=https;destsuffix=git/modules/hal/stm32;name=stm32 \
-           git://github.com/zephyrproject-rtos/open-amp.git;protocol=https;destsuffix=git/modules/lib/open-amp;name=open-amp \
-           git://github.com/zephyrproject-rtos/libmetal.git;protocol=https;destsuffix=git/modules/hal/libmetal;name=libmetal \
-           git://github.com/zephyrproject-rtos/tinycrypt.git;protocol=https;destsuffix=git/modules/crypto/tinycrypt;name=tinycrypt \
-           file://0001-cmake-add-yocto-toolchain.patch \
-          "
-
-PV = "2.4.0+git${SRCPV}"
-
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
-
-ZEPHYR_TEST_SRCDIR = "tests/legacy/kernel/"
-
-python () {
-    src_pn = d.getVar('PREFERRED_VERSION_zephyr-kernel', True)
-    if src_pn == '2.4.0':
-        return
-    else:
-        bb.error("Unsupported Zephyr kernel version requested")
-}
recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.4.0.inc new file +10 -0
new file mode 100644
index 0000000..d1ef80e
@@ -0,0 +1,10 @@
+SRCREV_FORMAT = "default_cmsis"
+SRCREV_default = "7a3b253ced7333f5c0269387a7f3ed1dee69739d"
+SRCREV_cmsis = "542b2296e6d515b265e25c6b7208e8fea3014f90"
+SRCREV_nordic = "d8a6ea9695ddf792bb18bb6035c13b1daac5d79c"
+SRCREV_stm32 = "f0e11398128ac9abdff713da5d3035e6c96e9b86"
+SRCREV_open-amp = "de1b85a13032a2de1d8b6695ae5f800b613e739d"
+SRCREV_libmetal = "9d4ee2c3cfd5f49861939447990f3b7d7bf9bf94"
+SRCREV_tinycrypt = "3e9a49d2672ec01435ffbf0d788db6d95ef28de0"
+
+PV = "2.4.0+git${SRCPV}"
recipes-kernel/zephyr-kernel/zephyr-kernel-src.bb renamed from recipes-kernel/zephyr-kernel/zephyr-kernel-src_2.4.bb +2 -7
similarity index 80%
rename from recipes-kernel/zephyr-kernel/zephyr-kernel-src_2.4.bb
rename to recipes-kernel/zephyr-kernel/zephyr-kernel-src.bb
index 8e8b5b8..210cfa7 100644
@@ -1,16 +1,12 @@
+include zephyr-kernel-src.inc
 
-inherit zephyr-kernel-src
-inherit cmake
-
-S = "${WORKDIR}/git"
+ZEPHYR_TEST_SRCDIR = "tests/legacy/kernel/"
 
 IMAGE_NO_MANIFEST = "1"
 INHIBIT_DEFAULT_DEPS = "1"
 
 do_configure[noexec] = "1"
 do_compile[noexec] = "1"
-
-
 do_install () {
     kerneldir=${D}/usr/src/zephyr
     install -d $kerneldir
@@ -21,4 +17,3 @@ PACKAGES = "${PN}"
 FILES_${PN} = "/usr/src/zephyr"
 
 SYSROOT_DIRS += "/usr/src/zephyr"
-
recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc new file +20 -0
new file mode 100644
index 0000000..2dcde74
@@ -0,0 +1,20 @@
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
+
+# Default to a stable version
+PREFERRED_VERSION_zephyr-kernel ??= "2.4.0"
+include zephyr-kernel-src-${PREFERRED_VERSION_zephyr-kernel}.inc
+
+inherit cmake
+
+SRC_URI = "\
+    git://github.com/zephyrproject-rtos/zephyr.git;protocol=https;branch=master;name=default \
+    git://github.com/zephyrproject-rtos/cmsis.git;protocol=https;destsuffix=git/modules/cmsis;name=cmsis \
+    git://github.com/zephyrproject-rtos/hal_nordic.git;protocol=https;destsuffix=git/modules/hal/nordic;name=nordic \
+    git://github.com/zephyrproject-rtos/hal_stm32.git;protocol=https;destsuffix=git/modules/hal/stm32;name=stm32 \
+    git://github.com/zephyrproject-rtos/open-amp.git;protocol=https;destsuffix=git/modules/lib/open-amp;name=open-amp \
+    git://github.com/zephyrproject-rtos/libmetal.git;protocol=https;destsuffix=git/modules/hal/libmetal;name=libmetal \
+    git://github.com/zephyrproject-rtos/tinycrypt.git;protocol=https;destsuffix=git/modules/crypto/tinycrypt;name=tinycrypt \
+    file://0001-cmake-add-yocto-toolchain.patch \
+    "
+S = "${WORKDIR}/git"
Signature · 1 line
2.30.1
#4 lore raw

PATCH 5/14 zephyr-kernel-src-2.5.0-rc3.inc: Add support for zephyr kernel version 2.5.0-rc3

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

This version can be selected defining
PREFERRED_VERSION_zephyr-kernel ??= "2.5.0-rc3"

---
 .../zephyr-kernel/zephyr-kernel-src-2.5.0-rc3.inc      | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0-rc3.inc
recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0-rc3.inc new file +10 -0
new file mode 100644
index 0000000..4ee9883
@@ -0,0 +1,10 @@
+SRCREV_FORMAT = "default_cmsis"
+SRCREV_default = "v2.5.0-rc3"
+SRCREV_cmsis = "c3bd2094f92d574377f7af2aec147ae181aa5f8e"
+SRCREV_nordic = "f3434da6446380fcdd426dbe2866af21d0d549b6"
+SRCREV_stm32 = "cc8731dba4fd9c57d7fe8ea6149828b89c2bd635"
+SRCREV_open-amp = "de1b85a13032a2de1d8b6695ae5f800b613e739d"
+SRCREV_libmetal = "9d4ee2c3cfd5f49861939447990f3b7d7bf9bf94"
+SRCREV_tinycrypt = "3e9a49d2672ec01435ffbf0d788db6d95ef28de0"
+
+PV = "2.5.0-rc3+git${SRCPV}"
Signature · 1 line
2.30.1
#5 lore raw

PATCH 6/14 zephyr-kernel-common.inc: Fix configuration CPPFLAGS warning

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

Configure warns when CPPFLAGS is provided as environment variable and expects its value to be passed to cmake. This patch does that to surpress the warning.

---
 recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +6 -3
index 5313030..abc55ba 100644
@@ -13,8 +13,7 @@ ZEPHYR_SYSROOT="${STAGING_DIR_TARGET}"
 
 ZEPHYR_MAKE_OUTPUT = "zephyr.elf"
 
-
-EXTRA_OECMAKE = " -DZEPHYR_BASE=${S} -DZEPHYR_GCC_VARIANT=yocto -DBOARD=${BOARD} -DARCH=${ARCH} -DCROSS_COMPILE=${CROSS_COMPILE} -DZEPHYR_SYSROOT=${ZEPHYR_SYSROOT} -DZEPHYR_TOOLCHAIN_VARIANT=yocto"
+EXTRA_OECMAKE = " -DZEPHYR_BASE=${S} -DZEPHYR_GCC_VARIANT=yocto -DBOARD=${BOARD} -DARCH=${ARCH} -DCROSS_COMPILE=${CROSS_COMPILE} -DZEPHYR_SYSROOT=${ZEPHYR_SYSROOT} -DZEPHYR_TOOLCHAIN_VARIANT=yocto -DEXTRA_CPPFLAGS=${CPPFLAGS}"
 
 ZEPHYR_MODULES = ""
 ZEPHYR_MODULES_append_arm = "\;${S}/modules/cmsis"
@@ -26,7 +25,6 @@ EXTRA_OECMAKE_append = " -DZEPHYR_MODULES=${ZEPHYR_MODULES}"
 
 export ZEPHYR_BASE="${S}"
 
-
 DEPENDS += "gperf-native python3-pyelftools-native python3-pyyaml-native python3-pykwalify-native"
 CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
 
@@ -51,3 +49,8 @@ OE_TERMINAL_EXPORTS += "ZEPHYR_SYSROOT"
 OE_TERMINAL_EXPORTS += "ZEPHYR_GCC_VARIANT"
 
 IMAGE_FSTYPES = "elf bin"
+
+do_configure_prepend() {
+    # Zephyr expects CPPFLAGS as cmake argument as and ignores env variables.
+    unset CPPFLAGS
+}
Signature · 1 line
2.30.1
#6 lore raw

PATCH 7/14 zephyr-kernel-common.inc: Reformat EXTRA_OECMAKE

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

This will improve diffs readability in the future.

---
 recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +10 -1
index abc55ba..330fe59 100644
@@ -13,7 +13,16 @@ ZEPHYR_SYSROOT="${STAGING_DIR_TARGET}"
 
 ZEPHYR_MAKE_OUTPUT = "zephyr.elf"
 
-EXTRA_OECMAKE = " -DZEPHYR_BASE=${S} -DZEPHYR_GCC_VARIANT=yocto -DBOARD=${BOARD} -DARCH=${ARCH} -DCROSS_COMPILE=${CROSS_COMPILE} -DZEPHYR_SYSROOT=${ZEPHYR_SYSROOT} -DZEPHYR_TOOLCHAIN_VARIANT=yocto -DEXTRA_CPPFLAGS=${CPPFLAGS}"
+EXTRA_OECMAKE = "\
+    -DZEPHYR_BASE=${S} \
+    -DZEPHYR_GCC_VARIANT=yocto \
+    -DBOARD=${BOARD} \
+    -DARCH=${ARCH} \
+    -DCROSS_COMPILE=${CROSS_COMPILE} \
+    -DZEPHYR_SYSROOT=${ZEPHYR_SYSROOT} \
+    -DZEPHYR_TOOLCHAIN_VARIANT=yocto \
+    -DEXTRA_CPPFLAGS=${CPPFLAGS} \
+    "
 
 ZEPHYR_MODULES = ""
 ZEPHYR_MODULES_append_arm = "\;${S}/modules/cmsis"
Signature · 1 line
2.30.1
#7 lore raw

PATCH 8/14 zephyr-kernel.inc: Remove include file

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

This file has little advantage and can be easily replaced by just directly including the src include file.

---
 recipes-kernel/zephyr-kernel/zephyr-image.inc  | 2 +-
 recipes-kernel/zephyr-kernel/zephyr-kernel.inc | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)
 delete mode 100644 recipes-kernel/zephyr-kernel/zephyr-kernel.inc
recipes-kernel/zephyr-kernel/zephyr-image.inc +1 -1
index e8b8871..c77692d 100644
@@ -1,4 +1,4 @@
-require zephyr-kernel.inc
+require zephyr-kernel-src.inc
 require zephyr-kernel-common.inc
 
 inherit testimage
recipes-kernel/zephyr-kernel/zephyr-kernel.inc deleted +0 -4
deleted file mode 100644
index 903973d..0000000
@@ -1,4 +0,0 @@
-
-inherit zephyr-kernel-src
-
-S = "${WORKDIR}/git"
Signature · 1 line
2.30.1
#8 lore raw

PATCH 9/14 Use an include file for the common parts of the sample recipes

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

---
 recipes-kernel/zephyr-kernel/zephyr-hci-uart.bb | 16 ++--------------
 .../zephyr-kernel/zephyr-helloworld.bb          | 13 +------------
 .../zephyr-kernel/zephyr-kernel-test.bb         |  4 ----
 .../zephyr-kernel/zephyr-kernel-test.inc        |  2 --
 .../zephyr-kernel/zephyr-peripheral-esp.bb      | 17 +++--------------
 .../zephyr-kernel/zephyr-philosophers.bb        | 13 +------------
 recipes-kernel/zephyr-kernel/zephyr-sample.inc  | 13 +++++++++++++
 7 files changed, 20 insertions(+), 58 deletions(-)
 create mode 100644 recipes-kernel/zephyr-kernel/zephyr-sample.inc
recipes-kernel/zephyr-kernel/zephyr-hci-uart.bb +2 -14
index ec6b13e..c66c7ec 100644
@@ -1,17 +1,5 @@
-require zephyr-kernel.inc
-require zephyr-kernel-common.inc
-inherit deploy
-
-COMPATIBLE_MACHINE = "(96b-nitrogen)"
+include zephyr-sample.inc
 
 ZEPHYR_SRC_DIR = "${S}/samples/bluetooth/hci_uart"
-ZEPHYR_BASE = "${S}"
-
-OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
 
-do_deploy () {
-    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
-}
-
-addtask deploy after do_compile
-do_install[noexec] = "1"
+COMPATIBLE_MACHINE = "(96b-nitrogen)"
recipes-kernel/zephyr-kernel/zephyr-helloworld.bb +1 -12
index 84db068..ac5ce62 100644
@@ -1,14 +1,3 @@
-require zephyr-kernel.inc
-require zephyr-kernel-common.inc
-inherit deploy
+include zephyr-sample.inc
 
 ZEPHYR_SRC_DIR = "${S}/samples/hello_world"
-ZEPHYR_BASE = "${S}"
-OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
-
-do_deploy () {
-    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
-}
-
-addtask deploy after do_compile
-do_install[noexec] = "1"
recipes-kernel/zephyr-kernel/zephyr-kernel-test.bb +0 -4
index 46d93f0..2918d2d 100644
@@ -2,7 +2,3 @@ require zephyr-image.inc
 require zephyr-kernel-test.inc
 
 BBCLASSEXTEND = '${@" ".join(["zephyrtest:" + x for x in d.getVar("ZEPHYRTESTS", True).split()])}'
-
-
-
-
recipes-kernel/zephyr-kernel/zephyr-kernel-test.inc +0 -2
index a1e62af..b6b4766 100644
@@ -2,11 +2,9 @@ ZEPHYRTESTS_remove = "fifo fpu_sharing lifo mbox mem_heap mem_pool \
     mem_protect mem_slab msgq mutex pipe profiling sched semaphore \
     stack threads tickless timer workq"
 
-
 # Exclude tests which does not build for various reasons
 ZEPHYRTESTS_remove = "gen_isr_table spinlock smp mp"
 
-
 # test_context will fail because QEMU for ARM does not emulate CortexM3 BASEPRI register
 #ZEPHYRTESTS_remove_arm += ""
 
recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb +3 -14
index 24f030a..8be90d1 100644
@@ -1,16 +1,5 @@
-require zephyr-kernel.inc
-require zephyr-kernel-common.inc
-inherit deploy
+include zephyr-sample.inc
 
-ZEPHYR_SAMPLE_NAME="samples/bluetooth/peripheral_esp"
-ZEPHYR_SRC_DIR = "${S}/${ZEPHYR_SAMPLE_NAME}"
-ZEPHYR_BASE = "${S}"
-OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
-ZEPHYR_MODULES_append = "\;${S}/modules/crypto/tinycrypt"
-
-do_deploy () {
-    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
-}
+ZEPHYR_SRC_DIR = "${S}/samples/bluetooth/peripheral_esp"
 
-addtask deploy after do_compile
-do_install[noexec] = "1"
+ZEPHYR_MODULES_append = "\;${S}/modules/crypto/tinycrypt"
recipes-kernel/zephyr-kernel/zephyr-philosophers.bb +1 -12
index b8262ca..a2afb57 100644
@@ -1,14 +1,3 @@
-require zephyr-kernel.inc
-require zephyr-kernel-common.inc
-inherit deploy
+include zephyr-sample.inc
 
 ZEPHYR_SRC_DIR = "${S}/samples/philosophers"
-ZEPHYR_BASE = "${S}"
-OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
-
-do_deploy () {
-    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
-}
-
-addtask deploy after do_compile
-do_install[noexec] = "1"
recipes-kernel/zephyr-kernel/zephyr-sample.inc new file +13 -0
new file mode 100644
index 0000000..f7621d1
@@ -0,0 +1,13 @@
+require zephyr-kernel-src.inc
+require zephyr-kernel-common.inc
+inherit deploy
+
+ZEPHYR_BASE = "${S}"
+OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
+
+do_install[noexec] = "1"
+
+do_deploy () {
+    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
+}
+addtask deploy after do_compile
Signature · 1 line
2.30.1
#9 lore raw

PATCH 10/14 zephyr-peripheral-hr: Add recipe for BT HR sample

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

---
 recipes-kernel/zephyr-kernel/zephyr-peripheral-hr.bb | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 recipes-kernel/zephyr-kernel/zephyr-peripheral-hr.bb
recipes-kernel/zephyr-kernel/zephyr-peripheral-hr.bb new file +5 -0
new file mode 100644
index 0000000..e6ef7b8
@@ -0,0 +1,5 @@
+include zephyr-sample.inc
+
+ZEPHYR_SRC_DIR = "${S}/samples/bluetooth/peripheral_hr"
+
+ZEPHYR_MODULES_append = "\;${S}/modules/crypto/tinycrypt"
Signature · 1 line
2.30.1
#10 lore raw

PATCH 11/14 zephyr-flash-pyocd.bbclass: Flash the first probe found with a timeout

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

Currently the code flashes the firmware in a blocking way. If the host is not configured accordingly (for example in terms of permissions), this would hang undefinitely. This can easily confuse users and in order to avoid this, the patch changes to unblocking session creation and opening call, wrapping the tries in some relevant logging. The timeout can be defined with CONNECT_TIMEOUT_SECONDS which defaults to 30 seconds.

Also, by default, when multiple probes are attached, the session call will return a selection choice. This would obviously break under bitbake with an exception:
Exception: EOFError: EOF when reading a line
Avoid this by selecting the first found probe.

---
 classes/zephyr-flash-pyocd.bbclass | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
classes/zephyr-flash-pyocd.bbclass +17 -1
index eca30c9..df3b631 100644
@@ -1,11 +1,27 @@
+CONNECT_TIMEOUT_SECONDS ?= "30"
+
 python do_flash_usb() {
     from pyocd.core.helpers import ConnectHelper
     from pyocd.flash.file_programmer import FileProgrammer
 
+    timeout = int(d.getVar('CONNECT_TIMEOUT_SECONDS'))
     image = f"{d.getVar('DEPLOY_DIR_IMAGE')}/{d.getVar('PN')}.elf"
     bb.plain(f"Attempting to flash {image} to board {d.getVar('BOARD')}")
 
-    with ConnectHelper.session_with_chosen_probe() as session:
+    # Try to connect to a probe with a timeout
+    now = 0
+    step = 3
+    while True:
+        session = ConnectHelper.session_with_chosen_probe(blocking=False, return_first=True)
+        if session:
+            break
+        if now >= timeout:
+            bb.fatal("Timeout while trying to connect to a probe. Make sure the target device is connected and the udev is configured accordingly. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.")
+        bb.warn("Can't connect to the probe. Retrying in %d seconds..." % step)
+        time.sleep(step)
+        now += step
+
+    with session:
         FileProgrammer(session).program(image)
         session.board.target.reset()
 }
Signature · 1 line
2.30.1
#11 lore raw

PATCH 12/14 zephyr-flash-pyocd.bbclass: Handle import error for pyocd modules

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

---
 classes/zephyr-flash-pyocd.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
classes/zephyr-flash-pyocd.bbclass +5 -2
index df3b631..4d24e6a 100644
@@ -1,8 +1,11 @@
 CONNECT_TIMEOUT_SECONDS ?= "30"
 
 python do_flash_usb() {
-    from pyocd.core.helpers import ConnectHelper
-    from pyocd.flash.file_programmer import FileProgrammer
+    try:
+        from pyocd.core.helpers import ConnectHelper
+        from pyocd.flash.file_programmer import FileProgrammer
+    except ImportError:
+        bb.fatal("Flashing with pyocd needs the relevant python package. Make sure your host provides it or consult your distribution packages for how to install this prerequisite.")
 
     timeout = int(d.getVar('CONNECT_TIMEOUT_SECONDS'))
     image = f"{d.getVar('DEPLOY_DIR_IMAGE')}/{d.getVar('PN')}.elf"
Signature · 1 line
2.30.1
#12 lore raw

PATCH 13/14 zephyr-flash-pyocd.bbclass: Implement configurable probe IDs to program

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

Implement logic to configure what probes to program based on the PYOCD_FLASH_IDS variable:
1. by default program all attached probes
2. change default behaviour by listing the probe IDs to flash

CONNECT_TIMEOUT_SECONDS was also renamed to maintain consistency with the PYOCD_FLASH_IDS variable.

One can query the IDs using pyocd list.

The value of PYOCD_FLASH_IDS can also be injected into the datastore using BB_ENV_EXTRAWHITE.

---
 README.txt                         |  9 +++++
 classes/zephyr-flash-pyocd.bbclass | 57 ++++++++++++++++++++----------
 2 files changed, 48 insertions(+), 18 deletions(-)
README.txt +9 -0
index bda872b..ce5338b 100644
@@ -67,6 +67,15 @@ 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.
classes/zephyr-flash-pyocd.bbclass +39 -18

69 lines not on this page · raw message

Signature · 1 line
2.30.1
#13 lore raw

Re: [yocto] [meta-zephy][PATCH 13/14] zephyr-flash-pyocd.bbclass: Implement configurable probe IDs to program

Thanks Andrei for adding support for v2.5-rc4 and re-structuring.

Could you fix a whitespace in this patch ? Other patches looks good to me.

Later I will fix subject-prefix meta-zephyr typo in README.

Regards,
Naveen

Quoted 147 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Andrei Gherzan
Sent: Monday, February 15, 2021 7:20 PM
To: [email protected]
Cc: Andrei Gherzan <[email protected]>
Subject: [yocto] [meta-zephy][PATCH 13/14] zephyr-flash-pyocd.bbclass:
Implement configurable probe IDs to program

From: Andrei Gherzan <[email protected]>

Implement logic to configure what probes to program based on the PYOCD_FLASH_IDS variable:
1. by default program all attached probes 2. change default behaviour by listing the probe IDs to flash

CONNECT_TIMEOUT_SECONDS was also renamed to maintain consistency with the PYOCD_FLASH_IDS variable.

One can query the IDs using pyocd list.

The value of PYOCD_FLASH_IDS can also be injected into the datastore using BB_ENV_EXTRAWHITE.

---
 README.txt                         |  9 +++++
 classes/zephyr-flash-pyocd.bbclass | 57 ++++++++++++++++++++----------
 2 files changed, 48 insertions(+), 18 deletions(-)
README.txt +0 -0
index bda872b..ce5338b 100644
@@ -67,6 +67,15 @@ 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

README.txt +6 -0
+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:

README.txt +3 -0
+
+    $ PYOCD_FLASH_IDS='<ID1> <ID2> <ID3>'
+ BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE PYOCD_FLASH_IDS"

bitbake
+ <TARGET> -c flash_usb

README.txt +1 -0
+
 Building and Running Zephyr Tests
 =================================
 Presently only toolchains for ARM, x86, IAMCU and Nios2 are supported.
classes/zephyr-flash- renamed from classes/zephyr-flash-pyocd.bbclass +0 -0

pyocd.bbclass
index 4d24e6a..7e1cec5 100644

classes/zephyr-flash-pyocd.bbclass +2 -1
@@ -1,4 +1,5 @@
-CONNECT_TIMEOUT_SECONDS ?= "30"
+PYOCD_CONNECT_TIMEOUT_SECONDS ?= "30"
+PYOCD_FLASH_IDS ?= "all"
 
 python do_flash_usb() {
     try:
@@ -7,26 +8,46 @@ python do_flash_usb() {
     except ImportError:
         bb.fatal("Flashing with pyocd needs the relevant python package. Make

sure your host provides it or consult your distribution packages for how to install this prerequisite.")

classes/zephyr-flash-pyocd.bbclass +11 -2
-    timeout = int(d.getVar('CONNECT_TIMEOUT_SECONDS'))
+    try:
+        timeout = int(d.getVar('PYOCD_CONNECT_TIMEOUT_SECONDS'))
+    except ValueError:
+        bb.fatal(f"PYOCD_CONNECT_TIMEOUT_SECONDS was set to an invalid
+ value: {d.getVar('PYOCD_CONNECT_TIMEOUT_SECONDS')}.")
     image = f"{d.getVar('DEPLOY_DIR_IMAGE')}/{d.getVar('PN')}.elf"
-    bb.plain(f"Attempting to flash {image} to board {d.getVar('BOARD')}")
+    ids = d.getVar('PYOCD_FLASH_IDS')
+
+    # Compute the list of IDs to program
+    if ids == 'all':
+        ids = []
+        for probe in

ConnectHelper.get_all_connected_probes(blocking=False):

classes/zephyr-flash-pyocd.bbclass +8 -5
+            ids.append(probe.unique_id)
+        if not ids:
+            bb.fatal("No probe detected. Make sure your target is connected.")
+    else:
+        ids = ids.split()
+        if not ids:
+            bb.fatal("No probe requested for programming. Make sure
+ PYOCD_FLASH_IDS is set.")
 
-    # Try to connect to a probe with a timeout
-    now = 0
-    step = 3
-    while True:
-        session = ConnectHelper.session_with_chosen_probe(blocking=False,

return_first=True)

classes/zephyr-flash-pyocd.bbclass +0 -4
-        if session:
-            break
-        if now >= timeout:
-            bb.fatal("Timeout while trying to connect to a probe. Make sure the

target device is connected and the udev is configured accordingly. See
<https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.")

classes/zephyr-flash-pyocd.bbclass +9 -6
-        bb.warn("Can't connect to the probe. Retrying in %d seconds..." % step)
-        time.sleep(step)
-        now += step
+    # Program each ID
+    for id in ids:
+        bb.plain(f"Attempting to flash {os.path.basename(image)} to
+ board {d.getVar('BOARD')} [{id}]")
 
-    with session:
-        FileProgrammer(session).program(image)
-        session.board.target.reset()
+        # Try to connect to a probe with a timeout
+        now = 0
+        step = 3
+        while True:
+            session =

ConnectHelper.session_with_chosen_probe(blocking=False, return_first=True, unique_id=id)

classes/zephyr-flash-pyocd.bbclass +4 -0
+            if session:
+                break
+            if now >= timeout:
+                bb.fatal(f"Timeout while trying to connect to probe ID: {id}. Make

sure the target device is connected and the udev is configured accordingly. See <https://github.com/mbedmicro/pyOCD/tree/master/udev> for help.")
+ bb.warn(f"Can't connect to the probe ID: {id}. Retrying in {step}
seconds...")

classes/zephyr-flash-pyocd.bbclass +7 -1
+            time.sleep(step)
+            now += step
+
+        # Program the sepected probe
+        with session:
+            FileProgrammer(session).program(image)
+            session.board.target.reset()
 }
 
 addtask do_flash_usb after do_deploy
--

2.30.1

#14 lore raw

PATCH 14/14 zephyr-kernel-src: Upgrade 2.5.0-rc3 to rc4

In reply to Andrei Gherzan

From: Andrei Gherzan <[email protected]>

---
 ...rnel-src-2.5.0-rc3.inc => zephyr-kernel-src-2.5.0-rc4.inc} | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename recipes-kernel/zephyr-kernel/{zephyr-kernel-src-2.5.0-rc3.inc => zephyr-kernel-src-2.5.0-rc4.inc} (86%)
recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0-rc4.inc renamed from recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0-rc3.inc +2 -2
similarity index 86%
rename from recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0-rc3.inc
rename to recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0-rc4.inc
index 4ee9883..b8aa4dc 100644
@@ -1,5 +1,5 @@
 SRCREV_FORMAT = "default_cmsis"
-SRCREV_default = "v2.5.0-rc3"
+SRCREV_default = "v2.5.0-rc4"
 SRCREV_cmsis = "c3bd2094f92d574377f7af2aec147ae181aa5f8e"
 SRCREV_nordic = "f3434da6446380fcdd426dbe2866af21d0d549b6"
 SRCREV_stm32 = "cc8731dba4fd9c57d7fe8ea6149828b89c2bd635"
@@ -7,4 +7,4 @@ SRCREV_open-amp = "de1b85a13032a2de1d8b6695ae5f800b613e739d"
 SRCREV_libmetal = "9d4ee2c3cfd5f49861939447990f3b7d7bf9bf94"
 SRCREV_tinycrypt = "3e9a49d2672ec01435ffbf0d788db6d95ef28de0"
 
-PV = "2.5.0-rc3+git${SRCPV}"
+PV = "2.5.0-rc4+git${SRCPV}"
Signature · 1 line
2.30.1