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

How to completely turn off debugging and logging

I am using the ble_peripheral template that comes in Nordic SDK 8.1. I setup uart logging and also debugging with the following lines of code:

void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name)
{
    #define DEAD_BEEF                       0xDEADBEEF                                  /**< Value used as error code on stack dump, can be used to identify stack location on stack unwind. */
    app_error_handler(DEAD_BEEF, line_num, p_file_name);
}

void uart_error_handle(app_uart_evt_t * p_event)
{
    if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR)
    {
        APP_ERROR_HANDLER(p_event->data.error_communication);
    }
    else if (p_event->evt_type == APP_UART_FIFO_ERROR)
    {
        APP_ERROR_HANDLER(p_event->data.error_code);
    }
}

/**@brief Function for initializing the UART.
 */
void uart_init(void)
{
  #define UART_TX_BUF_SIZE           256                                /**< UART TX buffer size. */
  #define UART_RX_BUF_SIZE           1                                  /**< UART RX buffer size. */

    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
       {
           RX_PIN_NUMBER,
           TX_PIN_NUMBER,
           RTS_PIN_NUMBER,
           CTS_PIN_NUMBER,
           APP_UART_FLOW_CONTROL_DISABLED,
           false,
           UART_BAUDRATE_BAUDRATE_Baud38400,
       };
    APP_UART_FIFO_INIT(&comm_params,
                          UART_RX_BUF_SIZE,
                          UART_TX_BUF_SIZE,
                          uart_error_handle,
                          APP_IRQ_PRIORITY_LOW,
                          err_code);
    APP_ERROR_CHECK(err_code);
    app_trace_init();
}

Now I need to know how I would go about completely turning off debugging, error logging, uart logging, and anything else in that nature that doesn't need to be on for code that is launched on the device.

Related