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

Compare sdk_config files

Hi!

What is the easiest way to compare two sdk_config files? Some tools, etc. Why do I need it:

  1. My idea is to use "$NRF_SDK/config/nrf52840/config/sdk_config.h" as base config and don't change it. All changed parameters ("diff") put into "app_config.h". Usually it's not a lot of changes compared to the base configuration, but if i need to see it in "modified" (compared to the base) sdk_config - it's very hard. Now I have projects with "modified" sdk_config files, I want to get "diff". 
  2. It would be useful for sdk examples to see "diff".

I hope my explanation is understandable. Thanks for answers and suggestions in advance.

  • I wrote simple npm package, which could be used in command line

    https://github.com/lybrus/nrf-config-diff-cli

    For blinky_freertos (in $NRF_SDK/examples/peripheral/blinky_freertos/pca10056/blank/config/) it creates file with content:

    /* Generated by nrf-config-diff-cli */
    
    #ifndef APP_CONFIG_H__
    #define APP_CONFIG_H__
    
    #define USE_APP_CONFIG
    
    /* Changed variables */
    #define GPIOTE_ENABLED 1
    #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4
    #define NRFX_CLOCK_ENABLED 1
    #define NRFX_GPIOTE_ENABLED 1
    #define NRF_CLOCK_ENABLED 1
    #define APP_TIMER_ENABLED 1
    #define BUTTON_ENABLED 1
    
    #endif // APP_CONFIG_H__

  • Currently it works only with $NRF_SDK/config/nrf52840/config/sdk_config.h as base configuration.
    It's not complete configuration, if somebody suggest another one - great.

    Any improvements are welcome. Also share your experience from the topic.

  • I continue to work on it. Trying to make complete config.

    First step - find all definitions.

    Second - default values.

    Third - add definitions to sdk_config.h to correct sections.

    1. I parsed all sdk_config.h from examples, made full list of definitions.
    2. I parsed all /config/**/config/sdk_config.h, made full list of know definition.
    3. Calculate all unknown definition. Total 585.
    4. and tried to find them in SDK folder except 'examples' (grep -Rlwn [defintion] $NRF_SDK --exclude-dir=examples). Some of definitions like '_ENABLED' ended weren't found, I added to search this definition without this ending. Total 374.
    5. Looked into all found definitions, there are seem a lot of trash.

    I have assumption, that all sdk libraries must contain '[library_name]_ENABLED' definition. Is it correct? If it's true, I can found all libraries by 'library_name', and left definitions which starts with found 'library_name's.

    Regarding second and third step - I don't have any ideas.

  • Suddenly, using app_config with diff and replacing sdk_config with base config dosn't work Disappointed

    It's some definitions in base config ($NRF_SDK/config/nrf52840/config/sdk_config.h) aren't neutral. And I have Fourth step, to make it neutral.

  • Hello, your question seems to lack answers so here is a bit of moral support from Ray. First, I have just been trying to do the same for my project i.e. use "$NRF_SDK/config/nrf52840/config/sdk_config.h" and provide an "app_config.h" to enable the parts of the SDK that I actually need. I previously simply edited an existing sdk_config.h and placed that in the include tree before all the others. I wanted to change to what you propose because, for professonal development, copying huge chunks of an SDK and modifying them for your project is not a good idea since Nordic might decide to change things in the sdk_config.h original thereby making it tricky to upgrade to new versions of the SDK.

    Like you in my case it fails to work and, as far as I can tell, can never work. I will try to explain why but first I will try to help you with what I think is a question you asked.

    You don't say what OS you  are using for development, but you seem to have access to diff which is OK but tough to use for looking for reasons for failure. I think that you are asking what better tool to use for text comparisons. I am developing on Windows 10 and normally use a paid-for tool, UltraCompare, part of the Ultraedit package. If you are using linux, I have used Kompare previously which is a gui file compare system which shows two files side by side and easy to see differences. It is part of KDE but can be used on other distributions if you install it.

    If you are developing on Windows 10 then it is possible to install the Linux subsystem, install Kompare and an X server - it runs although it will show an error in the console. Tell me if file comparison is still a problem for you.

    I will explain why app_config.h fails to work in my application and why it can never work (I think) in another answer to your original question.

Related