NRF Connect - Build configuration can't find overlay file

- nrf52840

- NCS v2.4.1

- Windows 10

- nRF Connect for VS Code v2023.9.169

Hi,

This may be a bug with the new version of NRF Connect for VScode (September 2023) or maybe I am doing something wrong. I have been using build configurations for a while now, and only after the update is when I noticed my problem. Everything seems to work OK except that I get an error that the build process can't find the DTS overlay file. The process goes like this:

1. I make / use a build configuration as shown below with an intended overlay file

2. The build fails because it can't find the file. (You will have to take my word that the file is definitely where this is looking. I haven't changed anything in regards to verlay files in a while, and until this new September 2023 release it had worked fine and always found the overlay.

-- Found devicetree overlay: /boards/overlay/bpx_vmx/optix_bpx_vmx.overlay
<command-line>: fatal error: /boards/overlay/bpx_vmx/optix_bpx_vmx.overlay: No such file or directory
compilation terminated.

3. When I try to build again, it seems like it totally ignores the overlay (the command fragment to look for an overlay goes away). If I go to edit the build configuration I can see the overlay files section is now empty so it must have been automatically removed.

4. If I go to edit build configuration and re-add the overlay file then it finally builds correctly. But the next time I add that build configuration I have to repeat this process.

I've also tried re-making the build configurations from scratch. It works The first time and will continue to build, but if you try to save that preset and use it then the behavior is the same as above. So, it seems like the issue is only affecting saved configurations (loaded from CMakePresets.json) and does not affect newly-made configurations (which have not been loaded from CMakePresets.json).

Thanks for any help, hopefully I'm just doing something silly.

Parents
  • Hi,

    Which version of the VS Code do you have?

    Have you observed the same behavior when using nrf52840 development kit?

    Best regards,
    Dejan

  • For VS Code:

    Version: 1.82.2 (user setup)
    Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d
    Date: 2023-09-14T05:55:25.390Z
    Electron: 25.8.1
    ElectronBuildId: 23779380
    Chromium: 114.0.5735.289
    Node.js: 18.15.0
    V8: 11.4.183.29-electron.0
    OS: Windows_NT x64 10.0.19045

    And yes, I'm getting the same behavior with the DK. As an example, I used the littlefs sample application. In summary, the Devicetree overlays are not being found only when I try to use a saved preset to make a build.

    1. I changed the name of the overlay file so that the build systemp wouldn't automatically use them. "nrf52840dk_nrf52840_qspi.overlay" renamed to "my_qspi.overlay".

    2. Added a build configuration that included the desired overlay and config files.

    3. Build is successful and it finds the overlay file.

    4. Save configuration as a preset.

    5. Remove build configuration.

    6. Add new build configuration, selecting the new saved preset as the CMake preset and build the configuration.

    7. Can't build; doesn't find the overlay file.

    -- Found devicetree overlay: /boards/my_qspi.overlay
    <command-line>: fatal error: /boards/my_qspi.overlay: No such file or directory
    compilation terminated.

    8. Trying a pristine build again, it removes the overlay file from the configuration so it is not included.

    9. It works again if I manually add the overlay file back again every time I used the saved preset as a template.

  • Also, here is the exact project I'm using which is the littlefs example. This includes my saved preset in CMakePresets.json.littlefs_overlay_test.zip

  • Hi,

    I have tested your project. Using your initial Preset there seemed to be overlay file missing during build process and build failed. When I manually edited your configuration by removing existing location of the overlay file (for me this field was not empty), browsed for its location and added it again I could successfully build your project. Making builds from the same Preset always resulted in failing builds. After manually adding the same path to the overlay file, build failed again (I had 2 lines to the same file). For resolving this issue, a path loaded from the preset needed to be removed or a change was required in CMakePresets.json file. When I replaced 

    "DTC_OVERLAY_FILE": "${sourceDir}/boards\\my_qspi.overlay"

    with
    "DTC_OVERLAY_FILE": "boards\\my_qspi.overlay"

    building problem disappeared and build was successful. However, after saving successful build configuration as preset and loading it again when creating new configuration, the same line containing sourceDir came back and building failed again. The same above-mentioned change was required to build successfully. It seems that new build configuration was not populated correctly based on the desired template from CMakePresets,json..

    In summary, to be able to build successfully, every time I loaded configuration from Preset, I needed to either manually change the line containing ${sourceDir} or I could remove the overlay line completely and add it again which is the same as what you were doing.

    Could you try removing ${sourceDir}/ from your loaded Preset configuration and try to build? Is building process successful?

    Best regards,
    Dejan

  • This does seem to be the issue. Removing "${sourceDir}/ " from DTC_OVERLAY_FILE argument successfully finds and includes the overlay.

    It seems like the disconnect might be wherever the saved preset is used to construct the West command.

    in CMakePresets.json:

    "OVERLAY_CONFIG": "${sourceDir}/boards\\my_qspi.conf",
    "DTC_OVERLAY_FILE": "${sourceDir}/boards\\my_qspi.overlay"

    When saved, OVERLAY_CONFIG and DTC_OVERLAY_FILES both contain the "${sourceDir}/ " prefix. Even though they both contain that in the JSON, the resulting west command is:


    C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir
    c:/OPTIX_PRODUCTION/littlefs_overlay_test/build_2
    c:/OPTIX_PRODUCTION/littlefs_overlay_test --pristine --board
    nrf52840dk_nrf52840 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE"
    -DOVERLAY_CONFIG:STRING="boards/my_qspi.conf"
    -DDTC_OVERLAY_FILE:STRING="${sourceDir}/boards/my_qspi.overlay"
    -DBOARD_ROOT:STRING="c:/optix_production/littlefs_overlay_test""

    So it looks like when it's building the command, something already knows to strip the "${sourceDir}/ " prefix from OVERLAY_CONFIG but not DTC_OVERLAY_FILE.

    Thanks!

  • Hi,

    Thank you for the update.

    I have reported this issue internally.

    Best regards,
    Dejan

  • Hi,

    I hope that there are no further issues related to your initial issue or provided workaround.

    If you have any further questions, please let me know.

    Best regards,
    Dejan

Reply Children
No Data
Related