Skip to main content
Associate II
September 15, 2025
Solved

Problem with X-CUBE-AI code generation

  • September 15, 2025
  • 1 reply
  • 886 views

Hello, I installed X-CUBE-AI 10.2.0 from STM32CubeMX in STM32CubeIDE 1.18.1. After enabling X-CUBE-AI in the ioc file and performing code generation, the folders /Middlewares/ST/X-CUBE-AI/Inc and /Middlewares/ST/X-CUBE-AI/Lib are created, but no code is generated in those folders. Therefore, when building the project, I get an error such as:

fatal error: ai_platform.h: No such file or directory

In Project Manager → Code Generator → Generated files panel, I unchecked the option “Delete the previously generated files when not regenerated” and regenerated the code, but the problem was not solved. Please help me.

If there is any necessary information that I have not provided, please let me know.

This message was translated into English using generative AI. I apologize for any awkward sentences or expressions.

Thank you.

Best answer by Julian E.

Hello @SR1218,

 

Ok, I did not understand that you had already a project and wanted to add the AI part using X Cube AI.

I think that X Cube AI is useful if starting from scratch. In your case, I would suggest using the ST Edge AI Core directly in command line (X Cube AI is just a GUI of the ST Edge AI Core).

 

Because you've already used X Cube AI, the ST Edge AI Core is already installed on your pc, you can find the .exe here:

C:\Users\your_user\STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\10.2.0\2.2\utilities\windows

 

Then look at the documentation for STM32 here:

https://stedgeai-dc.st.com/assets/embedded-docs/index.html#stm32-target

 

And in particular this two:

Generate the C code model and add it to your ioc project: https://stedgeai-dc.st.com/assets/embedded-docs/stm32_command_line_interface.html#update_c_files

Use the model: https://stedgeai-dc.st.com/assets/embedded-docs/stm32_how_to_run_a_model_locally.html 

 

Have a good day,

Julian

1 reply

Julian E.
Technical Moderator
September 16, 2025

Hello @SR1218,

 

I just tried with a STM32F401RE and I have no issue.

 

Did you follow these steps:

  1. Select your board
  2. Enable X Cube AI and select the application template
  3. Browse for your model
  4. Click Analyze and make sure you don't get an error message
  5. Set a name and click generate

 

Maybe the model you want to use did not pass the generation which is causing the ai_platform.h not to be generated.

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
SR1218Author
Associate II
September 16, 2025

Hello @Julian E. ,

 

I confirmed that if I create a new project and enable X-Cube-AI, the code generation works correctly.

The issue occurs when I import an existing project and then enable X-Cube-AI. My current project already uses libraries such as FreeRTOS and USB Host, and I have made related code modifications. In this case, even after enabling X-Cube-AI and performing code generation, the /Middlewares/ST/X-CUBE-AI/Inc and /Middlewares/ST/X-CUBE-AI/Lib codes are not generated, while the /X-CUBE-AI/App code is generated correctly.

For small projects, creating a new project and reusing the libraries might be a good approach. However, since I have already made significant code modifications, I would prefer not to move everything to a new project.

I would appreciate your guidance on this.

Thank you.

Julian E.
Julian E.Best answer
Technical Moderator
September 16, 2025

Hello @SR1218,

 

Ok, I did not understand that you had already a project and wanted to add the AI part using X Cube AI.

I think that X Cube AI is useful if starting from scratch. In your case, I would suggest using the ST Edge AI Core directly in command line (X Cube AI is just a GUI of the ST Edge AI Core).

 

Because you've already used X Cube AI, the ST Edge AI Core is already installed on your pc, you can find the .exe here:

C:\Users\your_user\STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\10.2.0\2.2\utilities\windows

 

Then look at the documentation for STM32 here:

https://stedgeai-dc.st.com/assets/embedded-docs/index.html#stm32-target

 

And in particular this two:

Generate the C code model and add it to your ioc project: https://stedgeai-dc.st.com/assets/embedded-docs/stm32_command_line_interface.html#update_c_files

Use the model: https://stedgeai-dc.st.com/assets/embedded-docs/stm32_how_to_run_a_model_locally.html 

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.