Multiple definition of `UARTE0_UART0_IRQHandler':

Hello All, 

I am using nRF52840 Dev-kit and SDK 4.0 for Zigbee and thread. Due to some functions, we are using SDK 4.0 for this project which is not present in SDK 4.1.

I interfacing the UART0 in my thread example. I am getting the below errors. 

"../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk.a(uart.c.o): in function `UARTE0_UART0_IRQHandler':

multiple definition of `UARTE0_UART0_IRQHandler'; Output/Executable_1 Release External/Obj/nrfx_prs.o:D:\Project\Eurotronics\Thread_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v4.0.0_dc7186b\examples\thread\Thread_VAS_20211024/../../../modules/nrfx/drivers/src/prs/nrfx_prs.c:81: first defined here"

I have used thread MTD as a reference example - I have removed the cli library to make UART free. I have all the procedures to make UART0 free for my application. 

Before this I tried to use UART in the freeRTOS_Blinky example and which worked successfully. So I decided to port in thread example. But I am getting the above-mentioned error. 

Also, I referred to some nordic forum links regarding the same error, I tried the suggested in sdk_config.h file but still getting the same error. 

And, if I tried to exclude the "nrf_prs" then I get these below errors. 

"1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: missing --end-group; added as last command line option
1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: Output/Executable_1 Release External/Obj/nrfx_uart.o: in function `nrfx_uart_init':
1> D:\Project\Eurotronics\Thread_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v4.0.0_dc7186b\examples\thread\Thread_VAS_20211024/../../../modules/nrfx/drivers/src/nrfx_uart.c:189: undefined reference to `nrfx_prs_acquire'
1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: Output/Executable_1 Release External/Obj/nrfx_uarte.o: in function `nrfx_uarte_init':
1> D:\Project\Eurotronics\Thread_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v4.0.0_dc7186b\examples\thread\Thread_VAS_20211024/../../../modules/nrfx/drivers/src/nrfx_uarte.c:235: undefined reference to `nrfx_prs_acquire'
1> collect2.exe: error: ld returned 1 exit status"

Let me know how to resolve this issue, 

Thanks and Regards

Rohit R

  • Hi Rohit,

    Sometimes it takes some time to find the answer to your questions, so I hope you understand the late reply. UART instance 1 doesn't have legacy UART, so you need to use UARTE.  I tried to rebuild the stack with UARTE1 and got the following error message:

    ../../../../../openthread/third_party/NordicSemiconductor/nrfx/mdk/nrf52840.h:2891:37: error: passing argument 1 of 'nrf_uart_txrx_pins_set' from incompatible pointer type [-Werror=incompatible-pointer-types]
    #define NRF_UARTE1 ((NRF_UARTE_Type*) NRF_UARTE1_BASE)

    So it's doesn't look like it's possible to change to UARTE1 without modifying the nRF UART driver in OpenThread to use nrf_uarte instead of nrf_uart.

    My question for you, why aren't you able to use UARTE1 in your application instead of UART0?

    Rohit Rajapure said:
    I need UART0 as I have already developed a function on it and using in Zigbee and other protocols. We need to keep it the same for all protocols of the nRF devices. 

    To have used UART0 in another product using Zigbee is not a very good argument. Using UARTE1 in your application would be the easiest option in your case I think.

    Another thing you can try is to change libopenthread-nrf52840-sdk.a with libopenthread-nrf52840-sdk-spi.a or libopenthread-nrf52840-sdk-usb.a, so the stacks occupy a SPI instance or USB instance instead..

  • Hi, 

    Sorry for the late response. Due to the festival holiday in India, we are closed for a week.

    We are back and working on the suggestion.

    To have used UART0 in another product using Zigbee is not a very good argument. Using UARTE1 in your application would be the easiest option in your case I think.

    Since Zigbee and BLE product is ready using UART0, we are continuing the same with Thread. We want to make uniforms in all protocol products. 

    Before your feedback, we thought the same to work with UARTE1 till we get positive feedback and make UART0 free for users. I made the changes in the project with UARTE1 but this is temporary, I need UART0 free for uniform.

    Another thing you can try is to change libopenthread-nrf52840-sdk.a with libopenthread-nrf52840-sdk-spi.a or libopenthread-nrf52840-sdk-usb.a, so the stacks occupy a SPI instance or USB instance instead..

    - I tried to replace the libopenthread-nrf52840-sdk.a file with lib libopenthread-nrf52840-sdk-usb.a but getting the too many errors. 

    Below is the error list. let me know what other things need to be included to make error-free code related to USB lib, 

    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: missing --end-group; added as last command line option
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `usbdUserEventHandler':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:142: undefined reference to `app_usbd_disable'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `isPortOpened':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:176: undefined reference to `app_usbd_cdc_acm_line_state_get'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `cdcAcmUserEventHandler':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:107: undefined reference to `app_usbd_cdc_acm_read_any'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:121: undefined reference to `app_usbd_cdc_acm_rx_size'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `nrf5UartInit':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:272: undefined reference to `app_usbd_serial_num_generate'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:274: undefined reference to `app_usbd_init'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:283: undefined reference to `app_usbd_class_append'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:286: undefined reference to `app_usbd_power_events_enable'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `nrf5UartDeinit':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:292: undefined reference to `nrfx_usbd_is_started'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:294: undefined reference to `app_usbd_stop'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:296: undefined reference to `app_usbd_event_queue_process'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:305: undefined reference to `app_usbd_class_remove_all'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:300: undefined reference to `nrfx_usbd_is_enabled'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:302: undefined reference to `app_usbd_disable'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:306: undefined reference to `app_usbd_uninit'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `nrf5UartProcess':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:318: undefined reference to `app_usbd_event_queue_process'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `processConnection':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:194: undefined reference to `nrfx_usbd_is_enabled'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:196: undefined reference to `app_usbd_enable'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:217: undefined reference to `nrfx_usbd_is_enabled'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:219: undefined reference to `app_usbd_start'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `processReceive':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:235: undefined reference to `app_usbd_cdc_acm_read_any'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `processTransmit':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:247: undefined reference to `app_usbd_cdc_acm_write'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o): in function `processConnection':
    1> C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:201: undefined reference to `nrfx_usbd_is_started'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:203: undefined reference to `app_usbd_stop'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\bamboo\xml-data\build-dir\KNG-OL-BOLO\sdk\sdk\nrf5\external\openthread\project\nrf52840\openthread_nrf52840\sdk\usb\armgcc/../../../../../openthread/examples/platforms/nrf528xx/src/usb-cdc-uart.c:207: undefined reference to `app_usbd_disable'
    1> c:/program files (x86)/gnu arm embedded toolchain/10 2021.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ../../../external/openthread/lib/nrf52840/gcc/libopenthread-nrf52840-sdk-usb.a(usb-cdc-uart.c.o):(.rodata.sAppCdcAcm+0x4): undefined reference to `app_usbd_cdc_acm_class_methods'
    1> collect2.exe: error: ld returned 1 exit status

    Waiting for your response.

    Thanks and Regrads

    Rohit R

  • Hi Rohit,

    From the build log it looks like you haven't enabled the USB modules in the sdk_config.h file, since you are getting so many "undefined reference to 'app_usbd_enabled'" etc. Try to enable USB in sdk_config.h, asI think this is mandatory when using the usb lib.

    Best regards,

    Marjeris

Related