Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

apply_old_config.h not working as expected?

Hi guys,

I'm currently using SDK 15.0.0 in Keil MDK and making use of the new NRFX drivers.

Similar to the issue detailed here: https://devzone.nordicsemi.com/f/nordic-q-a/34052/nrf52-sdk-15-0-issue-legacy-driver-layer-upgrade-to-new-nrfx-driver-layer, when I attempt to enable NRFX drivers, apply_old_config.h is overriding the behaviour and disabling them.

My assumption would have been that if I have the legacy driver enabled, it'll override the settings, but if it's not enabled, it shouldn't do anything, but that's not what's happening. For example, in my project I have:

#define UART_ENABLED 0
#define TWI_ENABLED 0

However the following statements when compiled, are coming out as true and overriding my settings (this is contrary to what Keil's clang code-completion thinks):

#if defined(UART_ENABLED)
#if defined(TWI_ENABLED)

I've found a temporary workaround of simply removing the defined() so:

#if UART_ENABLED
#if TWI_ENABLED

I think maybe apple_old_config.h needs revisiting in the next SDK to fix this issue or am I missing something?

Many thanks

Parents
  • I signed up just in the hopes of pointing out to someone at Nordic how terrible this is.

    I open the TWI header and I see this:

    #if NRFX_CHECK(NRFX_TWI0_ENABLED)
    NRFX_TWI0_INST_IDX,
    #endif

    So I -DNRFX_TWI0_ENABLED, then get build errors. Two hours and fifteen minutes later I realize another unrelated header is doing the following:

    #undef NRFX_TWI0_ENABLED
    #define NRFX_TWI0_ENABLED TWI0_ENABLED
    #undef NRFX_TWIM0_ENABLED
    #define NRFX_TWIM0_ENABLED 0

    I'm dumbfounded. I have professionally used and designed / implemented SDKs for things ranging from Graphics APIs to system / controller APIs, and I have never seen anything as terrible as this. 

    I want the two hours of my life back, and I want you to stop doing this. A header file is a contract, and breaking locality by having an unrelated header mess up my defines is a big no-no. Do not pass Go, do not collect $200. 

Reply
  • I signed up just in the hopes of pointing out to someone at Nordic how terrible this is.

    I open the TWI header and I see this:

    #if NRFX_CHECK(NRFX_TWI0_ENABLED)
    NRFX_TWI0_INST_IDX,
    #endif

    So I -DNRFX_TWI0_ENABLED, then get build errors. Two hours and fifteen minutes later I realize another unrelated header is doing the following:

    #undef NRFX_TWI0_ENABLED
    #define NRFX_TWI0_ENABLED TWI0_ENABLED
    #undef NRFX_TWIM0_ENABLED
    #define NRFX_TWIM0_ENABLED 0

    I'm dumbfounded. I have professionally used and designed / implemented SDKs for things ranging from Graphics APIs to system / controller APIs, and I have never seen anything as terrible as this. 

    I want the two hours of my life back, and I want you to stop doing this. A header file is a contract, and breaking locality by having an unrelated header mess up my defines is a big no-no. Do not pass Go, do not collect $200. 

Children
No Data
Related