This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using NRF_MODULE_ENABLED in Eclipse

I am using Eclipse for developing nRF52 software with SDK 13. Eclipse works great in indexing the SDK files and lets me move around quickly in the codebase. But I am searching for a way to let Eclipse create an index of all the library files. Right now Eclipse will not "see" the code in for example fds.c, as it starts with

#if NRF_MODULE_ENABLED(FDS)

I have tried defining FDS_ENABLED in the Eclipse project but I think it doesn't understand this special define construct:

#define NRF_MODULE_ENABLED(module) \
((defined(module ## _ENABLED) && (module ## _ENABLED)) ? 1 : 0)

Do you have any suggestions on this? My goal is to have all the libraries enabled at once so that I can let Eclipse parse through them.

  • Hi,

    We tested this and it seems to work on our end. As you can see below, Eclipse seems to be able to resolve NRF_MODULE_ENABLED(FDS) when FDS is enabled. image description

    What Eclipse version do you use? This is what we used: image description image description

  • I am using Mars, CDT 8.8.1.2....

    And now when I try reproducing my problem, of course it works.

    I think I know what I did wrong the first time: I only defined FDS_ENABLED without a value. Then I get a parser error from Eclipse. But If I define FDS_ENABLED as 1, it works. Ok, problem seems to be on my side.

    As a side note, I made a local modification to nordic_common.h:

    /* @note
    * If ECLIPSE_ALL_MODULES_ACTIVE is defined, activate all modules.
    */
    //lint -emacro(491,NRF_MODULE_ENABLED) // Suppers warning 491 "non-standard use of 
    'defined' preprocessor operator"
     #if (defined(ECLIPSE_ALL_MODULES_ACTIVE) && (ECLIPSE_ALL_MODULES_ACTIVE))
     #define NRF_MODULE_ENABLED(module) 1
     #else
     #define NRF_MODULE_ENABLED(module) \
         ((defined(module ## _ENABLED) && (module ## _ENABLED)) ? 1 : 0)
     #endif
    

    With this modification, I can enable all modules with one define. (Just to tell you about the real reason for this: I am using Eclipse only as an editor and then IAR as the actual compiler. This way, I want Eclipse to see all the code, not just the modules I have defined as used)

Related