I am a beginner in BLE and I want to use one nrf52840 as host and one nrf52832 as controller to learn HCI UART. In nrf52832 I flash the hci_uart program in the zephyr routine, and in nrf52840 I want to change the beacon program to host_only, but the compilation error occurs. I added the
CONFIG_BT_HCI=y CONFIG_BT_CTLR=n CONFIG_BT_H4=y
code to the prj-coex.conf file, and VScode provides the following error output:
[108/174] Building C object zephyr/drivers/bluetooth/CMakeFiles/drivers__bluetooth.dir/hci/h4.c.obj
FAILED: zephyr/drivers/bluetooth/CMakeFiles/drivers__bluetooth.dir/hci/h4.c.obj
C:\ncs\toolchains\cf2149caf2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DNRF52840_XXAA -DPICOLIBC_LONG_LONG_PRINTF_SCANF -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -IC:/ncs/v2.6.0/zephyr/subsys/bluetooth -IC:/ncs/v2.6.0/zephyr/include -IC:/myapps/beacon/build/zephyr/include/generated -IC:/ncs/v2.6.0/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/ncs/v2.6.0/zephyr/soc/common/nordic_nrf/. -IC:/ncs/v2.6.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.6.0/nrf/include -IC:/ncs/v2.6.0/nrf/tests/include -IC:/ncs/v2.6.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.6.0/zephyr/modules/cmsis/. -IC:/ncs/v2.6.0/modules/hal/nordic/nrfx -IC:/ncs/v2.6.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.6.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.6.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.6.0/modules/debug/segger/SEGGER -IC:/ncs/v2.6.0/modules/debug/segger/Config -IC:/ncs/v2.6.0/modules/crypto/tinycrypt/lib/include -IC:/ncs/v2.6.0/nrfxlib/softdevice_controller/include -isystem C:/ncs/v2.6.0/zephyr/lib/libc/common/include -isystem C:/ncs/v2.6.0/nrfxlib/crypto/nrf_cc310_platform/include -Wshadow -fno-strict-aliasing -Os -imacros C:/myapps/beacon/build/zephyr/include/generated/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.6.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/myapps/beacon=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.6.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.6.0=WEST_TOPDIR -ffunction-sections -fdata-sections --specs=picolibc.specs -std=c99 -MD -MT zephyr/drivers/bluetooth/CMakeFiles/drivers__bluetooth.dir/hci/h4.c.obj -MF zephyr\drivers\bluetooth\CMakeFiles\drivers__bluetooth.dir\hci\h4.c.obj.d -o zephyr/drivers/bluetooth/CMakeFiles/drivers__bluetooth.dir/hci/h4.c.obj -c C:/ncs/v2.6.0/zephyr/drivers/bluetooth/hci/h4.c
In file included from C:/ncs/v2.6.0/zephyr/include/zephyr/toolchain/gcc.h:98,
from C:/ncs/v2.6.0/zephyr/include/zephyr/toolchain.h:50,
from C:/ncs/v2.6.0/zephyr/include/zephyr/kernel_includes.h:23,
from C:/ncs/v2.6.0/zephyr/include/zephyr/kernel.h:17,
from C:/ncs/v2.6.0/zephyr/drivers/bluetooth/hci/h4.c:12:
C:/ncs/v2.6.0/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_114' undeclared here (not in a function); did you mean '__device_dts_ord_14'?
89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~
C:/ncs/v2.6.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
C:/ncs/v2.6.0/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~
C:/ncs/v2.6.0/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
| ^~~~~~~~~~~~~~~
C:/ncs/v2.6.0/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
| ^~~~~~~~~~~~~~~~~~
C:/ncs/v2.6.0/zephyr/drivers/bluetooth/hci/h4.c:74:44: note: in expansion of macro 'DEVICE_DT_GET'
74 | static const struct device *const h4_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_uart));
| ^~~~~~~~~~~~~
[117/174] Building C object zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.EXE' --build 'c:\myapps\beacon\build'
* The terminal process terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.