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

Kconfig and prj.conf question

Hi,

I was looking at this page https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html and saw the following line:

"When building your application, the different Kconfig and *_defconfig files and the prj.conf file are merged together."

When the files are merged together, which of the three files are prioritized?

 

How do you decide which variables are put into Kconfig and which are put into prj.conf?

Thanks

Parents
  • Hi, according to my experience working with zephyr, the priority from lowest to highest is as follows (configs in lower priority files will be overwritten by the higher ones):

    Kconfig -> *_defconfig ->prj.conf

    If we read the build log, we can see that sequence above is exactly the appearing sequence of those files when compiling built binaries. (Kconfig files are read firstly, then the *_defconfig, then the prj.conf)

    I think it would be helpful when we also understand the purpose of each file:

    - Kconfig: config definitions (default values may be given, however, is optional) - we can not redefine configs here if they are defined somewhere else.

    - *_defconfig: default configs - we assign the default config values for our new hardware platform in this file.

    - prj.conf: application configs - we assign the config values for our application, which contain the main function.

Reply
  • Hi, according to my experience working with zephyr, the priority from lowest to highest is as follows (configs in lower priority files will be overwritten by the higher ones):

    Kconfig -> *_defconfig ->prj.conf

    If we read the build log, we can see that sequence above is exactly the appearing sequence of those files when compiling built binaries. (Kconfig files are read firstly, then the *_defconfig, then the prj.conf)

    I think it would be helpful when we also understand the purpose of each file:

    - Kconfig: config definitions (default values may be given, however, is optional) - we can not redefine configs here if they are defined somewhere else.

    - *_defconfig: default configs - we assign the default config values for our new hardware platform in this file.

    - prj.conf: application configs - we assign the config values for our application, which contain the main function.

Children
Related