cancel
Showing results for 
Search instead for 
Did you mean: 

How to import STM32CubeIDE project with VSCode Extension

SidPrice
Associate III

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

5 REPLIES 5

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

fniutta
Associate

 

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: 

  1. Open the ".ioc" file in STM32CUBEMX 
  2. Go to the "Project Manager" tab 
  3. In the "Project" page (it should open on default when opening the "Project Manager" tab)  locate the "Toolchain / IDE" option
  4. Change this option from "STM32CubeIDE" to "CMake"
  5. Click on "GENERATE CODE"
  6. 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"

 

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!

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…).