[meta-zephy][PATCH 09/14] Use an include file for the common parts of the sample recipes


Andrei Gherzan
 

From: Andrei Gherzan <andrei.gherzan@huawei.com>

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
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

diff --git a/recipes-kernel/zephyr-kernel/zephyr-hci-uart.bb b/recipes-kernel/zephyr-kernel/zephyr-hci-uart.bb
index ec6b13e..c66c7ec 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-hci-uart.bb
+++ b/recipes-kernel/zephyr-kernel/zephyr-hci-uart.bb
@@ -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)"
diff --git a/recipes-kernel/zephyr-kernel/zephyr-helloworld.bb b/recipes-kernel/zephyr-kernel/zephyr-helloworld.bb
index 84db068..ac5ce62 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-helloworld.bb
+++ b/recipes-kernel/zephyr-kernel/zephyr-helloworld.bb
@@ -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"
diff --git a/recipes-kernel/zephyr-kernel/zephyr-kernel-test.bb b/recipes-kernel/zephyr-kernel/zephyr-kernel-test.bb
index 46d93f0..2918d2d 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-kernel-test.bb
+++ b/recipes-kernel/zephyr-kernel/zephyr-kernel-test.bb
@@ -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()])}'
-
-
-
-
diff --git a/recipes-kernel/zephyr-kernel/zephyr-kernel-test.inc b/recipes-kernel/zephyr-kernel/zephyr-kernel-test.inc
index a1e62af..b6b4766 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-kernel-test.inc
+++ b/recipes-kernel/zephyr-kernel/zephyr-kernel-test.inc
@@ -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 += ""

diff --git a/recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb b/recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb
index 24f030a..8be90d1 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb
+++ b/recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb
@@ -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"
diff --git a/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb b/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
index b8262ca..a2afb57 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
+++ b/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
@@ -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"
diff --git a/recipes-kernel/zephyr-kernel/zephyr-sample.inc b/recipes-kernel/zephyr-kernel/zephyr-sample.inc
new file mode 100644
index 0000000..f7621d1
--- /dev/null
+++ b/recipes-kernel/zephyr-kernel/zephyr-sample.inc
@@ -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
--
2.30.1