zephyr-peripheral-esp: fix compilation

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>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
This commit is contained in:
Wojciech Zmuda
2021-02-04 14:09:50 +01:00
committed by Naveen Saini
parent fe509167cb
commit 2fc3697f99

View File

@@ -5,15 +5,12 @@ inherit deploy
ZEPHYR_SAMPLE_NAME="samples/bluetooth/peripheral_esp"
ZEPHYR_SRC_DIR = "${S}/${ZEPHYR_SAMPLE_NAME}"
ZEPHYR_BASE = "${S}"
do_compile () {
cd ${ZEPHYR_SRC_DIR}
oe_runmake ${ZEPHYR_MAKE_ARGS}
}
OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
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"