Compilation dependencies on which board type (in CMakeList.txt and/or prj.conf)

I have a project that has two different types of custom boards. I have created board support packages for each. Is there a way to include different kconfigs in the CMakeLists.txt ? For instance I have the following in my CMakeLists.txt file:

If the build is for board A, it would contain the line:

#list(APPEND EXTRA_CONF_FILE "boardA.conf")
If the build is for board B, it would contain the line:
#list(APPEND EXTRA_CONF_FILE "boardB.conf")
How about a similar condition in the prj.conf ?
Parents
  • Hi,

    In our board files we have a Kconfig.board file, which contains something like:

    config BOARD_NRF52833DK_NRF52833
    	bool "NRF52833 DK NRF52833"
    	depends on SOC_NRF52833_QIAA
    

    There is also a <board>_defconfig file, in this case nrf52833dk_nrf52833_defconfig, which among other configs contains:

    CONFIG_SOC_SERIES_NRF52X=y
    CONFIG_SOC_NRF52833_QIAA=y
    CONFIG_BOARD_NRF52833DK_NRF52833=y

    If your custom boards are set up in this way also, you can use if(), elseif() and endif() to only include the desired line:

    if (CONFIG_BOARD_A)
        list(APPEND EXTRA_CONF_FILE "boardA.conf")
    elseif(CONFIG_BOARD_B)
        list(APPEND EXTRA_CONF_FILE "boardB.conf")
    endif()

    Hope that helps

Reply
  • Hi,

    In our board files we have a Kconfig.board file, which contains something like:

    config BOARD_NRF52833DK_NRF52833
    	bool "NRF52833 DK NRF52833"
    	depends on SOC_NRF52833_QIAA
    

    There is also a <board>_defconfig file, in this case nrf52833dk_nrf52833_defconfig, which among other configs contains:

    CONFIG_SOC_SERIES_NRF52X=y
    CONFIG_SOC_NRF52833_QIAA=y
    CONFIG_BOARD_NRF52833DK_NRF52833=y

    If your custom boards are set up in this way also, you can use if(), elseif() and endif() to only include the desired line:

    if (CONFIG_BOARD_A)
        list(APPEND EXTRA_CONF_FILE "boardA.conf")
    elseif(CONFIG_BOARD_B)
        list(APPEND EXTRA_CONF_FILE "boardB.conf")
    endif()

    Hope that helps

Children
Related