Open MaJerle opened 1 month ago
@MaJerle C/C++: Log Diagnostics should appear when you have a C/C++ file active.
I agree, thanks. it is below.
Some notes:
iwdg.c
is added to the target with target_sources
cmake functions. This file works fineadc.c
is added to the target via add_subdirectory(...)
and then we link the library from the subdirectory. This file has problemsThere is clearly a disrepancy.
I tested same project with 2
different computers and result is always the same.
-------- Diagnostics - 5/24/2024, 8:01:02 PM
Version: 1.20.5
Current Configuration:
{
"name": "STM32",
"configurationProvider": "ms-vscode.cmake-tools",
"intelliSenseMode": "windows-gcc-x64",
"compilerPathIsExplicit": false,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"intelliSenseModeIsExplicit": false,
"configurationProviderInCppPropertiesJson": "ms-vscode.cmake-tools",
"includePath": [
"C:\\msys64\\mingw64\\include\\c++\\12.2.0",
"C:\\msys64\\mingw64\\include\\c++\\12.2.0\\x86_64-w64-mingw32",
"C:\\msys64\\mingw64\\include\\c++\\12.2.0\\backward",
"C:\\msys64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\12.2.0\\include",
"C:\\msys64\\mingw64\\include",
"C:\\msys64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\12.2.0\\include-fixed",
"C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include"
],
"macFrameworkPath": [],
"cStandard": "c17",
"cppStandard": "gnu++17",
"mergeConfigurations": false,
"compilerPath": "C:\\msys64\\mingw64\\bin\\gcc.exe",
"browse": {
"path": [
"C:\\msys64\\mingw64\\include\\c++\\12.2.0",
"C:\\msys64\\mingw64\\include\\c++\\12.2.0\\x86_64-w64-mingw32",
"C:\\msys64\\mingw64\\include\\c++\\12.2.0\\backward",
"C:\\msys64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\12.2.0\\include",
"C:\\msys64\\mingw64\\include",
"C:\\msys64\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\12.2.0\\include-fixed",
"C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
Custom browse configuration:
{
"browsePath": [
"c:/path/to/project/app/source",
"c:/path/to/project/app/source/lib",
"c:/path/to/project/lib/cjson",
"c:/path/to/project/build/app/cmakefiles",
"c:/path/to/project/include",
"c:/path/to/project/lib/drivers/cmsis/device/st/stm32u5xx/include",
"c:/path/to/project/lib/drivers/cmsis/include",
"c:/path/to/project/lib/mbedtls/include",
"c:/path/to/project/lib/drivers/stm32u5xx_hal_driver/inc",
"c:/path/to/project/lib/drivers/stm32u5xx_hal_driver/inc/legacy",
"c:/path/to/project/lib/lwprintf/src/include",
"c:/path/to/project/build/app/lwprintf/lib_inc",
"c:/path/to/project/app/include",
"c:/path/to/project/app/include/lib",
"c:/path/to/project/lib/cjson/include",
"c:/path/to/project/source",
"c:/path/to/project/lib/mbedtls/library",
"c:/path/to/project/lib/drivers/stm32u5xx_hal_driver/src",
"c:/path/to/project/lib/lwprintf/src/lwprintf"
],
"compilerPath": "c:/st/stm32cubeclt/gnu-tools-for-stm32/bin/arm-none-eabi-g++.exe",
"compilerArgs": [],
"compilerFragments": []
}
cpptools version (native): 1.20.5.0
Translation Unit Mappings:
[ C:\path\to\project\app\source\adc.c - source TU]:
[ C:\path\to\project\bootloader\source\bootloader.c - source TU]:
[ C:\path\to\project\source\iwdg.c - source TU]:
C:\path\to\project\include\iwdg.h
C:\path\to\project\lib\drivers\STM32U5xx_HAL_Driver\Inc\stm32u5xx_hal_adc.h
Translation Unit Configurations:
[ C:\path\to\project\app\source\adc.c ]:
Process ID: 41012
Memory Usage: 52 MB
Compiler Path: C:\ST\STM32CubeCLT\GNU-tools-for-STM32\bin\arm-none-eabi-g++.exe
Includes:
C:\ST\STM32CubeCLT\GNU-tools-for-STM32\lib\gcc\arm-none-eabi\12.3.1\include
C:\ST\STM32CubeCLT\GNU-tools-for-STM32\lib\gcc\arm-none-eabi\12.3.1\include-fixed
C:\ST\STM32CubeCLT\GNU-tools-for-STM32\arm-none-eabi\include
Standard Version: c17
IntelliSense Mode: windows-gcc-arm
Other Flags:
--gcc
--gnu_version=120301
[ C:\path\to\project\source\iwdg.c ]:
Process ID: 32976
Memory Usage: 102 MB
Compiler Path: C:\ST\STM32CubeCLT\GNU-tools-for-STM32\bin\arm-none-eabi-gcc.exe
Includes:
C:\path\to\project\include
C:\path\to\project\lib\drivers\CMSIS\Device\ST\STM32U5xx\Include
C:\path\to\project\lib\drivers\CMSIS\Include
C:\path\to\project\lib\mbedtls\include
C:\path\to\project\lib\drivers\STM32U5xx_HAL_Driver\Inc
C:\path\to\project\lib\drivers\STM32U5xx_HAL_Driver\Inc\Legacy
C:\path\to\project\lib\lwprintf\src\include
C:\path\to\project\build\app\lwprintf\lib_inc
C:\path\to\project\app\include
C:\path\to\project\app\include\lib
C:\path\to\project\lib\cJSON\include
C:\ST\STM32CubeCLT\GNU-tools-for-STM32\arm-none-eabi\include\newlib-nano
C:\ST\STM32CubeCLT\GNU-tools-for-STM32\lib\gcc\arm-none-eabi\12.3.1\include
C:\ST\STM32CubeCLT\GNU-tools-for-STM32\lib\gcc\arm-none-eabi\12.3.1\include-fixed
C:\ST\STM32CubeCLT\GNU-tools-for-STM32\arm-none-eabi\include
Defines:
APP_FW_MAX_LEN=0x00060000
APP_FW_START_OFFSET=0x00000400
APP_LOAD_ADDR=0x08020000
BOOTLOADER_FW_MAX_LEN=0x00020000
BOOTLOADER_LOAD_ADDR=0x08000000
DEBUG
DOWNLOAD_SLOT_FW_MAX_LEN=0x00060000
DOWNLOAD_SLOT_LOAD_ADDR=0x08080000
IS_APP=1
IS_BOOTLOADER=0
IS_DEVELOPMENT=0
STM32U575xx
USE_FULL_LL_DRIVER
USE_HAL_DRIVER
VERSION_FW_MAJOR=0
VERSION_FW_MINOR=0
VERSION_FW_PATCH=1
VERSION_FW_REV=0
VERSION_FW_TYPE=0
VERSION_HW_MAJOR=0
VERSION_HW_MINOR=0
VERSION_HW_PATCH=0
Standard Version: c11
IntelliSense Mode: windows-gcc-arm
Other Flags:
--gcc
--gnu_version=120301
Total Memory Usage: 209 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 3788
Update: for test, I moved from the add_subdirectory
approach, to file(GLOB_RECURSE...)
instead.
Now all files are added to the project as a target, and not as a library anymore.
And it works fine.
Is it therefore vscode-cmake-tools issue?
@MaJerle I think so. From your logging, I don't see a configuration being sent from CMake Tools.
Edit: No, after I closed the window and opened again, it stopped working again, regardless of how cmake is configured.
@MaJerle Sorry, I thought our Log Diagnostics logging showed the "Custom configurations received:" logging but it's actually in our main C/C++ logging when C_Cpp.loggingLevel is set to "Debug". Do you see the correct "Custom configurations received:" info being sent from CMake Tools? i.e. the correct includes/defines/args/compilerFragments.
I'm not getting correct data if I well understood your point.
I'm testing on 2 PCs, same project, and something seems to be wrong with CMake Tools extension, because suddenly it starts working (random) and as soon as I restart vscode, errors appear again
@MaJerle We apologize for getting back to you so late. We are trying to reproduce your issue but we can't reproduce it based on the information you provided, could you provide your reproduction project?
Please feel free if you have any doubt!
Environment
Version: 1.89.1 (user setup) Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Date: 2024-05-07T05:13:33.891Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22621
C/C++ version: v1.20.5 CMake Tools version: v1.17.17
Bug Summary and Steps to Reproduce
adc.c
file is part of the compilation. I can see it in thecompile_commands.json
cmake outputC/C++: Log Diagnostics
command, but there isCMake: Log Diagnostics
command, exported below#include "adc.h"
does not work, but CTRL+CLICK on theADC_HandleTypeDef
does open the declaration. You can see them on the picture below, lines1
and6
adc.c
is added to the project through the subdirectory, through the interface libraryCMake diagnostics
Configuration and Logs
Other Extensions
No response
Additional context
adc.c
andi2c.c
seem to have empty response by CMake Tools extension. They are added to the project as an external library to the main application, like so:And then
CMakeLists.txt
in theapp
folder looks like so: