Issue following "Developing with OpenThread APIs" codelab

96 views
Skip to first unread message

Brandon Purvis

unread,
Oct 5, 2021, 7:10:28 PM10/5/21
to openthre...@googlegroups.com
 Have a ticket open for this here

Following Developing with OpenThread APIs codelab Using ubuntu 20.04 on commit 545c089 of openthread/ot-nrf528xx

On step 11 ./script/build nrf52840 UART_trans throws an error:

FAILED: openthread/examples/apps/cli/CMakeFiles/ot-cli-ftd.dir/main.c.obj 
/usr/local/bin/arm-none-eabi-gcc -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\" -DOPENTHREAD_CONFIG_ASSERT_ENABLE=1 -DOPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0 -DOPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0 -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0 -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=1 -DOPENTHREAD_CONFIG_FILE=\"openthread-core-nrf52840-config.h\" -DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1 -DOPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0 -DOPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1 -DOPENTHREAD_CONFIG_PING_SENDER_ENABLE=1 -DOPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2 -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-nrf52840-config-check.h\" -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-nrf52840-config.h\" -DOPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=0 -DPACKAGE_NAME=\"OPENTHREAD\" -DUSB_CDC_AS_SERIAL_TRANSPORT=1 -Iopenthread/etc/cmake -I../openthread/etc/cmake -I../openthread/include -I../openthread/examples/platforms -I../openthread/src/core -I../openthread/src -I../third_party/NordicSemiconductor/drivers/radio -I../third_party/NordicSemiconductor/drivers/radio/fem -I../third_party/NordicSemiconductor/drivers/radio/fem/three_pin_gpio -I../third_party/NordicSemiconductor/drivers/radio/mac_features -I../third_party/NordicSemiconductor/drivers/radio/mac_features/ack_generator -I../third_party/NordicSemiconductor/drivers/radio/platform/temperature -I../third_party/NordicSemiconductor/drivers/radio/platform/lp_timer -I../third_party/NordicSemiconductor/drivers/radio/rsch -I../third_party/NordicSemiconductor/drivers/radio/rsch/raal -I../third_party/NordicSemiconductor/drivers/radio/rsch/raal/softdevice -I../third_party/NordicSemiconductor -I../third_party/NordicSemiconductor/cmsis -I../third_party/NordicSemiconductor/config -I../third_party/NordicSemiconductor/dependencies -I../third_party/NordicSemiconductor/drivers/clock -I../third_party/NordicSemiconductor/drivers/common -I../third_party/NordicSemiconductor/drivers/power -I../third_party/NordicSemiconductor/drivers/systick -I../third_party/NordicSemiconductor/drivers/usbd -I../third_party/NordicSemiconductor/libraries/app_error -I../third_party/NordicSemiconductor/libraries/atfifo -I../third_party/NordicSemiconductor/libraries/atomic -I../third_party/NordicSemiconductor/libraries/block_dev -I../third_party/NordicSemiconductor/libraries/delay -I../third_party/NordicSemiconductor/libraries/usb -I../third_party/NordicSemiconductor/libraries/usb/config -I../third_party/NordicSemiconductor/libraries/usb/class/cdc -I../third_party/NordicSemiconductor/libraries/usb/class/cdc/acm -I../third_party/NordicSemiconductor/libraries/utf_converter -I../third_party/NordicSemiconductor/nrfx -I../third_party/NordicSemiconductor/nrfx/hal -I../third_party/NordicSemiconductor/nrfx/drivers -I../third_party/NordicSemiconductor/nrfx/drivers/include -I../third_party/NordicSemiconductor/nrfx/mdk -I../third_party/NordicSemiconductor/nrfx/soc -I../third_party/NordicSemiconductor/softdevice/s140/headers -I../third_party/NordicSemiconductor/softdevice/s140/headers/nrf52 -I../third_party/NordicSemiconductor/libraries/nrf_security/include -I../third_party/NordicSemiconductor/libraries/nrf_security/config -I../third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/include -I../third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config -I../src/nrf52840 -I../third_party/NordicSemiconductor/config/nrf52840/config -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs -fdata-sections -ffunction-sections -Wno-expansion-to-defined -std=gnu99 -Os -DNDEBUG   -std=gnu99 -MD -MT openthread/examples/apps/cli/CMakeFiles/ot-cli-ftd.dir/main.c.obj -MF openthread/examples/apps/cli/CMakeFiles/ot-cli-ftd.dir/main.c.obj.d -o openthread/examples/apps/cli/CMakeFiles/ot-cli-ftd.dir/main.c.obj   -c ../openthread/examples/apps/cli/main.c
../openthread/examples/apps/cli/main.c: In function 'initUdp':
../openthread/examples/apps/cli/main.c:247:5: error: too few arguments to function 'otUdpBind'
  247 |     otUdpBind(aInstance, &sUdpSocket, &listenSockAddr);
      |     ^~~~~~~~~
