Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Error when  i changed NRF_LOG_ENABLED from 0 to 1

Hi,

When i changed NRF_LOG_ENABLED from 0 to 1  in file sdk_config.h returns the following error

1> Linking tdoa_tag.elf
1> E:/gcc/arm-none-eabi/bin/ld: Output/Debug/Obj/tdoa_tag/app_error_weak.o: in function `app_error_fault_handler':
1> F:\VIVEK\Test Area\DWM1001C_TDoA_Tag\components\libraries\util/app_error_weak.c:59: undefined reference to `nrf_log_panic'
1> E:/gcc/arm-none-eabi/bin/ld: F:\VIVEK\Test Area\DWM1001C_TDoA_Tag\components\libraries\util/app_error_weak.c:59: undefined reference to `nrf_log_frontend_dequeue'
1> E:/gcc/arm-none-eabi/bin/ld: F:\VIVEK\Test Area\DWM1001C_TDoA_Tag\components\libraries\util/app_error_weak.c:77: undefined reference to `nrf_log_frontend_std_2'
1> E:/gcc/arm-none-eabi/bin/ld: F:\VIVEK\Test Area\DWM1001C_TDoA_Tag\components\libraries\util/app_error_weak.c:85: undefined reference to `nrf_log_frontend_std_5'
1> E:/gcc/arm-none-eabi/bin/ld: F:\VIVEK\Test Area\DWM1001C_TDoA_Tag\components\libraries\util/app_error_weak.c:91: undefined reference to `nrf_log_frontend_std_0'
1> E:/gcc/arm-none-eabi/bin/ld: F:\VIVEK\Test Area\DWM1001C_TDoA_Tag\components\libraries\util/app_error_weak.c:95: undefined reference to `nrf_log_frontend_std_1'
1> E:/gcc/arm-none-eabi/bin/ld: F:\VIVEK\Test Area\DWM1001C_TDoA_Tag\components\libraries\util/app_error_weak.c:109: undefined reference to `m_nrf_log_app_logs_data_const'
Build failed
  • Hi,

    Due to holidays we are short staffed, so please expect increased response time.

    Did you add the source and header files for the log module to your project?

    Best regards,

    Marte

  • my main.c  i added 

    \#include "nrf_log.h"
    #include "nrf_log_ctrl.h"
    #include "nrf_log_default_backends.h"

     APP_ERROR_CHECK(NRF_LOG_INIT(NULL));

     NRF_LOG_DEFAULT_BACKENDS_INIT();
    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_INFO("TWI scanner.\r\n");
     NRF_LOG_FLUSH();

    still error there , so i deleted these and build same error

  • Hi,

    You must also add the files to the project as well, and not just include them in main.c. What are you using to build the project? 

    For SES you must do the following:

    • Source files: Under the project name in the Project Explorer find the directory you want to add the source file to. Right click on the directory and select Add Existing File, and find the source file to add.
    • Include files: For this you must add the path to the include file in the preprocessor definitions. Right click on your project and select Edit Options Preprocessor User Include Directories and add the path to the directory containing the header file there. Please note that this must be the correct path seen from where the project file is located, with multiple ../ in front.

    For gcc:

    • Open the Makefile
    • Add the source file to SRC_FILES
    • Add the include folder to INC_FOLDERS

    Best regards,

    Marte

  • good, thats cleared all errors and warning .(SES). But Nothing showing in Debug Terminal . similar questions i found in this site tried still no output

    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf_delay.h"
    #include "nrf_log.h"
    #include "nrf_log_ctrl.h"
    #include "nrf_log_default_backends.h"
    
    int main(void)
    {
        /* Initializing Log */
        ret_code_t err_code;
        err_code = NRF_LOG_INIT(NULL);
        NRF_LOG_DEFAULT_BACKENDS_INIT();
    
        while (true)
        {
            for (int i = 0; i < 5; i++)
            {
                NRF_LOG_INFO("BLINK");
                nrf_delay_ms(500);
            }
        }
    }

  • Hi,

    Have you enabled the following in sdk_config.h as well?

    • Log backend, either UART (NRF_LOG_BACKEND_UART_ENABLED) or RTT (NRF_LOG_BACKEND_RTT_ENABLED)
    • NRF_LOG_DEFAULT_LEVEL, this should be set to 3 for INFO

    Does NRF_LOG_INIT return NRF_SUCCESS or an error code? You can check by adding the following line after calling the init:

    APP_ERROR_CHECK(err_code);

    Best regards,

    Marte

Related