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

The sdk_config.h file is not being parsed by the compiler

I cannot get the scope of the sdk_config.h file to encompass all modules. Process

  • Start with example project using the file system as per the install.
  • After compiling and running on the DK, copy the example files over to a new folder for inclusion into revision control.
  • Edit the project file to make sure the relative paths have been properly modified to reflect the new project folder
  • Make sure the project still compiles and runs.
  • Make an edit that includes a new module, in this case the TWIM
  • dutifully edit the sdk_config.h file to enable the TWIM module
  • Compiler error in main at this line: static const nrfx_twim_t twi0 = NRFX_TWIM_INSTANCE(TWI_INSTANCE_ID);
  • When expanding the macro the compiler cannot find a definition for "NRFX_TWIM0_INST_IDX" because it is not enumerated in nrfx_twim.h because NRFX_TWIM0_ENABLED is not defined
  • Go back and check the nrf_config.h file and it is indeed enabled.
  • Find out that disabling other modules in the nrf_config.h file doesn't have an effect, ergo the nrf_config.h file is not being used.
  • To make sure the pathways are not pointing to another version, disable (rename) all other nrf_config.h files in the file system - no effect.
  • Explicitly define NRFX_TWIM0_ENABLED in nrfx_twim.h and everything compiles fine.
  • make a test header file with just that line and include it in main - no effect.
  • include that same test header file in nrfx_twim.h file, everything compiles fine
  • remove the test include and include the sdk_config.h file in the nrfx_twim.h file, compile fails again

What on earth is going on? I've searched up and down the project settings thinking that the config file is disabled somehow, but nothing. 

Parents
  • OK, commenting the TWI_PRESENT line in the file nrf52840_peripherals.h did the trick. so help me understand what your rationale is behind having these compiler directives scattered all over the SDK? I would be nice, I think, if the local sdk_config.h were the ONE place where we could go to figure out what's being compiled and what's not, because there's no easy way to track these down. For future reference am I expected to go to nrf52840_peripherals.h and update those settings as well? And also for future edification, please list ALL the files where these directives and overrides can be found - I now know of sdk_config.h, nrfx_config.h, nrf52840_peripherals.h - are there others? It would also be nice to list all the places in the SES settings where these directives can be found as well, and what all the path macros and presets mean. This information would be golden and in this case could have saved me a couple days worth of frustration. Thanks.

    Tony

  • I'm sorry to hear that. It's unfortunate that you had spend this much time to resolve the issue.  sdk_config.h is indeed supposed to be the one place where you configure the SDK modules. nrf52840_peripherals.h is a part of our MDK distribution which specifies what peripherals the 52840 has. It should never have to be modified. Maybe the TWI0_USE_EASY_DMA option was disabled earlier? That would make the integration layer enable the TWI driver (without the 'M') instead of TWIM with EasyDMA.

    You should include the nrfx_config.h file from \integration\nrfx\ when you use nrfx with the nRF5 SDK.

  • OK, that worked as well - enabling the TWI0_USE_EASY_DMA option allowed me to undo the change to the nrf5284_peripherals.h file. That is very counter-intuitive - why? Perhaps what's needed is better inline documentation in the sdk_config.h file?

  • I just noticed that disabling TWI1_USE_EASY_DMA doesn't do the same thing...

Reply Children
No Data
Related