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

Code optimization for release

I use many SEGGER_RTT_WriteString and SEGGER_RTT_printf sprinkled throughout my code which was very helpful for debugging and monitoring, however, we're getting close to releasing code for product release and I was wondering if these SEGGER_RTT statements are still being executed when not running the debugger. If so, is there a way to turn them off without having to make an sdk_config.h change?

Parents
  • Hi,

    These functions are implemented by Segger, and you can see the source in external\segger_rtt in the SDK directory. The code inside the functions will be executed even if the debugger is not attached. The strings will be placed into the RTT buffer until this is full, and then block, trim, or skip the data until the buffer is read by a RTT viewer.

    If you are using these APIs directly, I do not think there is any way to disable in through sdk_config.h changes, as there is no configs to remove the code from the functions. We do have this option if you use the RTT backend for NRF_LOG.

    The only option I can think of is for you to add #if cases around each call to these functions, and define a symbol to enable/disable the inclusion of the function calls.

    Best regards,
    Jørgen

Reply
  • Hi,

    These functions are implemented by Segger, and you can see the source in external\segger_rtt in the SDK directory. The code inside the functions will be executed even if the debugger is not attached. The strings will be placed into the RTT buffer until this is full, and then block, trim, or skip the data until the buffer is read by a RTT viewer.

    If you are using these APIs directly, I do not think there is any way to disable in through sdk_config.h changes, as there is no configs to remove the code from the functions. We do have this option if you use the RTT backend for NRF_LOG.

    The only option I can think of is for you to add #if cases around each call to these functions, and define a symbol to enable/disable the inclusion of the function calls.

    Best regards,
    Jørgen

Children
Related