cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX code generation fails with specific X-CUBE-AI settings

Tuomas95
Associate III

Hello,

 

I'm having trouble getting the CubeMX code generation to work reliably with X-CUBE-AI package.

After first adding X-CUBE-AI to the project, and adding one of the models from the ST model zoo, i get this warning:

Tuomas95_0-1769434174337.png

If i click Yes, the code generation takes about 5 minutes and works.

Note that in the above picture, X-CUBE-AI ExtMemLoader is selected. This is also where the warning comes from. AFAIK, i don't need X-CUBE-AI ExtMemLoader, just the Application. If i remove the checks from the checkboxes "Artificial Inteligence X-Cube-Ai" and "Device Appliccation", and then reopen MX, the X-CUBE-AI ExtMemLoader will disappear, and just the X-CUBE-AI Application remains. However, after trying to generate code with that setup, the code generation hangs to the below phase of code generation:

Tuomas95_1-1769434475163.png

 

At that state, the OpenJDK Platform binary uses over 6000 MB of RAM, and about 10% of my CPU but seemingly nothing happens. I waited over the weekend to see if the generation would finish but it did not, then I retried multiple times, waiting about 20 minutes each time and it always hangs there.

Also there are some paths in the mx-generated.cmake which are wrong i think, as the code fails to build:

[0/1] Re-running CMake...Build type: Debug
-- Configuring done (0.4s)
CMake Error at mx-generated.cmake:147 (target_sources):
Cannot find source file:

C:/Users/tuoma/STM32Cube/helium_test/Src/audio_network.c
Call Stack (most recent call first):
CMakeLists.txt:40 (include)


CMake Error at mx-generated.cmake:137 (target_sources):
Cannot find source file:

C:/Users/tuoma/STM32Cube/helium_test/Middlewares/ST/AI/Npu/ll_aton/ecloader.c
Call Stack (most recent call first):
CMakeLists.txt:40 (include)


CMake Error at mx-generated.cmake:136 (add_library):
No SOURCES given to target: ST
Call Stack (most recent call first):
CMakeLists.txt:40 (include)


CMake Generate step failed. Build files cannot be regenerated correctly.

but builds after adjusting the paths:

Tuomas95_2-1769434656783.png

and fixing missing include in generated app_x-cube-ai.c file

C:/Users/tuoma/STM32Cube/helium_test/CORTEX_HELIUM/Appli/Src/app_x-cube-ai.c:50:1: warning: return type defaults to 'int' [-Wimplicit-int]
50 | LL_ATON_DECLARE_NAMED_NN_INSTANCE_AND_INTERFACE()
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/tuoma/STM32Cube/helium_test/CORTEX_HELIUM/Appli/Src/app_x-cube-ai.c: In function 'LL_ATON_DECLARE_NAMED_NN_INSTANCE_AND_INTERFACE':
C:/Users/tuoma/STM32Cube/helium_test/CORTEX_HELIUM/Appli/Src/app_x-cube-ai.c:55:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
55 | {
| ^

The issue is that LL_ATON_DECLARE_NAMED_NN_INSTANCE_AND_INTERFACE is not found, but after adding 

#include "ll_aton_rt_user_api.h" the project finally builds.

Here is the X-CUBE-AI Application config:

Tuomas95_3-1769434946515.png

The model is from here https://github.com/STMicroelectronics/stm32ai-modelzoo/blob/main/audio_event_detection/yamnet/README.md

 

Thanks!

 

4 REPLIES 4
Souhaib MAZHOUD
ST Employee

Hello @Tuomas95 

Could you please add your ioc in order to investigate the issue?

KR, Souhaib

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.

Souhaib MAZHOUD
ST Employee

Hello @Tuomas95 

In the Software pack Selector, it is mentioned that the External Memory Loader does not support Software pack, How did you enable the X-CUBE-AI ExtMemLoader?

SouhaibMAZHOUD_0-1769613430739.png

Otherwise, let's try disable and re-enable X-Cube-AI and check please. Or can you try delete .stm32cubemx folder under \Users\<username> and check if the issue persists?

BR, Souhaib

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.

Tuomas95
Associate III

Hello @Souhaib MAZHOUD ,

I'm not sure how it got enabled, i did not enable it with intention to do so at least. Now i cannot disable it from MX.

I removed everything related to X-CUBE-AI_ExtMemLoader from the .ioc file, but the generation still gets stuck to "Saving project settings...", even after deleting the .stm32cubemx folder under \Users\<username>.

I can see that a TMPAILIB folder is created under the working directory, i assume it should be deleted after the generation?

BR, Tuomas

Hello @Tuomas95 

Thanks for your feedback ,

The issue has been reported to the dedicated team for internal investigation and resolution. (Ticket 226216 This is an internal tracking number and is not accessible or usable by customers.)

BR, Souhaib

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.