zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.56k stars 6.47k forks source link

compilation fails while building samples/net/openthread/coprocessor for Arduino nano 33 ble #36625

Closed nageshshamnur closed 3 years ago

nageshshamnur commented 3 years ago

Describe the bug compilation error when trying to build openthread/coprocessor as explained in the page:https://docs.zephyrproject.org/latest/samples/net/openthread/coprocessor/README.html for arduino nano 33 ble

To Reproduce Steps to reproduce the behavior:

  1. $ west build -p auto -b arduino_nano_33_ble samples/net/openthread/coprocessor -- -DCONF_FILE="prj.conf overlay-rcp.conf"
  2. see error as below:
    
    $ west build -p auto -b arduino_nano_33_ble samples/net/openthread/coprocessor -- -DCONF_FILE="prj.conf overlay-rcp.conf"
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /home/ohos-bld/zephyrproject/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ohos-bld/zephyrproject/zephyr/samples/net/openthread/coprocessor
    -- Zephyr version: 2.6.99 (/home/ohos-bld/zephyrproject/zephyr), build: zephyr-v2.6.0-573-gf6a7dce763e8
    -- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.5") found components: Interpreter 
    -- Found west (found suitable version "0.10.1", minimum required is "0.7.1")
    -- Board: arduino_nano_33_ble
    -- Cache files will be written to: /home/ohos-bld/.cache/zephyr
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Using toolchain: zephyr 0.12.3 (/home/ohos-bld/zephyr-sdk-0.12.3)
    -- Found dtc: /home/ohos-bld/zephyr-sdk-0.12.3/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found BOARD.dts: /home/ohos-bld/zephyrproject/zephyr/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble.dts
    -- Generated zephyr.dts: /home/ohos-bld/zephyrproject/zephyr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ohos-bld/zephyrproject/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ohos-bld/zephyrproject/zephyr/build/zephyr/include/generated/device_extern.h
    Parsing /home/ohos-bld/zephyrproject/zephyr/samples/net/openthread/coprocessor/Kconfig
    Loaded configuration '/home/ohos-bld/zephyrproject/zephyr/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig'
    Merged configuration 'prj.conf'
    Merged configuration 'overlay-rcp.conf'
    Configuration saved to '/home/ohos-bld/zephyrproject/zephyr/build/zephyr/.config'
    Kconfig header saved to '/home/ohos-bld/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h'

warning: UART_CONSOLE_ON_DEV_NAME (defined at drivers/console/Kconfig:12) was assigned the value 'UART_1' but got the value ''. Check these unsatisfied dependencies: (UART_CONSOLE || CONSOLE_SUBSYS) (=n). See http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_UART_CONSOLE_ON_DEV_NAME.html and/or look up UART_CONSOLE_ON_DEV_NAME in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

warning: LOG_BACKEND_RTT (defined at subsys/logging/Kconfig.backends:88) was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: USE_SEGGER_RTT (=n). See http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LOG_BACKEND_RTT.html and/or look up LOG_BACKEND_RTT in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

-- The C compiler identification is GNU 10.2.0 -- The CXX compiler identification is GNU 10.2.0 -- The ASM compiler identification is GNU -- Found assembler: /home/ohos-bld/zephyr-sdk-0.12.3/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc CMake Deprecation Warning at /home/ohos-bld/zephyrproject/modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- OpenThread Source Directory: /home/ohos-bld/zephyrproject/modules/lib/openthread -- Check if the system is big endian -- Searching 16 bit integer -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of unsigned short -- Check size of unsigned short - done -- Searching 16 bit integer - Using unsigned short -- Check if the system is big endian - little endian -- Package Name: OPENTHREAD -- Setting default package version: gcdb957090 -- Package Version: gcdb957090 -- Configuring done -- Generating done -- Build files have been written to: /home/ohos-bld/zephyrproject/zephyr/build -- west build: building application [1/380] Preparing syscall dependency handling

