2025-11-27 12:46 PM
Hi, I'm trying to come up to speed with the VSCode workflow, coming from experience so far only using CubeIDE.
In CubeIDE, it seems that I was encouraged to think of having a "workspace", in which several projects co-existed. I enjoyed the ability to be able to have multiple projects "open" at once, to be able to compare code and easily understand/navigate to out-of-project source code, like centralized libraries and such.
The VScode workflow, in contrast, seems to want me to only open a single project at once, otherwise CMake seems to get crabby. This is slightly annoying in that it requires me to open multiple windows in order to see multiple projects simultaneously, but notably more annoying when I am trying to use out-of-project code - I need to open a second window at a higher directory level, but can't actually build anything in this second window. It's kind of cluttered and confusing.
It also seems to kind of push me away from the path of having a git repo that spans multiple projects - if I'm trying to develop something that conceptually should all belong in one repo but contains multiple projects, I can't easily work from the top level of my repo as I'd expect to be able to do.
Am I missing something obvious in this workflow? I keep trying to find a "set active folder" function or something like that, but there doesn't seem to be one...
Thanks!
2025-11-27 10:22 PM
@sb_st
My 2 cents is please do not mix VSCode and CMake (& CMake Tools extension supporting integration of) capabilities.
VSCode is kind of able to support multi projects by instance Thanks https://code.visualstudio.com/docs/editing/workspaces/multi-root-workspaces
About CMake stuff yes it kind of forcing you a bit to get one project per root but multiple roots are supported.
See maybe discussion https://community.st.com/t5/stm32cubeide-for-visual-studio/quot-cmake-build-quot-extension-fails-when-files-are-in-a-sub/td-p/854022
What maybe more annoying is to get a .git being shared for multiple projects. You can add each project has a root but adding parent folder of them because .git is a pain.
Out-of-project code is fully supported by CMake Thanks multiple ways https://cmake.org/cmake/help/latest/command/add_subdirectory.html or https://cmake.org/cmake/help/latest/module/ExternalProject.html. No issue to add any "external" folder as root(s) too.
2025-11-28 4:02 AM
You're right to push back against conflating Cmake, the Cmake VSCode extension, VSCode itself, and the STM32 VSCode Cube extension. I'm aware these are all separate things.
I suppose what I am reacting to is: I can open my workspace in VScode (which, yes, allows me to view multiple stm32 "projects" in the same tree, which is what I want), but then I see this popup:
In this state, the CMake extension icon on the left side of the VSCode window is not visible, and it is not clear to me how/if I can configure things to allow me to work/focus on a specific STM32 project, for building. Is this possible? If so, how do I do this?
I understand that I can edit my CMakeLists.txt files themselves so that Cmake can find/use code in out-of-project folders (and I have done this, and it works fine). But this editing process is annoying/difficult when only opening a single project in the VSCode window.
2025-11-28 4:13 AM
Note that CubeIDE is Eclipse - so the workflow is the Eclipse workflow.
Similarly, VScode is not an ST-specific thing.
So you might find it helpful to widen your searches (or AI prompts) to generic "Eclipse" and "VSCode" - rather that focus just on ST-specific materials ...
2025-11-28 6:39 AM
Hm, ok, thank you for the push in this direction.
I think part of my problem might be not thinking critically about the "workspace" aspect of vscode - I've historically just been using a top-level workspace for my entire monorepo, more or less regarding the view of files in the left pane as like that of a filesystem browser, rather than 'curating' the folders I'm choosing to include. My repo has a mishmash of stuff in it - datasheet, esp-idf stuff, example code from other projects, schematics, etc. and - because I'm coming from cubeIDE - I've only really needed to use vscode as sort of a second code editor, rather than needing to use it to build stuff.
Introducing cmake (and the build/debug) process into this sort of use of vscode runs into the complications I've mentioned. I do notice that when I start all over again with a clean workspace and manually choose to include what I actually want to be working on, cmake does seem to be less confused. So rethinking what I'm doing with a bit more deliberation is good encouragement, thanks.
2025-11-28 6:52 AM
Indeed, the challenge in moving from one toolchain to another is always in learning to think & do things in the new toolchain's way.
Similar to moving from one programming language to another. As the old joke goes, "A Real Programmer can write BASIC in any language!"
Hopefully, with both Eclipse and VSCode (and CMAKE) being quite widespread, there should be lots of general resources to find ...
2025-11-30 9:59 PM
Hi @sb_st
I also get started to use STM32 VSCode Cube extension recently. Not sure if you are able to share your projects here so I can try to check your issue?
As you can see from the picture below, there are two CMake projects (as well as a Git repository) in the root of the demonstrated project folder:
After launching VSCode from project.code-workspace (PQCSecureBoot.code-workspace) as shown above, I can see those two CMake projects (as well as some other two minor projects) in the workspace which is defined in project.code-workspace:
As you can see from the picture above, Git repository is also visible in the workspace. In the meantime, two CMake projects can be build correctly in CMake extension as shown below:
Are those what you're looking for?
2025-11-30 10:38 PM
@sb_st
This notification below is a guide to using a multi-root workspace, pointed out by @Cartu38 OpenDev
You are not forced (waning type notification) to do it, but if you do, it will help you the most.