For this I've modified c_cpp_properties.json in .vscode folder to include 2 configurations, one for each core.
To switch between them Ctrl + Shift + P and select "C/C++ Select a configuration..." or click on the bottom right of the vscode status bar. Where the STM32 configuration must be selected by default.
The relevant part is the path to the "compileCommands", that is required by IntelliSense to help with autocompletion.
{
"version": 4,
"configurations": [
{
"name": "STM32",
"configurationProvider": "ms-vscode.cmake-tools",
"intelliSenseMode": "${default}",
"compilerPath": "/opt/st/stm32cubeclt_1.16.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc",
"cStandard": "c17",
"cppStandard": "c++17"
},
{
"name": "CM4",
"compileCommands": "${workspaceFolder}/CM4/build/compile_commands.json",
"compilerPath": "/opt/st/stm32cubeclt_1.16.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc",
"cStandard": "c17",
"cppStandard": "c++17"
},
{
"name": "CM7",
"compileCommands": "${workspaceFolder}/CM7/build/compile_commands.json",
"intelliSenseMode": "${default}",
"compilerPath": "/opt/st/stm32cubeclt_1.16.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc",
"cStandard": "c17",
"cppStandard": "c++17"
}
]
}
Hope it helps you!