In file included from ../openthread/examples/apps/cli/main.c:49:
../openthread/include/openthread/udp.h:209:9: note: declared here
  209 | otError otUdpBind(otInstance *aInstance, otUdpSocket *aSocket, const otSockAddr *aSockName, otNetifIdentifier aNetif);
      |         ^~~~~~~~~

So I modified otUdpBind to include netif otUdpBind(aInstance, &sUdpSocket, &listenSockAddr, netif);. and defined it as otNetifIdentifier netif = OT_NETIF_THREAD; per cli_udp.cpp (just copying that as an example of what to add for that argument

Now On step 11 ./script/build nrf52840 UART_trans throws an error:

FAILED: bin/ot-cli-radio 
: && /usr/local/bin/arm-none-eabi-g++  -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs -fdata-sections -ffunction-sections -Wno-expansion-to-defined -fno-exceptions -fno-rtti -Os -DNDEBUG  -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs -fdata-sections -ffunction-sections -Wno-expansion-to-defined -specs=nano.specs -specs=nosys.specs openthread/examples/apps/cli/CMakeFiles/ot-cli-radio.dir/cli_uart.cpp.obj openthread/examples/apps/cli/CMakeFiles/ot-cli-radio.dir/main.c.obj  -o bin/ot-cli-radio  lib/libopenthread-cli-radio.a  lib/libopenthread-nrf52840.a  lib/libopenthread-nrf52840-transport.a  lib/libopenthread-radio-cli.a  lib/libopenthread-nrf52840.a  lib/libopenthread-nrf52840-transport.a  lib/libopenthread-cli-radio.a  lib/libopenthread-radio.a  lib/libnordicsemi-nrf52840-radio-driver.a  lib/libnordicsemi-nrf52840-radio-driver-softdevice.a  lib/libjlinkrtt.a  lib/libnordicsemi-nrf52840-sdk.a  -T/home/purvisb/git/ot-nrf528xx/src/nrf52840/nrf52840.ld  -Wl,--gc-sections  -Wl,-Map=ot-cli-radio.map  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedcrypto_shared.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedtls_tls_vanilla.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedtls_x509_vanilla.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedcrypto_cc3xx.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libnrf_cc310_platform_0.9.4.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedcrypto_oberon.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedtls_base_vanilla.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedcrypto_shared.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedtls_tls_vanilla.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedtls_x509_vanilla.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedcrypto_cc3xx.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libnrf_cc310_platform_0.9.4.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedcrypto_oberon.a  ../third_party/NordicSemiconductor/libraries/nrf_security/lib/libmbedtls_base_vanilla.a && :
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: openthread/examples/apps/cli/CMakeFiles/ot-cli-radio.dir/main.c.obj: in function `handleButtonInterrupt':
main.c:(.text.handleButtonInterrupt+0x16): undefined reference to `otIp6AddressFromString'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: main.c:(.text.handleButtonInterrupt+0x30): undefined reference to `otUdpNewMessage'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: main.c:(.text.handleButtonInterrupt+0x3c): undefined reference to `otMessageAppend'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: main.c:(.text.handleButtonInterrupt+0x4a): undefined reference to `otUdpSend'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: main.c:(.text.handleButtonInterrupt+0x52): undefined reference to `otMessageFree'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: openthread/examples/apps/cli/CMakeFiles/ot-cli-radio.dir/main.c.obj: in function `main':
main.c:(.text.startup.main+0x2c): undefined reference to `otSetStateChangedCallback'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: main.c:(.text.startup.main+0x5e): undefined reference to `otUdpOpen'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: main.c:(.text.startup.main+0x6a): undefined reference to `otUdpBind'
collect2: error: ld returned 1 exit status
[85/85] Linking CXX executable bin/ot-cli-ftd
ninja: build stopped: subcommand failed.

The headers are included and these commands do appear to be defined in the repo. I'm stuck at this point. Please advise.

Jonathan Hui

unread,
Oct 5, 2021, 7:34:19 PM10/5/21
to Brandon Purvis, openthre...@googlegroups.com
I just posted the following response in openthread/openthread#7056:

We plan to address this as part of openthread/ot-docs#43.

Your modification to `otUdpBind()` is correct. However, you also need to disable the `ot-cli-radio` build since `ot-cli-radio` does not provide the necessary APIs.

One way is to try setting `OT_CMAKE_NINJA_TARGET` to `ot-cli-ftd`.

--
Jonathan Hui



--
You received this message because you are subscribed to the Google Groups "openthread-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openthread-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/CANqEEsYQUeEOP91%3DzRSABihuqqu1Zx1Epro4hymhmtMOHgQhEA%40mail.gmail.com.

Jonathan Hui

unread,
Oct 6, 2021, 5:00:07 PM10/6/21
to Brandon Purvis, openthre...@googlegroups.com
We just merged the update to hte docs: openthread/ot-docs#45.

--
Jonathan Hui


Reply all
Reply to author
Forward
0 new messages