[meta-zephyr,v2,2/2] zephyr-peripheral-esp: fix compilation

Submitted by Wojciech Zmuda on Feb. 4, 2021, 1:09 p.m. | Patch ID: 179377


Message ID 20210204130950.3218546-3-zmuda.w@gmail.com
State New
Headers show

Commit Message

Wojciech Zmuda Feb. 4, 2021, 1:09 p.m.
From: Wojciech Zmuda <wojciech.zmuda@huawei.com>

Bluetooth peripheral ESP sample application does not compile
because of:
 - broken source directory path passing to cmake,
 - broken paths in do_deploy,
 - unnecessary call for do_install,
 - missing tinycrypt.

The first issue caused the following error:

    <...>/gcc/arm-yocto-eabi/9.3.0/ld: <...>/recipe-sysroot/usr/lib/libc.a(lib_a-exit.o): in function `exit':
    /usr/src/debug/newlib/3.2.0-r0/newlib-3.2.0/newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
    collect2: error: ld returned 1 exit status

Fix the issue by providing Zephyr source directory to cmake
via OECMAKE_SOURCEPATH variable. On the do_configure step cmake
now gets the full path to the sample source code instead of
Zephyr root directory.

The second and third issue caused errors because of missing files.
Don't execute do_install and use the same paths in deploy as the
other sample apps do.

Inspecting meta-zephyr commits history shows that similar approach
was used in bb files of other sample application when updating
them to work with Zephyr 2.0.

For the missing Tinycrypt, append its location to cmake.

Signed-off-by: Wojciech Zmuda <wojciech.zmuda@huawei.com>
 recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb b/recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb
index 2ffe5ae..192c76d 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb
+++ b/recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb
@@ -5,15 +5,12 @@  inherit deploy
-do_compile () {
-    cd ${ZEPHYR_SRC_DIR}
-    oe_runmake ${ZEPHYR_MAKE_ARGS}
+EXTRA_OECMAKE_append = "\;${S}/modules/crypto/tinycrypt"
 do_deploy () {
-    install -D ${ZEPHYR_SAMPLE_NAME}/outdir/${BOARD}/zephyr.elf ${DEPLOYDIR}/${PN}.elf
-    install -D ${ZEPHYR_SAMPLE_NAME}/outdir/${BOARD}/zephyr.bin ${DEPLOYDIR}/${PN}.bin
+    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
 addtask deploy after do_compile
+do_install[noexec] = "1"