Probable bug in Zephyr builds when using overlay files

Sysprogs forums Forums VisualGDB Probable bug in Zephyr builds when using overlay files

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #32200
    MrZANE
    Participant

    Hi
    When compiling zephyr projects based on nRFConnect, but with added overlay files, the compile always fails.
    This seems to be due to the filepath for the overlay file added(in the VisualGDB project properties/NRFConnect Project/Hardware Configuration/Device tree overlay files) isn’t converted to unix style so the compiler reacts badly to the various folder seperators (\)  which it views as an escape character and the character following that.
    See bold text further down in the output.
    I’ve tried putting the overlay file directly in the project directory so I don’t need any paths in the settings but path seems automatically be added.

    Would be grateful for quick help as this is currently hindering us from continuing on with our project.

    Kind regards
    Jimmy

     

    Running CMake: C:\Users\UserName\AppData\Local\VisualGDB\CMake\bin\cmake.exe ../../.. -G “Ninja” -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_MAKE_PROGRAM=”C:/Program Files (x86)/Sysprogs/VisualGDB/ninja.exe” -DBOARD=nrf52840dk_nrf52840 -DDTC_OVERLAY_FILE=C:\Users\UserName\source\repos\Zephyr-Overlaytest\Zephyr-Overlaytest\Test.overlay
    Including boilerplate (Zephyr base (cached)): C:/NRFConnectSDK/v1.8.0/zephyr/cmake/app/boilerplate.cmake
    — Application: C:/Users/UserName/source/repos/Zephyr-Overlaytest/Zephyr-Overlaytest
    — Zephyr version: 2.7.0 (C:/NRFConnectSDK/v1.8.0/zephyr), build: v2.7.0-ncs1
    — Found west (found suitable version “0.12.0”, minimum required is “0.7.1”)
    — Board: nrf52840dk_nrf52840
    — Cache files will be written to: C:/NRFConnectSDK/v1.8.0/zephyr/.cache
    — Found toolchain: gnuarmemb (c:/sysgcc/arm-eabi)
    — Configuring incomplete, errors occurred!
    CMake Error at C:/NRFConnectSDK/v1.8.0/zephyr/cmake/dts.cmake:2147483647 (zephyr_variable_set_too_late):
    Syntax error in cmake code at

    C:/NRFConnectSDK/v1.8.0/zephyr/cmake/dts.cmake:2147483647

    when parsing string

    C:\Users\UserName\source\repos\Zephyr-Overlaytest\Zephyr-Overlaytest\Test.overlay

    Invalid character escape ‘\U’.
    Call Stack (most recent call first):
    C:/NRFConnectSDK/v1.8.0/zephyr/cmake/dts.cmake:69 (if)
    C:/NRFConnectSDK/v1.8.0/zephyr/cmake/app/boilerplate.cmake:545 (include)
    C:/NRFConnectSDK/v1.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    C:/NRFConnectSDK/v1.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:8 (find_package)

    See also “C:/Users/UserName/source/repos/Zephyr-Overlaytest/Zephyr-Overlaytest/build/nrf52840dk_nrf52840/Debug/CMakeFiles/CMakeOutput.log”.
    See also “C:/Users/UserName/source/repos/Zephyr-Overlaytest/Zephyr-Overlaytest/build/nrf52840dk_nrf52840/Debug/CMakeFiles/CMakeError.log”.
    CMake Error: Error in cmake code at
    Unknown:0:
    A command failed during the invocation of callback “zephyr_variable_set_too_late”.

    ========== Project Configuration Summary ==========
    Zephyr-Overlaytest configured in 00:02
    ========== Configuration: 1 Succeeded, 0 Failed, 0 Skipped ==========

    #32201
    support
    Keymaster

    Hi,

    No problem, we will try to help you. First of all, it looks like your support period has expired, so we would kindly ask you to renew it here.

    Second of all, please try dumping the configuration and build commands to batch files as described here. Then, run them and make sure the problem persists.

    Once you confirm it, please try editing them, replacing any incorrectly escaped characters. Once you can confirm that this fixes the build, please share both the original and patched batch files, and we will update VisualGDB to use the correct encoding.

    #32215
    MrZANE
    Participant

    Hi

    I’ve changed jobs since I created the forum profile. I’ve now updated the forum profile to use the email of our up to date license at my new job.

    Regarding dumping the configuration and build commands that isn’t possible in the way that’s described in the link. VisualGDB Build window doesn’t have the buttons shown in the guide.

    But reproducing the issue is really simple. I just used the nRFConnect wizard and created a project for the  nrf52480dk based on the lpUART example and added an overlay which just changed the uart speed.
    Everything compiles just fine until the overlay is added then, depending on what directory you have the files in, you get a different Invalid esacpe code message. No other changes to the project were made.

    I’ve attached the project files of my example ready for easy testing.

    Attachments:
    You must be logged in to view attached files.
    #32221
    support
    Keymaster

    Thanks for updating your profile. Unfortunately, we are not able to review specific projects for errors, however we can help you get the command dumping to work.

    If you could attach a screenshot of the entire Visual Studio window showing the VisualGDB Build window with the missing commands, we can help you understand why they are missing.

    #32222
    MrZANE
    Participant

    While I can appreciate that you cant review big personal project the files I sent were done just as I described in the post, it’s basically one of the nRFConnect samples (bme680 sample) with an added overlay file.

    If you don’t want to use the file fine, but could you please try one of the samples yourself, and just try to add an simple overlay file.

    I’ve also added a screenshot as requested.

    • This reply was modified 2 years, 10 months ago by MrZANE.
    Attachments:
    You must be logged in to view attached files.
    #32241
    lateralorange
    Participant

    Look at the path strings. It’s complaining about \U, which appears in the second path in the screenshot. Note that the path above it is using forward slashes for the path. You just need to change your paths so that they use the forward slashes instead.

    This is common with MSYS(2)/Cygwin interoperability. It’s like a hybrid between posix and Windows

    #32251
    support
    Keymaster

    Hi All,

    Build issues like this one are often caused by subtle differences in the configuration (spaces in paths, environment, SDK versions), so in order to troubleshoot them efficiently we always ask our users to reduce them to a specific parameter controlled by VisualGDB, such as the CMake command line. Based on your screenshot, everything works as expected – the first line of the configuration log is an exportable command line shown in cyan, as shown in the documentation page.  The build log is not shown yet because the project configuration has not succeeded. Please follow our instructions from our previous reply in order to capture and edit the build command. Once you can confirm that adjusting the command line solves the issues, please share both batch files, and we will update VisualGDB to adjust the command line accordingly.

    #32257
    MrZANE
    Participant

    Hi again,

    Like lateralorange said this is related to the path that is generated by visualgdb when configuring the cmake file(s).
    I also mentioned this in my original post.

    Like I said in previous post the only change I made from the the sample project was to add an overlay file in the visualGDB configuration (See attached screenshot).

    I’ve also added a screenshots of the VisualGDB build output but this is cropped as the textline is too long.
    The complete output from the visualgdb build window is in my first post anyways

    I can not follow you instructions regarding dumping the build files since that menu doesn’t seem to be there (See screenshots).

    What happens if you set up the bme680 project for the nrf52840dk_nrf52840 and add a overlay file? Does it work for you?
    Please do it in the visual studio default path C:\Users\<USERNAME>\source\repos\

    • This reply was modified 2 years, 10 months ago by MrZANE.
    Attachments:
    You must be logged in to view attached files.
    #32288
    MrZANE
    Participant

    Any comment to my last post?

    #32290
    support
    Keymaster

    You can dump the command lines used by VisualGDB by right-clicking on the cyan lines in the configuration log (first line on your screenshot) as shown in our documentation. Please ensure you dump them and follow the troubleshooting instructions from our first reply. If you do not wish to do it, we can add this issue to the backlog, however we would need to wait for other users to confirm it before committing any resources to further investigation.

    #32293
    MrZANE
    Participant

    Below is the output of the dump bat file.
    I notice that the overlay part in the last line doesn’t have quotations ” and path separators are the windows ones \ instead of  of unix ones /
    If I edit the bat file to fix this the bat files works.

    So it seems the file path for the overlay file generated by visualGDB isn’t converted to unix style

    Hope this helps.

    REM Run "C:\Users\JimmyPedersen\AppData\Local\VisualGDB\CMake\bin\cmake.exe ../../.. -G "Ninja" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_MAKE_PROGRAM="C:/Program Files (x86)/Sysprogs/VisualGDB/ninja.exe" -DBOARD=nrf52840dk_nrf52840 -DDTC_OVERLAY_FILE=C:\Users\JimmyPedersen\source\repos\Zephyr-Overlaytest\Zephyr-Overlaytest\Zephyr-Overlaytest.overlay" in directory "C:\Users\JimmyPedersen\source\repos\Zephyr-Overlaytest\Zephyr-Overlaytest/build/nrf52840dk_nrf52840/Debug" on local computer
    cd /d C:\Users\JimmyPedersen\source\repos\Zephyr-Overlaytest\Zephyr-Overlaytest/build/nrf52840dk_nrf52840/Debug
    set LANG=en_US.UTF-8
    set PATH=C:\Users\JimmyPedersen\AppData\Local\VisualGDB\CMake\bin;C:\NRFConnectSDK\v1.8.0\python-env\Scripts;c:\sysgcc\arm-eabi\bin;%PATH%;C:\NRFConnectSDK\v1.8.0\python-env;C:\Users\JimmyPedersen\AppData\Local\VisualGDB\gperf;C:\Program Files (x86)\Sysprogs\VisualGDB
    set ZEPHYR_BASE=C:\NRFConnectSDK\v1.8.0\zephyr
    set ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
    set GNUARMEMB_TOOLCHAIN_PATH=c:/sysgcc/arm-eabi
    "C:\Users\JimmyPedersen\AppData\Local\VisualGDB\CMake\bin\cmake.exe" ../../.. -G "Ninja" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_MAKE_PROGRAM="C:/Program Files (x86)/Sysprogs/VisualGDB/ninja.exe" -DBOARD=nrf52840dk_nrf52840 -DDTC_OVERLAY_FILE=C:\Users\JimmyPedersen\source\repos\Zephyr-Overlaytest\Zephyr-Overlaytest\Zephyr-Overlaytest.overlay

    #32295
    support
    Keymaster

    Thanks for confirming this. Please try the following build, it uses forward slashes for DTC_OVERLAY_FILE: VisualGDB-5.6.104.4539.msi

    #32310
    MrZANE
    Participant

    Hi,

    The new build you linked to solved the problem.

    Thanks

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.