[3/380] cd /home/ohos-bld/zephyrproject/zephyr/build/modules/openthread/build && /usr/bin/cmake -DLI...L_RADIO_IRQ_HANDLING=0" -P /home/ohos-bld/zephyrproject/modules/lib/openthread/etc/cmake/print.cmake OPENTHREAD_CONFIG_ASSERT_ENABLE=1 OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0 OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0 OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0 OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0 OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 OPENTHREAD_CONFIG_DIAG_ENABLE=1 OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1 OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1 OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=0 PACKAGE_NAME=OPENTHREAD PACKAGE_VERSION=gcdb957090 OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1 OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1 KERNEL ZEPHYR=1 _FORTIFY_SOURCE=2 BUILD_VERSION=zephyr-v2.6.0-573-gf6a7dce763e8 PROGRAM_START NRF52840_XXAA NRF_802154_FRAME_TIMESTAMP_ENABLED=0 NRF_802154_DELAYED_TRX_ENABLED=0 NRF_802154_IFS_ENABLED=0 NRF_802154_USE_RAW_API=1 NRF_802154_PENDING_SHORT_ADDRESSES=16 NRF_802154_PENDING_EXTENDED_ADDRESSES=16 NRF_802154_RX_BUFFERS=16 NRF_802154_CCA_CORR_LIMIT_DEFAULT=2 NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=45 NRF_802154_CCA_ED_THRESHOLD_DEFAULT=45 NRF_802154_CSMA_CA_ENABLED=1 NRF_802154_TX_STARTED_NOTIFY_ENABLED=1 NRF_802154_ACK_TIMEOUT_ENABLED=1 NRF_802154_ENCRYPTION_ENABLED=0 NRF_802154_SECURITY_WRITER_ENABLED=0 NRF_802154_IE_WRITER_ENABLED=0 NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED NRF_802154_INTERNAL_RADIO_IRQ_HANDLING=0 [150/380] Building C object zephyr/CMakeFiles/zephyr.dir/drivers/ieee802154/ieee802154_nrf5.c.obj FAILED: zephyr/CMakeFiles/zephyr.dir/drivers/ieee802154/ieee802154_nrf5.c.obj ccache /home/ohos-bld/zephyr-sdk-0.12.3/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DBUILD_VERSION=zephyr-v2.6.0-573-gf6a7dce763e8 -DKERNEL -DNRF52840_XXAA -DNRF_802154_ACK_TIMEOUT_ENABLED=1 -DNRF_802154_CCA_CORR_LIMIT_DEFAULT=2 -DNRF_802154_CCA_CORR_THRESHOLD_DEFAULT=45 -DNRF_802154_CCA_ED_THRESHOLD_DEFAULT=45 -DNRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED -DNRF_802154_CSMA_CA_ENABLED=1 -DNRF_802154_DELAYED_TRX_ENABLED=0 -DNRF_802154_ENCRYPTION_ENABLED=0 -DNRF_802154_FRAME_TIMESTAMP_ENABLED=0 -DNRF_802154_IE_WRITER_ENABLED=0 -DNRF_802154_IFS_ENABLED=0 -DNRF_802154_INTERNAL_RADIO_IRQ_HANDLING=0 -DNRF_802154_PENDING_EXTENDED_ADDRESSES=16 -DNRF_802154_PENDING_SHORT_ADDRESSES=16 -DNRF_802154_RX_BUFFERS=16 -DNRF_802154_SECURITY_WRITER_ENABLED=0 -DNRF_802154_TX_STARTED_NOTIFY_ENABLED=1 -DNRF_802154_USE_RAW_API=1 -D_FORTIFY_SOURCE=2 -DPROGRAM_START -DZEPHYR=1 -I../kernel/include -I../arch/arm/include -I../subsys/net/lib/openthread/platform -I../include -Izephyr/include/generated -I../soc/arm/nordic_nrf/nrf52 -I../subsys/net/lib/openthread/platform/. -I../subsys/settings/include -I/home/ohos-bld/zephyrproject/modules/hal/cmsis/CMSIS/Core/Include -I/home/ohos-bld/zephyrproject/modules/hal/nordic/nrfx -I/home/ohos-bld/zephyrproject/modules/hal/nordic/nrfx/drivers/include -I/home/ohos-bld/zephyrproject/modules/hal/nordic/nrfx/mdk -I../modules/hal_nordic/nrfx/. -I/home/ohos-bld/zephyrproject/modules/hal/nordic/drivers/nrf_802154/driver/include -I/home/ohos-bld/zephyrproject/modules/hal/nordic/drivers/nrf_802154/sl/include -I/home/ohos-bld/zephyrproject/modules/hal/nordic/drivers/nrf_802154/sl/sl_opensource/include -Imodules/openthread/build/etc/cmake -I/home/ohos-bld/zephyrproject/modules/lib/openthread/etc/cmake -I/home/ohos-bld/zephyrproject/modules/lib/openthread/include -isystem ../lib/libc/minimal/include -isystem /home/ohos-bld/zephyrproject/modules/lib/openthread/zephyr/../include -isystem /home/ohos-bld/zephyrproject/modules/lib/openthread/zephyr/../examples/platforms -isystem /home/ohos-bld/zephyr-sdk-0.12.3/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/include -isystem /home/ohos-bld/zephyr-sdk-0.12.3/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/include-fixed -Os -imacros /home/ohos-bld/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -imacros /home/ohos-bld/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/ohos-bld/zephyrproject/zephyr/samples/net/openthread/coprocessor=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/ohos-bld/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/ohos-bld/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT zephyr/CMakeFiles/zephyr.dir/drivers/ieee802154/ieee802154_nrf5.c.obj -MF zephyr/CMakeFiles/zephyr.dir/drivers/ieee802154/ieee802154_nrf5.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/drivers/ieee802154/ieee802154_nrf5.c.obj -c /home/ohos-bld/zephyrproject/zephyr/drivers/ieee802154/ieee802154_nrf5.c /home/ohos-bld/zephyrproject/zephyr/drivers/ieee802154/ieee802154_nrf5.c: In function 'nrf5_get_capabilities_at_boot': /home/ohos-bld/zephyrproject/zephyr/drivers/ieee802154/ieee802154_nrf5.c:226:12: error: 'NRF_802154_CAPABILITY_SECURITY' undeclared (first use in this function); did you mean 'NRF_802154_CAPABILITY_CSMA'? 226 | ((caps & NRF_802154_CAPABILITY_SECURITY) ? IEEE802154_HW_TX_SEC : 0UL); | ^~~~~~~~~~ | NRF_802154_CAPABILITY_CSMA /home/ohos-bld/zephyrproject/zephyr/drivers/ieee802154/ieee802154_nrf5.c:226:12: note: each undeclared identifier is reported only once for each function it appears in /home/ohos-bld/zephyrproject/zephyr/drivers/ieee802154/ieee802154_nrf5.c: In function 'nrf5_tx_csma_ca': /home/ohos-bld/zephyrproject/zephyr/drivers/ieee802154/ieee802154_nrf5.c:468:3: warning: implicit declaration of function 'nrf_802154_retransmit_csma_ca_raw'; did you mean 'nrf_802154_transmit_csma_ca_raw'? [-Wimplicit-function-declaration] 468 | nrf_802154_retransmit_csma_ca_raw(payload); | ^~~~~~~~~ | nrf_802154_transmit_csma_ca_raw [163/380] Building C object zephyr/subsys/net/l2/openthread/CMakeFiles/subsysnetipl2openthread.dir/openthread.c.obj ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/ohos-bld/zephyrproject/zephyr/build



