Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTS overlay files must include full path name #20576

Closed
pfl opened this issue Nov 11, 2019 · 4 comments · Fixed by #20578
Closed

DTS overlay files must include full path name #20576

pfl opened this issue Nov 11, 2019 · 4 comments · Fixed by #20578
Assignees
Labels
area: Build System area: Devicetree bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@pfl
Copy link
Collaborator

pfl commented Nov 11, 2019

CMake handles overlay files inconsistently. My sample directory contains an overlay file:
-rw-rw-r-- 1 pflykt pflykt 204 Nov 8 15:11 frdm_uart2_dts.overlay

But when I run cmake, cc1 does not find the DTS overlay file:

(samples_fona808)$ cmake -B build -GNinja -DBOARD=frdm_k64f -DDTC_OVERLAY_FILE=frdm_uart2_dts.overlay
Zephyr version: 2.0.99
-- Selected BOARD frdm_k64f
-- Found west: /home/pflykt/.local/bin/west (found suitable version "0.6.0", minimum required is "0.6.0")
-- Loading /home/pflykt/projects/zephyr/boards/arm/frdm_k64f/frdm_k64f.dts as base
-- Overlaying frdm_uart2_dts.overlay
cc1: fatal error: frdm_uart2_dts.overlay: No such file or directory
compilation terminated.
CMake Error at /home/pflykt/projects/zephyr/cmake/dts.cmake:128 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  /home/pflykt/projects/zephyr/cmake/app/boilerplate.cmake:460 (include)
  CMakeLists.txt:7 (include)

Adding the full path to the command succeeds:

samples_fona808)$ cmake -B build -GNinja -DBOARD=frdm_k64f -DDTC_OVERLAY_FILE=$(pwd)/frdm_uart2_dts.overlay
Zephyr version: 2.0.99
-- Selected BOARD frdm_k64f
-- Found west: /home/pflykt/.local/bin/west (found suitable version "0.6.0", minimum required is "0.6.0")
-- Loading /home/pflykt/projects/zephyr/boards/arm/frdm_k64f/frdm_k64f.dts as base
-- Overlaying /home/pflykt/projects/zephyr/samples/fona808/frdm_uart2_dts.overlay
Devicetree configuration written to /home/pflykt/projects/zephyr/samples/fona808/build/zephyr/include/generated/generated_dts_board.conf
Parsing Kconfig tree in /home/pflykt/projects/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/pflykt/projects/zephyr/boards/arm/frdm_k64f/frdm_k64f_defconfig'
...

The same thing happens when DTC_OVERLAY_FILE is defined in CMakeLists.txt.

Documentation in https://docs.zephyrproject.org/latest/application/index.html#devicetree-overlays is very quiet about including the full path name, and the above handling of DTS overlay files shows inconsistent behavior against project overlay files. All overlay files must be handled in a consistent manner, please fix.

@pfl pfl added the bug The issue is a bug, or the PR is fixing a bug label Nov 11, 2019
@SebastianBoe
Copy link
Collaborator

SebastianBoe commented Nov 11, 2019

CONF_FILE supports project-relative file paths so DTC_OVERLAY_FILE should too.

I see that Kconfig supports this by running kconfig with an appropriate working directory:

  WORKING_DIRECTORY ${APPLICATION_SOURCE_DIR}
  # The working directory is set to the app dir such that the user
  # can use relative paths in CONF_FILE, e.g. CONF_FILE=nrf5.conf

whereas DT uses the binary directory as the working directory.

WORKING_DIRECTORY ${PROJECT_BINARY_DIR}

if we could change the working directory for DT preprocessing without breaking backwards compatiblity or increasing the complexity significantly then we can be consistent with Kconfig and support this for DT as well.

@jefffhaynes
Copy link

This is still a problem

west build -b nrf52840dk_nrf52840 -p auto -- -DDTC_OVERLAY_FILE=./boards\nrf52840dk_nrf52840.overlay
-- west build: generating a build system
Including boilerplate (Zephyr base (cached)): C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr/cmake/app/boilerplate.cmake
-- Application: C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr/samples/sensor/fxos8700
-- Zephyr version: 2.5.99 (C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr)
-- Found west (found suitable version "0.10.1", minimum required is "0.7.1")
-- Board: nrf52840dk_nrf52840
-- Cache files will be written to: C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/gnu_arm_embedded)
-- Found BOARD.dts: C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Found devicetree overlay: ./boards/nrf52840dk_nrf52840.overlay
cc1.exe: fatal error: ./boards/nrf52840dk_nrf52840.overlay: No such file or directory
compilation terminated.
CMake Error at C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr/cmake/dts.cmake:157 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr/cmake/app/boilerplate.cmake:554 (include)
  C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  C:/Users/Jeff/Source/Repos/firmware-nrf52840-5340/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
  CMakeLists.txt:4 (find_package)

@skandaprasad
Copy link

@jefffhaynes
Can you please let me know if you found a solution for your issue about not finding the overlay file even though it exists?

@Michal-Pogorzelec
Copy link

The issue still exists - anyone know how to solve it?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: Devicetree bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants