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

NRF_LOG_BACKEND_RTT_ENABLED isn't defined in some examples of the SDK

I'm using JLinkRTTViewer to view the outputs from the application and to enable the logging, I used the following configs in sdk_config.h:


set NRF_LOG_BACKEND_RTT_ENABLED to 1

set NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0

But I see some examples (i.e template project) in the SDK that don't have macro NRF_LOG_BACKEND_RTT_ENABLED defined, and even copying the exact content of sdk_config.h from a functional example (where printing worked) didn't do the trick either. What am I missing? How can I get it to work? Why is sdk_config.h different for certain examples? 

Parents
  • Hi,

    Most example projects use UART logging, and most of them again also include the requirements for RTT logging. That does not apply to all though. And in that case, you need to add include paths, include files and sdk_config.h macros yourself. The easiest way to do this is to refer to an example project that use RTT logging, and do the same as is done there. You will probably miss one or two things, but then you should get a indication on what is missing from the error message when you try to build so that you can correct and try to build again. This is a bit tedious, but unfortunately that is the way it is.

  • Thanks for the response. I already have sdk_config.h added along with these files 

    also added the following in the preprocessor

    ../../../../../../external/segger_rtt
    ../../../../../../components/libraries/log
    ../../../../../../components/libraries/log/src

    And I still don't see a print in RTT Viewer. What else am I missing?
  • Hi,

    Those are the main files and includes, but those again have some further dependencies (which I cannot see if you have or not in your screenshot). For isntance, nrf_section, nrf_memobj, nrf_ringbuf etc. But I would think that with what you have you should get sensible errors and warning when building if you miss some dependencies, so that it is easier to add them?

  • That's the interesting part; the template project compiles fine without any errors but fails to output in RTT viewer. How else are you supposed to debug if it isn't erroring out? (unless you take the really tedious route in determining the dependencies...)

  • Hi,

    That is odd. I forgot to ask before: which SDK version are you using? And by template application, are you referring to ble_app_template? The thing is that the ble_app_template project in SDK 17.0.2 do support RTT out of the box, so the only thing you need to do to enable it is to set the two configuration macros you described in your initial post and it will work.

Reply Children
Related