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

#if defined(SOFTDEVICE_PRESENT) && SOFTDEVICE_PRESENT

Hello,

I am not using the latest SDK, but it seems this has not changed (to be checked…). In file ./components/libraries/util/app_error_weak.c I have this sort of code: 

#if defined(SOFTDEVICE_PRESENT) && SOFTDEVICE_PRESENT

   some code specific to case with SoftDevice

#endif

In the rest of the SDK, this is just like this: 

#ifdef SOFTDEVICE_PRESENT

   some code specific to case with SoftDevice

#endif

OK, when you pass SOFTDEVICE_PRESENT from the command line like this:

arm-none-eabi-gcc -DSOFTDEVICE_PRESENT ...

this does not make a difference, because actually this will be equivalent to:

#define SOFTDEVICE_PRESENT 1

but if ever you would make the setting in the sdk_config.h file like this:

#define SOFTDEVICE_PRESENT /* empty */

then there would be some compilation error « error: operator '&&' has no right operand »

So, my question is the following : is there some trick ? Do you want to force SOFTDEVICE_PRESENT to be defined, if ever, always as 1 ? And is there some use to do -DSOFTDEVICE_PRESENT=0, so to unselect only the app_error_weak.c stuff, but not the others.

Parents Reply Children
Related