[meta-zephyr][PATCH 1/3] zephyr-kernel: install .bin image if available


Wojciech Zmuda
 

From: Nagesh Shamnur <nagesh.shamnur@huawei.com>

Some boards (e.g. Arduino Nano 33 BLE) require image in bin format
for flashing with `-c flash_usb`. Provide that image along with ELF
image on do_deploy step.

Signed-off-by: Nagesh Shamnur <nagesh.shamnur@huawei.com>
Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com>
---
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc | 1 +
recipes-kernel/zephyr-kernel/zephyr-sample.inc | 4 ++++
2 files changed, 5 insertions(+)

diff --git a/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc b/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
index 330fe59..46f19e2 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
+++ b/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
@@ -12,6 +12,7 @@ ZEPHYR_GCC_VARIANT="yocto"
ZEPHYR_SYSROOT="${STAGING_DIR_TARGET}"

ZEPHYR_MAKE_OUTPUT = "zephyr.elf"
+ZEPHYR_MAKE_BIN_OUTPUT = "zephyr.bin"

EXTRA_OECMAKE = "\
-DZEPHYR_BASE=${S} \
diff --git a/recipes-kernel/zephyr-kernel/zephyr-sample.inc b/recipes-kernel/zephyr-kernel/zephyr-sample.inc
index f7621d1..7b49611 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-sample.inc
+++ b/recipes-kernel/zephyr-kernel/zephyr-sample.inc
@@ -9,5 +9,9 @@ do_install[noexec] = "1"

do_deploy () {
install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
+ if [ -f ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ]
+ then
+ install -D ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ${DEPLOYDIR}/${PN}.bin
+ fi
}
addtask deploy after do_compile
--
2.25.1