Chris Shaw

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Building nrfConnect projects from the command line #32334
    Chris Shaw
    Participant

    Awesome – you are correct that the problem is fixed in that version and I can build from the command line. Great stuff. Thank you.

    One more question about the VisualGdb.exe command line. For use in CI I want to be able to pass the build number (from CI) into the build so that it can be reported at runtime. I do this in MSBuild command lines for other projects, but want to get it working here too.

    I can pass this to the build from CMakeLists.txt (e.g. by the code below):, but I need to get it into an env var first. I could do a ‘set BuildNumber=x’ from DOS in the CI somehow, but this is ugly and dependent on a continuous shell. Is there a way to pass this into the build from the VisualGDB.exe command line, similar to the MSBuild ‘-p:BuildNumber=x’ option?

    Example CMakeLists.txt:

    ...

    if(DEFINED ENV{BuildNumber})
    target_compile_options(app PRIVATE -DBUILD_NUMBER=$ENV{BuildNumber})
    else()
    target_compile_options(app PRIVATE -DBUILD_NUMBER=0)
    endif()

    in reply to: Building nrfConnect projects from the command line #32317
    Chris Shaw
    Participant

    Ok, thanks – that’s a much better answer.

    Doesn’t seem to be much documentation for command line VisualGDB other than providing no parameters and getting a help message.

    But I’ve kinda got part of this working. But the steps I need to run are as follows (and this is for an nRFConnect / CMake based project).

    1. Clean the build – either by manually deleting the build folder or running visualgdb.exe /clean
    2. From within the IDE, right-click the project and Reload CMake Project (to generate correct cmake build files).
    3. Then I can use visualgdb.exe /build to build the project. I get an error at the end “error : Failed to merge NRFConnect binaries: The path is not of a legal form.” The .hex file is output correctly (which I’m after) but the merged.elf file is not produced.

    Is there a way to do step 2 via the command line? For the record, the command line I’m using is this:

    "c:\Program Files (x86)\Sysprogs\VisualGDB\VisualGDB.exe" /rebuild filename.vgdbproj /config:Debug /platform:

    It looks like it needs the IDE to run cmake correctly otherwise the error below occurs, and this also happens if I use the /rebuild switch instead. The noticeable difference in the output is the lack of the line “– Found toolchain: gnuarmemb (C:/SysGCC/arm-eabi)” that appears when it works, is not there when it fails.

    Incidentally this matches what sometimes happens in the IDE if I remove the build folder then hit Rebuild.

    CMake Error at C:/nrfConnect/v1.8.0/zephyr/cmake/generic_toolchain.cmake:36 (include):
    include could not find requested file:

    C:/SysGCC/arm-eabi/cmake/toolchain/gnuarmemb/generic.cmake
    Call Stack (most recent call first):
    C:/nrfConnect/v1.8.0/zephyr/cmake/app/boilerplate.cmake:544 (include)
    C:/nrfConnect/v1.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    -- Configuring incomplete, errors occurred!
    C:/nrfConnect/v1.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
    CMakeLists.txt:9 (find_package)

    CMake Error at C:/nrfConnect/v1.8.0/zephyr/cmake/dts.cmake:167 (message):
    command failed with return code: The system cannot find the file specified
    Call Stack (most recent call first):
    C:/nrfConnect/v1.8.0/zephyr/cmake/app/boilerplate.cmake:545 (include)
    C:/nrfConnect/v1.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    C:/nrfConnect/v1.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
    CMakeLists.txt:9 (find_package)

     

    in reply to: Building nrfConnect projects from the command line #32294
    Chris Shaw
    Participant

    This happens because the build system does not have VisualGDB installed, so it cannot load the .vgdbproj files.

    Well, no. Right now I’m just trying to build on my day-to-day dev machine. There’s no point trying to get it working on CI until I can make it work locally. VisualGDB is most definitely installed. Its also definitely installed on the CI machine for that matter, as its already used for building ARM projects.

    Yeah, I understood it was running CMake and ninja on build requests, but I was hoping this was easily accessible from running MSBuild or similar to trigger the process. Otherwise I need to remember to re-export the command line if I make any changes.

    I’ve exported the build command as suggested and will run with that. It looks like the output build directory needs to be created manually prior which is ok. The .bat file does though contain some hard-coded paths specific to the local installation and source directory, so I’ll need to ‘finesse’ away the specifics to work from other machines. Again, this is why a MSBuild command line would be preferable.

    Thanks,

    Chris

    Chris Shaw
    Participant

    Hmmm, yes it appears that I did have that setting on ‘Prefer Visual Studio IntelliSense’. And on my second environment (working fine yesterday) if I set the same option then the error starts happening there too.

    I’ve installed the beta version you supplied and that does indeed seem to fix it.

    Thank you very much for the assistance.

    Chris Shaw
    Participant

    I cleared the caches and was still having the problem. After commenting before though about switching the error message by changing the IntelliSense engine, I selected the third option (Regular VC++ IntelliSense) for just one of the projects and all appears to be ok now. Both projects can open files without problem.

    So I’m going to blame Clang at this point. If I get the Clang IntelliSense Diag Console window then by changing those options I can see processing and errors. I’ve removed my local .clang-format file, tried a new one but each causes the same problem. Below is a common stack trace I can see on changing options.

    If you are able to help or point me at a better resource that would be appreciated.

    [+0:38:36.067] Replacing VC++ language service for C:\cstemp\vgdb_test\EmbeddedProject1.c
    [+0:38:36.067] [0%] gftoCheckingForModifications
    [+0:38:36.074] [56%] gftoCheckingForModifications
    [+0:38:36.079] [0%] gftoBypassed
    [+0:38:36.084] Object reference not set to an instance of an object. while trying to hook previously open files belonging to C:\cstemp\vgdb_test\EmbeddedProject1\EmbeddedProject1.vcxproj
    [+0:38:36.084] Stack trace:
    [+0:38:36.084] at pu.v1(String b, List`1 a)
    [+0:38:36.084] at p3.t4(String a)
    [+0:38:36.084] at n02..ctor(IVsTextLines d, jw1 c, gd a, i b)
    [+0:38:36.084] at jw1.y2(IVsTextLines a, Boolean b)
    [+0:38:36.084] at jw1.CreateSource(IVsTextLines a)
    [+0:38:36.084] at Microsoft.VisualStudio.Package.LanguageService.GetOrCreateSource(IVsTextLines buffer)
    [+0:38:36.084] at Microsoft.VisualStudio.Package.LanguageService.GetCodeWindowManager(IVsCodeWindow codeWindow, IVsCodeWindowManager& mgr)
    [+0:38:36.084] at Microsoft.VisualStudio.Editor.Implementation.CompoundTextViewWindow.TextDocData_OnNewLanguageService(Guid& sidLangServiceID)
    [+0:38:36.084] at Microsoft.VisualStudio.Editor.Implementation.TextDocData.NewLanguageServiceEventHandler.Invoke(Guid& sidLangServiceID)
    [+0:38:36.084] at Microsoft.VisualStudio.Editor.Implementation.TextDocData.SetLanguageServiceID(Guid& guidLangService, Boolean changeContentType, Boolean sendChangedEvent)
    [+0:38:36.084] at Microsoft.VisualStudio.Editor.Implementation.TextDocData.SetLanguageServiceID(Guid& guidLangService)
    [+0:38:36.084] at jw1.n(Guid a, Guid b, ou1 c, x03 d)
    [+0:38:36.084] at c73.m_2(List`1 a)
    • This reply was modified 3 years, 1 month ago by support. Reason: formatting
    Chris Shaw
    Participant

    I actually managed to recreate the problem quickly and simply. This time the error dialog shows “Cannot open file”, and I also saw that before. I seem to be able to switch between the two errors by closing/reopneing the solution and switching IntelliSense engine between Default (Clang) and Advanced Clang IntelliSense.

    I’m using Visual Studio 2017 (15.9.33) and VisualGDB 5.4R4.

    Steps to reproduce:

    1. In VS use File -> New -> Project
    2. Create a new solution and use Embedded Project Wizard.
    3. Choose a processor and template – in my case I used STM32L151R8-A and LED Blink.
    4. Add a second project to the same solution – I used the same options again with a different project name.
    5. In each project, remove the reference to the main .c file.
    6. Move the main file for the first project to the solution root – in my case this was EmbeddedProject1.c moved up one level next to the .sln file.
    7. In each project ‘Source Files’ filter, add a reference to the moved EmbeddedProject1.c file using ‘Add -> Existing Item’.
    8. Build solution.
    9. Try and open one of the references to EmbeddedProject1.c.

    I’ve attached a zip file containing a solution according to above. The file appears to be ‘openable’ on first load, but some processing occurs soon after solution load and then it cannot be opened.

    NB I’ve just tried this on another computer and it appears to be ok, so I wonder if something is messed up in my VS installation. I’ve previously cleared out my VS cache from %APPDATA%, but maybe I need to uninstall/reinstall.

    Regards,

    Chris

    Attachments:
    You must be logged in to view attached files.
Viewing 6 posts - 1 through 6 (of 6 total)