cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a workaround for importing an existing STMCubeMX .ioc file?

Jim Seymour
Senior

According to the "known issues" post, importing an existing .ioc file from STMCubeMX is currently unsupported.

I'm starting a new project and would like to use the IDE for this - but my engineer designed the product using CubeMX.

Is there any kind of workaround for this?

As I see it, my options are:

1) manually recreate his work

2) keep using the "old" tools (CubeMX & Keil compiler)

Not sure which would be "better".

Thanks.

17 REPLIES 17
Jim Seymour
Senior

I have discovered a workaround that seemed to work for me...

Here are the steps I followed:

  1. Create a new STM32 project in the IDE (using the Target Selector to select the proper MCU)
  2. Shut down STM32CubeIDE
  3. Go into the workspace folder and replace the newly-created .ioc file with the .ioc file created by STM32CubeMX
    1. You may need to rename the file to match the new project - and if so, you'll need to edit the .ioc file to change any references to the old project name to the new one.
  4. Restart STM32CubeIDE and double-click on the .ioc file. It now shows all the pin settings from the MX project!

So far, so good!

Herve PIERROT
ST Employee

good to hear your unlock your case and thanks for sharing your solution.

Thanks Jim, beware that will not work in all cases (didn't work in my case, unfortunately).

Again Thanks,

Best Regards, Dave

Ayberk Özgür
Associate II

@Herve PIERROT​ At the time of writing on my platform (Windows 10 with JRE 1.8.0_231 64-bit), the STM32CubeIDE generator in the standalone STM32CubeMX tool (5.4.0) does not generate the `.project` and `.cproject` files, preventing proper project import into STM32CubeIDE (1.1.0). It only generates the `.mxproject` file, which is not sufficient for import. This is a weird shortcoming from my perspective, as the following workaround is possible:

  1. Load the project containing only the `.ioc` file (no `.project`, `.cproject` or `.mxproject`) as a simple Eclipse project into STM32CubeIDE with the "Open Projects from File System" option
  2. Open the `.ioc` file within the IDE, using the MX perspective
  3. Generate code from the MX perspective, this does generate the `.project`, `.cproject` and `.mxproject` files; the project gets the correct natures at this point
  4. In the case of a C++ project, again go to the MX perspective, right click the project and "Convert to C++"
  5. Add missing source folders

@Jim Seymour​ No need to create a new project and replace `.ioc` files.

It's surprising as I would expect these two tools (standalone STM32CubeMX and STM32CubeIDE MX perspective) to use the same STM32CubeIDE generator backend. There are also some discrepancies between the generated HAL sources, pointing to the opposite.

Given this, and also that STM32CubeIDE seems to be sort of the "recommended" IDE by ST nowadays, I'm wondering whether the standalone STM32CubeMX will be phased out.

Alternatively, the below workaround also seems to work:

  1. Open the `.ioc` file with the standalone STM32CubeMX tool
  2. Generate code for SW4STM32 (TrueSTUDIO also works)
  3. From STM32CubeIDE, import the generated project with the dedicated SW4STM32 importer (or TrueSTUDIO importer); no further code generation from the integrated MX perspective should be necessary and the project should get correct natures already
  4. As usual, in the case of a C++ project, go to the MX perspective, right click the project and "Convert to C++"
  5. Add missing source folders

Herve PIERROT
ST Employee

sounds like you are facing a current known limitation that for the generation of the STM32CubeIDE files (.project and .cproject),

the name of the .ioc should be the same as the name of the folder that contain this .ioc.

This is the case if you create the project from scratch with STM32CubeMX, it generates both the folder and the .ioc file,

but probably not if you copy/paste your project in a different folder.

Then your case, the files are most probably generated, but in a folder one level above your project, and in a folder having the name of your .ioc file.

A fix should come in one of the coming releases...

I forgot to mention that the directory and `.ioc` names are exactly the same.

we found that sometimes, an unexpected folder could be created that may lock the generation process. Could you please check if you have this folder :

<MX install path>/third_parties_plugins/binaries

If you have this "binaries" folder, then just delete it with all its content.

Robmar
Senior III

I just imported an IOC file into a project imported into CubeIDE, seemed to work, but it isn´t updating the files, though no error is reported.

Must be a fix for this by now?