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

NCS SDK: Devicetree overlay not recognized since v1.8.0

Hello everyone,

I am working on a project based on nRF Connect SDK v1.7.1 that I want to move to the new SDK v1.8.0. But I'm experiencing problems when building the project. It seems like CMake is no longer recognizing the devicetree overlay that I created for the nrf52840dk_nrf52840 development kit in the boards directory. I can workaround this by manually adding the CMake option -DTC_OVERLAY_FILE=file.overlay.

According to the Zephyr documentation this overlay should still be included by CMake. (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/guides/dts/howtos.html#set-devicetree-overlays)

Is this a bug or has something changed in the SDK that I didn't catch that could cause this behaviour?

My project structure looks like this:

CMakeLists.txt
Kconfig
boards:
  -> nrf52840dk_nrf52840.overlay
configuration:
  -> nrf52840dk_nrf52840:
       -> prj.conf
       -> prj_release.conf
src:
  -> main.c
  -> modules:
       -> CMakeLists.txt
       -> Kconfig
       -> module.c
  -> events:
       -> CMakeLists.txt
       -> event.c
       -> event.h
       -> Kconfig

Thanks in advance!
    

  • Hi,

    Do you experience the same problem if the overlay file is placed one level up, at the same level as the Kconfig and CMakeLists.txt files?

  • Thanks for your reply!

    I thought I tried this already but apparently I didn't because this way it works and CMake finds the overlay file.

    But why is the boards folder no longer searched by CMake?

  • Does it work if you put the overlay file in the "configuration" folder?

    Could I see your CMakeLists.txt file?

  • When the overlay file is put in the "configuration" folder it is not working.

    This is my CMakeLists.txt:

    #
    # Copyright (c) 2018 - 2019 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    cmake_minimum_required(VERSION 3.20.0)
    
    
    if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}")
      message(FATAL_ERROR
              "Board ${BOARD} is not supported.\n"
              "Please make sure board specific configuration files are added to "
              "${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}")
    endif()
    
    ################################################################################
    
    # The application uses the configuration/<board> scheme for configuration files.
    set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}")
    
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project("Custom application"
            VERSION 0.2.0)
    
    configure_file(src/VersionInfo.h.in VersionInfo.h)
    target_include_directories(app PRIVATE ${PROJECT_BINARY_DIR})
    
    ################################################################################
    
    # NORDIC SDK APP START
    target_sources(app PRIVATE
      src/main.c
      )
    # NORDIC SDK APP END
    
    # Include application events and configuration headers
    zephyr_library_include_directories(
      src/events
      )
    
    zephyr_include_directories(
      configuration/${BOARD}
      )
    
    # Application sources
    add_subdirectory(src/events)
    add_subdirectory(src/modules)
    
    if(CONFIG_BOOTLOADER_MCUBOOT)
      assert_exists(mcuboot_CONF_FILE)
    endif()
    

  • There's the issue.

    There were some changes in v1.8.0: https://github.com/nrfconnect/sdk-zephyr/commit/3e0eb0b7b43da60f528a38a10ada78c49d5848e6

    Most importantly in this case:

    -zephyr_file(CONF_FILES ${APPLICATION_SOURCE_DIR}/boards DTS APP_BOARD_DTS)
    +zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/boards DTS APP_BOARD_DTS)

    By default APPLICATION_CONFIG_DIR is the project folder, but you are overwriting it to be configuration/${BOARD}, so it is looking for an overlay file in configuration/${BOARD}/boards/

    You can put the overlay file in configuration/nrf52840dk_nrf52840/ , next to the .conf files, and you should be good to go.

Related