PlatformIO/VSCode keeps modifying directories in c_cpp_properties.json

Hi,

I have an issue with the creation of the c_cpp_properties.json file. Here is my file:

//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
    "configurations": [
        {
            "name": "PlatformIO",
            "includePath": [
                "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/include",
                "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/src",
                "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/.pio/libdeps/genericSTM32F103C8/RF24",
                "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/.pio/libdeps/genericSTM32F103C8/RF24/utility",
                "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/.pio/libdeps/genericSTM32F103C8/TFT_eSPI",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/SPI/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/avr",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/LL",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/OpenAMP",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/hid",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/cdc",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Inc",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/STM32F1xx",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/open-amp/lib/include",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/libmetal/lib/include",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/virtual_driver",
                "/home/der_rote_baron/.platformio/packages/framework-cmsis/CMSIS/Core/Include",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Include",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc",
                "/home/der_rote_baron/.platformio/packages/framework-cmsis/CMSIS/DSP/Include",
                "/home/der_rote_baron/.platformio/packages/framework-cmsis/CMSIS/DSP/PrivateInclude",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/variants/STM32F1xx/F103C8T_F103CB\(T-U\)",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/CMSIS_DSP/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/EEPROM/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/IWatchdog/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/Keyboard/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/Mouse/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/RGB_LED_TLC59731/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/Servo/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/SoftwareSerial/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/SrcWrapper/src",
                "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/Wire/src",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "path": [
                    "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/include",
                    "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/src",
                    "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/.pio/libdeps/genericSTM32F103C8/RF24",
                    "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/.pio/libdeps/genericSTM32F103C8/RF24/utility",
                    "/home/der_rote_baron/Eigene Dateien lokal/aktuelle Basteleien/Dalek/PlatformIO/Dalek Transmitter/.pio/libdeps/genericSTM32F103C8/TFT_eSPI",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/SPI/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/avr",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/LL",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/OpenAMP",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/hid",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/cdc",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Inc",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/STM32F1xx",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/open-amp/lib/include",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/libmetal/lib/include",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Middlewares/OpenAMP/virtual_driver",
                    "/home/der_rote_baron/.platformio/packages/framework-cmsis/CMSIS/Core/Include",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Include",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc",
                    "/home/der_rote_baron/.platformio/packages/framework-cmsis/CMSIS/DSP/Include",
                    "/home/der_rote_baron/.platformio/packages/framework-cmsis/CMSIS/DSP/PrivateInclude",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/cores/arduino",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/variants/STM32F1xx/F103C8T_F103CB\(T-U\)",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/CMSIS_DSP/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/EEPROM/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/IWatchdog/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/Keyboard/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/Mouse/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/RGB_LED_TLC59731/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/Servo/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/SoftwareSerial/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/SrcWrapper/src",
                    "/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/libraries/Wire/src",
                    ""
                ]
            },
            "defines": [
                "PLATFORMIO=60117",
                "STM32F103xB",
                "STM32F1",
                "STM32F1xx",
                "ARDUINO=10808",
                "ARDUINO_ARCH_STM32",
                "ARDUINO_GENERIC_F103C8TX",
                "BOARD_NAME=\"GENERIC_F103C8TX\"",
                "HAL_UART_MODULE_ENABLED",
                "USE_FULL_LL_DRIVER",
                "VARIANT_H=\"variant_generic.h\"",
                ""
            ],
            "cStandard": "gnu11",
            "cppStandard": "gnu++14",
            "compilerPath": "/home/der_rote_baron/.platformio/packages/toolchain-gccarmnoneeabi@1.90201.191206/bin/arm-none-eabi-gcc",
            "compilerArgs": [
                "-mcpu=cortex-m3",
                "-mthumb",
                ""
            ]
        }
    ],
    "version": 4
}

The issue is, that for some reason PlatformIO/VSCode changes one of the directories for the package from this (the real path, that can be found on the hard drive):

"/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/variants/STM32F1xx/F103C8T_F103CB(T-U)"

to this:

"/home/der_rote_baron/.platformio/packages/framework-arduinoststm32/variants/STM32F1xx/F103C8T_F103CB\(T-U\)"

It adds two backslashes to the directory, which in turn leads to this error message (sorry for the partly german text; the whole IDE is set to english, I don’t know why these messages keep popping up in german…)

grafik

As you can see, this happens in both of the “blocks”. I understand the reason for the error message, PIO tries looking for the data in a directory which doesn’t exist. When I delete the two backslashes, everything ist fine, but they return as soon as I change something in the platformio.ini or reopen the project. Not the end of the world, but I find it pretty annoying.

Has anyone an idea, why PIO/VSCode feels the need to mess up the path and how I can stop this?

My OS is Linux Mint 20.3 if it should be important. Of course I’m happy to deliver more information on my setup, if needed.

Thank you very much in advance

PS: Here is my platformio.ini btw.:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
upload_protocol = serial
monitor_speed = 115200
lib_deps = 
	bodmer/TFT_eSPI@^2.5.43
	nrf24/RF24@^1.4.11

This is issue is ancient and supposed to be solved already.

https://github.com/platformio/platform-ststm32/issues/655

Are you sure you’re on the latest ststm32 platform?

Open a CLI and do

pio pkg update -g -p ststm32

followed by Ctrl+Shift+P → Rebuild Intellisense.

Thank you for the fast reply.

Are you sure you’re on the latest ststm32 platform?

No, not at all. It’s more likely that I installed the platform once, some four years ago, when I started to work with the STM32 and then never touched it again.

I will try your suggestion later this evening or tomorrow at the latest and share the result

Okay, I just tried it out.

One change of platformio.ini and one complete restart of VSCode without messed up c_cpp_properties.json. It seems that the update did the trick (I was still running Ver. 15 of STM32, the update made it Ver. 18).
Thank you very much, that will save me a lot of grunts and eyerolls

Is there a way to update the platforms automatically together with VSCode/PlatformIO? I do update VSC/PIO occasionally, but wasn’t even aware that the platforms need updates as well (although it is not too surprising, when I think about it). Let alone that outdated versions can cause this type of issue

The PlatformIO extension will automatically upgrade the PlatformIO core (currently 6.1.16), but not the platforms, due to possible breakages for the user. You can also check for platform updates within the PlatformIO Home UI, or a generic pio pkg outdated / pio pkg update within a project.

Okay, understood. I will keep that in mind.
Thank you again for the explanation