Fix Bluetooth Peripheral ESP sample compilation
v2 cover Fix Bluetooth Peripheral ESP sample compilation
From: Wojciech Zmuda <[email protected]>
v1 -> v2:
- Addedd missing [meta-zephyr] tag
- Re-sending with slightly different git-send-email configuration, so the authorship is pointed to my @huawei.com email instead of the one I'm sending it from.
Wojciech Zmuda (2):
zephyr-kernel: clone Tinycrypt
zephyr-peripheral-esp: fix compilation
classes/zephyr-kernel-src.bbclass | 2 ++ recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/2 zephyr-kernel: clone Tinycrypt
From: Wojciech Zmuda <[email protected]>
Tinycrypt is a library used in some sample applications, i.e. in zephyr-peripheral-esp. Add it to kernel bbclass, so it can be referenced in applications recipes that use it.
--- classes/zephyr-kernel-src.bbclass | 2 ++ 1 file changed, 2 insertions(+)
classes/zephyr-kernel-src.bbclass +2 -0
@@ -9,6 +9,7 @@ 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 \
@@ -16,6 +17,7 @@ SRC_URI = "git://github.com/zephyrproject-rtos/zephyr.git;protocol=https;branch= 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 \ "
Signature · 1 line
2.25.1
PATCH v2 2/2 zephyr-peripheral-esp: fix compilation
In reply to Wojciech ZmudaFrom: Wojciech Zmuda <[email protected]>
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 statusFix 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.
--- recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
recipes-kernel/zephyr-kernel/zephyr-peripheral-esp.bb +4 -7
@@ -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"
Signature · 1 line
2.25.1