**Expected behavior**
compilation is ok.

**Impact**
Unable to build openthread RCP example on Arudino Nano 33 BLE

**Logs and console output**
as attached above.

**Environment (please complete the following information):**
 - OS: Ubuntu 20.04.2 LTS
 - Toolchain: zephyr-sdk-0.12.3
 -  Commit SHA: f6a7dce763e8dcdcdda6d9977fd327386f554f98

**Additional context**
git revision: 457a28bf78 is successful with patch: https://github.com/zephyrproject-rtos/zephyr/commit/6c9945aafa00c09149e2052a9c2bccad16dd1d8a applied
nageshshamnur commented 3 years ago

with further debugging found that, the following piece of code might not be supported by Arduino nano 33 ble which is also powered by nRF52840 SoC.

file: ./drivers/ieee802154/ieee802154_nrf5.c inside the function: nrf5_get_capabilities_at_boot( ) parameters --> NRF_802154_CAPABILITY_DELAYED_RX and NRF_802154_CAPABILITY_SECURITY

file: ./drivers/ieee802154/ieee802154_nrf5.c function: function --> nrf_802154_retransmit_csma_ca_raw( )

rlubos commented 3 years ago

Are your repositories in sync, i. e. did you call west update? The issue looks as if the radio driver you build with was outdated, I cannot reproduce the failure on the current master.

nageshshamnur commented 3 years ago

i had run west update earlier, but running again now seems to have solved my problem. Sorry for the trouble caused.

rlubos commented 3 years ago

i had run west update earlier, but running again now seems to have solved my problem. Sorry for the trouble caused.

No worries, it happens quite often if you're not used to using west.