cancel
Showing results for 
Search instead for 
Did you mean: 

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

Tuomas95
Associate II

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!

 

1 REPLY 1
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.