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

Strange compile error for SDK12.30 +IAR

I am trying to print out a string debugging information. But got below error.

No problem change to printf or cast char array name to uint32_t. See first 2 sentence.

char data_array[BLE_NUS_MAX_DATA_LEN] = {0};

.

.

.
printf("---> %s\r\n",data_array);
NRF_LOG_DEBUG("---> %s\r\n",(uint32_t)data_array);


NRF_LOG_DEBUG("---> %s\r\n",data_array);

Error[Pe167]: argument of type "char *" is incompatible with parameter of type "uint32_t" C:\gxf\other\nRF5_SDK_12.3.0_d7731ad\examples\ble_central\EnforcerScanner\main.c 1004

Error while running C/C++ Compiler

Parents Reply Children
  • Hi Jorgen

    Thank you for your answer.

    Do you mean setting NRF_LOG_DEFERRED in sdk_config.h? No matter set it 0 or 1. same behaviour.

    // <e> NRF_LOG_DEFERRED - Enable deffered logger.
    // <i> Log data is buffered and can be processed in idle.
    //==========================================================
    #ifndef NRF_LOG_DEFERRED
    #define NRF_LOG_DEFERRED 0
    #endif
    #if  NRF_LOG_DEFERRED
    // <o> NRF_LOG_DEFERRED_BUFSIZE - Size of the buffer for logs in words.
    // <i> Must be power of 2
    #ifndef NRF_LOG_DEFERRED_BUFSIZE
    #define NRF_LOG_DEFERRED_BUFSIZE 1024//256
    #endif
  • I'm not sure it this limitation is relevant for deferred mode only, or if it is how the logger works in general:

    All arguments are treated as uint32_t. This results in the following:

    • When passing a pointer, the compiler will give a warning and the argument must be cast to uint32_t.

    You should anyway use nrf_log_push when using deferred mode, and/or cast the variable to uint32_t. This works fine right?

Related