Skip to main content
PB1
Associate III
May 19, 2023
Solved

STM32CubeIDE does not emit the X-CUBE-AI middleware

  • May 19, 2023
  • 8 replies
  • 7779 views

I am using STM32CubeIDE v1.12.1 on macOS. I have noticed that, when I import a project generated with STM32Cube.AI Developer Cloud, whenever I open the IOC and make a change to the device configuration that requires to regenerate the code, the project becomes broken. I therefore did an experiment: I created a STM32 project under the IDE, then I enabled the X-CUBE-AI software package in the device configuration tool and I let the IDE generate the code. Apparently the IDE-generated code is missing the $PROJECT/Middlewares/ST/AI subdirectory with the X-CUBE-AI library and headers. I have the same effect with 8.0.0 and 8.0.1 versions of X-CUBE-AI. How do I work around this issue?

Best,

Pietro

Best answer by fauvarque.daniel

Recent versions of STM32CubeMX, and STM32CubeIDE with the embedded STM32CubeMX, delete the Middleware files required by X-CUBE-AI upon regeneration.

A fix/workaround has been implemented in X-CUBE-AI 8.1 that will be released by mid june.

In the mean time one possible workaround is to uncheck the checkbox "Delete the previously generated files when no re-generated" in the Project Manager -> Code Generator -> Generated files panel

Regards

8 replies

fauvarque.daniel
fauvarque.danielBest answer
ST Employee
May 22, 2023

Recent versions of STM32CubeMX, and STM32CubeIDE with the embedded STM32CubeMX, delete the Middleware files required by X-CUBE-AI upon regeneration.

A fix/workaround has been implemented in X-CUBE-AI 8.1 that will be released by mid june.

In the mean time one possible workaround is to uncheck the checkbox "Delete the previously generated files when no re-generated" in the Project Manager -> Code Generator -> Generated files panel

Regards

JLojo
Associate III
July 10, 2023

Hello,

The workaround doesn't work for me :sad_but_relieved_face:

I'm running xCube-AI V8.0.1 (it seems that 8.1 is still not released...) on STM32CubeIDE V1.12.1

I do see Middlewares created and then deleted during code generation.

For now, I just copied from repository

STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\8.0.1\Middlewares\ST\AI\Inc

It compiles, but only after I removed ':NetworkRuntime801_CM4_GCC.a' from Project/Properties/C/C++ General/Paths and Symbols/Libraries.

Only problem: I need to recopy Middlewares and remove the wrong library each time I do regenerate!

When can we expect to have the XCube AI V8.1 released?

Thanks

Jylo

Visitor II
August 2, 2023

I have exact the same problem. Did you solve it yet. If so, can you describe your solution.

JLojo
Associate III
August 2, 2023

Hi Guray1

As described above, just:

  • Copy from the repository STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\8.0.1\Middlewares\ST\AI\Inc to your workspace.
  • Remove ':NetworkRuntime801_CM4_GCC.a' from Project/Properties/C/C++ General/Paths and Symbols/Libraries.

Only problem: you need to redo this each time you regenerate!

Senior
January 9, 2024

It's unbelievable how much time this issue can take from us.

In my case, it worked fine for the first time I used the AI module for my project. However, when creating another project from scratch, it no longer worked. I even tried to remove it from the entire STM32 and reinstall it. It did not work either.

 

Here is a weird behavior. When enabling the AI sub module in my project, it already comes with the configuration used before, as if I had already imported the model to that brand new project started from scratch. This is definitely not a feature, but a bug.

I am still struggling with this and any help is appreciated.

What would be the equivalent of finding `Project Manager -> Code Generator -> Generated files panel` in the STM32CubeIDE mentioned in @fauvarque.daniel's answer?

fauvarque.daniel
ST Employee
January 9, 2024

Are you using version X-Cube-AI 8.1 ? normally the problem of code generation has been fixed in that version (It is actually a workaround to recreate the files that are removed during the code generation by MX and should not)

Concerning your issue of having an already configured network when you start from scratch, the only feature I can think of is the AI filter in the finder, if you pass a network in the AI filter of the finder when the project is created the name of the network used is recovered so you don't have to type it twice.

Regards

Senior
January 9, 2024

I am using `X-Cube-AI 8.1` and `STMCubeIDE 1.13.1`. I even reinstalled the IDE following these steps and I still have the problem. A coworker tried on his machines the exact same steps, and things work fine on his computer. The only difference we know of is that I am on a ubuntu machine, and the other machine we are using that works is windows.

Also, important to remember that for that first project I mentioned, the Middleware folder was added fine. But any other project, the folder gets removed. Right now removed all projects from the workspace, and any new project I create, I still have the issue. :slightly_frowning_face:

fauvarque.daniel
ST Employee
January 10, 2024

I'll try to reproduce on Linux.

Do you have a TMPAILIB directory created ? if so you can move the content into Middlewares/ST/AI to restore the files that have been removed by MX

Senior
January 16, 2024

I don't have `TMPAILIB`. Here is what I have.

 

Screenshot from 2024-01-16 09-49-46.pngAlso, Notice that the `.ioc` is show as not saved. I did save it.

 

What happens is: After I save it, the options to regenerate code appear, then I click o regenerate, then after regeneration is done, the `*` is shown again in the `.ioc` tab as if I had changed the file. Then, if I try to close it, it will ask me again if I want to regenerate. Then, the loop continues.

wg_it
Associate II
January 25, 2024

Have you solved the same problem I encountered?

Senior
January 29, 2024

Nops. A workaround solution is to manually copy the files. However, it did get deleted when regenerating code. So, you might want to have a script to copy those files that is automatically called when regenerating. For the time being that is what I can think of.

Visitor II
March 15, 2024

I encountered the same issue and was able to resolve it by selecting "Add necessary library files as referenced in the toolchain project configuration file" in the Project Manager in addition to unchecking "Delete previously generated files when not re-generated".

This was on Ubuntu 22.04 with STM32CubeIDE Version: 1.14.0 and X-CUBE-AI version 8.1.0

LeonTerl
Associate
May 30, 2024

Hi, you probably don't need the answer anymore, but I found out that the middleware files are correctly generated and included if you select the application template while including the cube-ai.

LeonTerl_0-1717066420145.png

LeonTerl_1-1717066431762.png

So for anyone who is trying to work with versions post 5.0.0, this is how you fix your middlewares problem.