question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The configuration provider sends msvc intelliSenseMode for IAR compiler

See original GitHub issue

Brief Issue Summary

When a compiler cmake-tools is not familiar with is used by CMake (e.g. an embedded compiler with a custom toolchain file), it ignores all other settings and defaults to the MSVC Intellisense mode on Windows. This is usually undesirable, since embedded code is not generally compatible with MSVC.

Expected:

There should be a way to manually override the intellisense settings on a project basis (possibly in cmake-kits.json?) so it can be used as a configuration provider even if the compiler being used by cmake is not supported.

C/C++ log file

In the log below it can be seen that the settings specified in c_cpp_properties.json are not respected and msvc intellisense mode is used when the IAR compiler is specified by a cmake toolchain.

-------- Diagnostics - 2/25/2020, 2:51:31 PM
Version: 0.26.3
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "${workspaceFolder}/**",
        "${workspaceFolder}/drivers/Include/**",
        "${workspaceFolder}/drivers/netx_drv/Include/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "compilerPath": "C:\\Program Files (x86)\\GNU Tools Arm Embedded\\9 2019-q4-major\\bin\\arm-none-eabi-gcc.exe",
    "intelliSenseMode": "gcc-x64",
    "compilerArgs": [
        "-mthumb ",
        "-mcpu=cortex-m4"
    ],
    "configurationProvider": "vector-of-bool.cmake-tools",
    "browse": {
        "path": [
            "${workspaceFolder}/**",
            "${workspaceFolder}/drivers/Include/**",
            "${workspaceFolder}/drivers/netx_drv/Include/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Configurations:
[ C:\Users\pfox\ESeries\Firmware\firmware\CMSIS\Include\cmsis_iccarm.h ]:
    Process ID: 28372
    Memory Usage: 16 MB
    Compiler Path: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
    Includes:
        C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/include/*
        C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/atlmfc/include/*
        C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/um
        C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/ucrt
        C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/shared
        C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/winrt
        C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/cppwinrt
    Standard Version: ms_c++17
    IntelliSense Mode: msvc-x64
    Other Flags:
        --header_only_fallback
Total Memory Usage: 16 MB

Other Notes/Information

Clang may be a better fallback if the compiler can’t be identified, since it’s probably the most broadly compatible.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bobbrowcommented, Apr 1, 2020

What you may need to do for the time being is use compile_commands.json instead of the configuration provider. CMake Tools should generate this file for you. When you use compile_commands.json, you can override the compiler with the value in compilerPath and hopefully that will get things to start working for you until we come up with a plan for IAR.

0reactions
pfox89commented, Apr 1, 2020

Sorry, yes, I actually did try to specify the arm-none-eabi-gcc compiler in my c_cpp_properties.json in hopes that it would use that as a fallback, but it only appears to do that sometimes.

It looks like if I change that after doing the CMake config, it takes until the next time I configure or reopen VS Code, so I think cmake-tools is overriding that setting with the IAR compiler path, which doesn’t configure correctly.

What I’d like to be able to do is to have cmake-tools fall back to a manual configuration for the compiler if the compiler is not supported instead of pushing an unsupported config which will break Intellisense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure IntelliSense for C++ cross-compilation
The article is about configuring the C/C++ extension to provide proper IntelliSense (code completions) in Visual Studio Code when you compile ...
Read more >
Using Visual Studio Code with IAR Embedded Workbench
This Technical Note shows how to use VS Code on top of IAR Embedded Workbench®, to build and debug applications. Prerequisites. This document ......
Read more >
IntelliSense in Visual Studio 2019 with CMake Project and IAR ...
So my question: How can I get IntelliSense running in this project ? Is there a way to add a custom IntelliSense mode...
Read more >
Healthy Lifestyle Score items
CMake integration in Visual Studio Code. ... The configuration provider sends msvc intelliSenseMode for IAR compiler embedded Feature: ...
Read more >
IAR Embedded Workbench® IDE
No part of this document may be reproduced without the prior written consent of IAR. Systems AB. The software described in this document...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found