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

Error to use variables and structures into nrf_log_internal.h file

I am trying add the fatfs example in my custom solution and I have the follow error after add the paths and files.

nrf_log_frontend.c:92:35: error: unknown type name 'nrf_log_module_dynamic_data_t'

I am trying use variables and strutuctures that are in nrf_log_internal.h but the Segger tell me that the types and variables declared in this file doenst exists. I dont know if I forgot to set any flag into sdk_config.h

Ps. I already added the path to the file where is declared the "nrf_log_module_dynamic_data_t" variable.

  • In the case above I commented  the line that was wrong and the segger show me a new error.

    #define NRF_LOG_MODULE_NAME balloc

    I dont have idea how I can to fix it, so I changed the target and tryed to import the app_sdcard library and after to add the files and directories about this library I have the follow error

    #define NRF_LOG_MODULE_NAME spi

    The errors are similars so I think that this must have the same reason

  • I assume you have added the header files the right way (Project -> Options for Target ... -> C/C++ in Keil or Project-> Edit Options->Preprocessor->User Include Dir.. in Segger).

    I was able to add the FATFs example into the template_project provided by the sdk, but I wasn't able to recreate the error you got. I couldn't figure out how the sdk_config.h file would cause this either. Could you attach your sdk_config file?

  • Hi Simon,

    I added the path to header path the right way, I resolved the first problems this way.

    In my project I created a folder and added all files associed. Furthermore, I created a file called sdc_write and in this, I put the fatfs_example function. I created also a header file that contains all dependences and variables declared.

    In my main file, I added the #include "sdc_write.h" and called the fatfs_example function

    After these stepes I resolved the problems about references (paths and C files).

    Now I have the follow output:

    components\libraries\balloc\nrf_balloc.c:46:29: error: 'balloc' undeclared (first use in this function)
    3> ../../../log/nrf_log_internal.h:106:34: note: in definition of macro 'LOG_INTERNAL_2'
    3> ../../../log/nrf_log_internal.h:117:41: note: in expansion of macro 'LOG_INTERNAL_X'
    3> ../../../log/nrf_log_internal.h:185:9: note: in expansion of macro 'LOG_INTERNAL'
    3> ../../../log/nrf_log_internal.h:125:53: note: in expansion of macro 'NRF_LOG_MODULE_NAME'
    3> ../../../log/nrf_log_internal.h:185:43: note: in expansion of macro 'LOG_DEBUG_PREFIX'
    3> ../../../log/nrf_log.h:130:48: note: in expansion of macro 'NRF_LOG_INTERNAL_DEBUG'
    3> \components\libraries\balloc\nrf_balloc.c:275:5: note: in expansion of macro 'NRF_LOG_DEBUG'
    3> ../../../log/nrf_log_internal.h:120:28: error: expected ')' before string constant
    3> ../../../log/nrf_log_internal.h:106:34: note: in definition of macro 'LOG_INTERNAL_2'
    3> ../../../log/nrf_log_internal.h:117:41: note: in expansion of macro 'LOG_INTERNAL_X'
    3> ../../../log/nrf_log_internal.h:185:9: note: in expansion of macro 'LOG_INTERNAL'
    3> ../../../log/nrf_log_internal.h:125:73: note: in expansion of macro 'NRF_LOG_BREAK'
    3> ../../../log/nrf_log_internal.h:185:43: note: in expansion of macro 'LOG_DEBUG_PREFIX'
    3> ../../../log/nrf_log.h:130:48: note: in expansion of macro 'NRF_LOG_INTERNAL_DEBUG'
    3> components\libraries\balloc\nrf_balloc.c:275:5: note: in expansion of macro 'NRF_LOG_DEBUG'
    3> ../../../log/nrf_log_internal.h:106:5: error: too few arguments to function 'nrf_log_frontend_std_2'
    3> ../../../external/nRF5_SDK_14.2.0_17b948a/components/libraries/util/nordic_common.h:114:31: note: in expansion of macro 'LOG_INTERNAL_2'
    3> ../../../external/nRF5_SDK_14.2.0_17b948a/components/libraries/util/nordic_common.h:112:31: note: in expansion of macro 'CONCAT_2_'
    3> ../../../log/nrf_log_internal.h:116:41: note: in expansion of macro 'CONCAT_2'
    3> ../../../log/nrf_log_internal.h:117:41: note: in expansion of macro 'LOG_INTERNAL_X'
    3> ../../../log/nrf_log_internal.h:185:9: note: in expansion of macro 'LOG_INTERNAL'
    3> ../../../log/nrf_log.h:130:48: note: in expansion of macro 'NRF_LOG_INTERNAL_DEBUG'
    3> components\libraries\balloc\nrf_balloc.c:275:5: note: in expansion of macro 'NRF_LOG_DEBUG'
    3> ../../../log/nrf_log_internal.h:226:6: note: declared here
    Build failed

    And still the segger show that balloc (nrf_balloc.c:46) is undeclared.


    I am attaching the sdk_config file.

    0447.sdk_config.h

  • It is difficult to figure out what causes the error when not having the code, but I have attached the code where I integrated the FATFs example into the template project, and you can further build your solution upon that.

    template_project.7z

    Best regards Simon

  • Hi Simon,

    I tryed to insert the fatfs example into blink example (SDK 14.2) and it works!

    Now, I am to insert the fatfs examplo into light switch (SDK Mesh) and I have the same problem.

    In nrf_drv_spi file the segger show that (#define NRF_LOG_MODULE_NAME spi) the spi variable is undeclared.

    Is there any particularity in the SDK that prevent I insert the fatfs example?

Related