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

Will calling NRF_LOG_* methods cause a problem when not on a Development Kit?

THis may have an obvious answer to an experienced embedded programmer but I do not qualify to be that. So I have a piece of working code that runs on the nRF52840 DK and it has several NRF_LOG_* method calls. Now I want to flash the nRF52840 dongle with the built HEX file.

Clearly, I want to remove other methods like the button press handlers that do not exist on the dongle. So I do a conditional compile on a USE_DK statement to exclude or include pieces of the relevant code. The most irritating of these to handle is the logging as there are so many and they are distributed all over the place.

So can I leave these log statements? Do I need to play with the sdk_config.h file? So I need to conditionally exclude these statements when not using the DK? The logging does add a lot of baggage to the code size.

I am using SoftDevice (s140 7.2.0 API) for all Bluetooth and flash memory writes/reads and handling app events using the sd_ble_evt_get() approach. The SDK is used for timers, clocks, and board support.

Parents
  • Hi

    Are you using the UART or RTT backend for the logging?

    If you use RTT logging it should work fine to run on the dongle, but if you use UART logging it is likely the UART driver will crash when the UART pins are no longer connected to anything. 

    Regardless, it is probably best to simply disable logging entirely when building for the dongle. 

    Either you can use a separate sdk_config.h file for your dongle build, or you can move the NRF_LOG_ENABLED define from sdk_config.h to your project settings, so that you can define this separately for the two different build targets. 

    Best regards
    Torbjørn

Reply
  • Hi

    Are you using the UART or RTT backend for the logging?

    If you use RTT logging it should work fine to run on the dongle, but if you use UART logging it is likely the UART driver will crash when the UART pins are no longer connected to anything. 

    Regardless, it is probably best to simply disable logging entirely when building for the dongle. 

    Either you can use a separate sdk_config.h file for your dongle build, or you can move the NRF_LOG_ENABLED define from sdk_config.h to your project settings, so that you can define this separately for the two different build targets. 

    Best regards
    Torbjørn

Children
No Data
Related