This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Undefined reference to 'nrf_log_default_backend_init'

Hello,

I am using the nRF52 DK with Segger Embedded Studio and the SDK 14.2.0. I wanted to build the example 'esb_ptx_pca10040' with logging enabled. To achieve this, I set NRF_LOG_ENABLED to 1 in sdk_config.h. As indicated in several other posts I also added NRF_LOG_BACKEND_RTT_ENABLED and set it to 1. When I try to compile the code I receive the error message "undefined reference to `nrf_log_default_backends_init' " from the call "NRF_LOG_DEFAULT_BACKENDS_INIT();" in main.c. Do you have any idea what the problem could be?

  • Hey Lukas,

    I suggest you take a look at the ble_app_uart example. Note the files included in the nRF_Log folder as well as the nRF_SEGGER_RTT folder.

     
    You will also need to compare the sdk_config.h file to see what you're missing. I suggest you use the template sd_config.h file found in SDK14.2\config\.

    Cheers,

    Håkon

  • Sorry to revive this one. I have the exact same problem with SDK version 17.0.0, for  the scheduler tutorial. I have  tried to compile the ble_ap_uart example as suggested above, with the same linker error as transcribed below. So currently the SDK example out of the box is broken too.

    Your definitive help to resolve this would be appreciated.

     Generating linker script ‘scheduler_tutorial_pca10040_s132.ld’
      Linking scheduler_tutorial_pca10040_s132.elf
        Output/scheduler_tutorial_pca10040_s132 Release/Obj/nrf_log_default_backends.o: in function `nrf_log_default_backends_init':
        undefined reference to `nrf_log_backend_rtt_init'
        Output/scheduler_tutorial_pca10040_s132 Release/Obj/nrf_log_default_backends.o:C:\Projects\Bluetooth Communicator\Tools\Nordic\SDK\nRF5_SDK_17.0.0_9d13099\components\libraries\log\src/nrf_log_default_backends.c:50: undefined reference to `nrf_log_backend_rtt_api'
    Build failed

  • Hi,

    Check if you have the following c file added to your project, together with the other log related files in the nRF_Log catalog of the project explorer:

    <sdk root folder>\components\libraries\log\src\nrf_log_backend_rtt.c

    I stumbled across a project with the "undefined reference to `nrf_log_backend_rtt_api'" error today, and needed to add that file.

    Regards,
    Terje

  • Nordic SDK is really a nightmare, it is so badly designed, each time we want to add an API or a library it is several hours of chasing dependincies and obscure defines, which we pretty much have to guess, and including files lost in a forest of folder chaos, the whole thing doesnt make any sense

Related