How do I add another board and .conf file to an existing project?

I have been working with some code for a nrf5340 DK and now want to add a custom board to the project as an additional build configuration, but I need to now pull out configurations which are set in the prj.conf as they conflict. For example the dk uses a st7789 display and the custom board uses a gc9a01. In my prj.conf I have CONFIG_ST7789V=y which now should not be in the prj.conf but a specific conf for the configured DK.

I had the dk overlay in the root directory. Do I create another directory under boards for my specific configuration of the DK and create a .conf file for it? Will that make it get automatically picked up? Since it's a nrf5340 dk, should I name the directory something else as not to conflict with the existing structure? By naming the conf file the same as the overlay (just different extension, conf vs overlay) does that mean it will get picked up? 
By putting the overlay in a different directory and referencing it in the build, does zephry know to look for a corresponding conf file automatically? 

This might be simple, but I haven't found a good explanation of this specific process which a novice like me could consume.

I'm using vs code and nrf connect (2.6) and zephyr.

  • Hello,

    I am not sure if I understand you correctly, but you can create a project structure that includes different build configurations for each board. Something like below will be a project structure for two different boards:

    project_folder
        - board_1
            - inc
                - *.h files
            - src
                -*.c files (including main.c)
            - CMakeLists.txt
            - board_1.overlay
            - prj.conf
        - board_2
            - inc
                - *.h files
            - src
                -*.c files (including main.c)
            - CMakeLists.txt
            - board_2.overlay
            - prj.conf
        - CMakeLists.txt
        - KConfig
        - prj.conf

    In this structure, each board has its own directory with its own source files, header files, CMakeLists.txt, overlay file, and configuration file. The overlay file allows you to specify different settings for each build. You can specify which overlay file to use during the build configuration process using the -DDTS_OVERLAY_FILE argument. See the section on configuration files, which discusses selecting different configuration and overlay files. See the below devzone threads.

    https://devzone.nordicsemi.com/support-private/support/301462

    https://devzone.nordicsemi.com/support-private/support/305501

    Kind Regards,

    Abhijith

Related