How to import STM32CubeIDE project with VSCode Extension
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-05 7:58 AM
I have a project that was being developed using STM32CubeIDE, and being debugged with JLink Ultra.
Since all my other client work is done using VSCode, I wanted to bring this CubeIDE project into VSCode.
The only option I see in VSCode to do this is "Import CMake Project", I tried this, but it does not appear to work. The build and debug tasks appear to not be set up correctly.
How is this supposed to be done.
Using VSCode extension v2.1.1.
Sid
- Labels:
-
VSCode for STM32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-05 8:16 AM
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-05 8:47 AM
Thank you Andrew, however, the resulting project doesn't build. I see this:
Executing task: Build
build task started....
c:\Users\sidpr\AppData\Roaming\Code\User\globalStorage\ms-vscode.vscode-embedded-tools\vcpkg\root\downloads\artifacts\vcpkg-ce-default\tools.kitware.cmake\3.20.1\bin\cmake.EXE --build "D:/DataRoot/Projects/IO Technologies/IHP Controller/build/debug/build" --
ninja: error: loading 'build.ninja': The system cannot find the file specified.
build finished with error(s).
Plus, the debug configuration for the JLink probe is not imported.
Sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-09 3:41 AM - edited ‎2025-02-09 3:43 AM
This workflow only works if the project is first created using STM32CubeMX.
In the past it was possible to import a STM32CubeIDE project in vscode using the relative extension without any problem until they changed to be only possible if the code is a cmake project.
EDIT: for a more for a more in-depth guide check this post.
To be able to use the vscode extension you have to re-generate the code from STM32CubeMX in CMake mode:
- Open the ".ioc" file in STM32CUBEMX
- Go to the "Project Manager" tab
- In the "Project" page (it should open on default when opening the "Project Manager" tab) locate the "Toolchain / IDE" option
- Change this option from "STM32CubeIDE" to "CMake"
- Click on "GENERATE CODE"
- Now on Visual Studio Code you should be able to use the "Import CMake Project" option
WARNINGS
This operation will delete everything you wrote in the files generated by STM32CubeMX if you do not put it in the comments guards relative to user code. All the configuration functions (or files) will be brought back to the values presented on STM32CubeMX.
If you added files not generated by STM32CubeMX probrably you will need to add them in the "target_sources" list of CMake in this file "{project_direcotry}/cmake/stm32cubemx/CMakeList.txt"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-10 7:45 AM
Thank you for trying to help, I followed your instructions and once again the import and build failed.
This is so wrong that ST removed the ability to import a CubeIDE project, very disappointed. I guess I will continue to support my client with CubeIDE, what a pain!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-10 1:10 PM
I’m sorry it didn’t work!
I don’t know if you already tried, but it will help to import the CMake project (created following the steps i presented) without the files created by old attempts (so you do the conversions steps on a clean copy of the project, without any cmake cache, vscode cache etc…).
