cancel
Showing results for 
Search instead for 
Did you mean: 

cube AI generated code error

LKan.1
Associate II

When trying to use ai_network_ai_params, I get this error during the build process(my model name is sine_model). How do you fix this?

Build error message:

../Middlewares/ST/AI/Inc/ai_platform.h:323:4: error: 'union <anonymous>' has no member named 'format'

 323 | { .format = (ai_buffer_format)(format_),\

   |  ^~~~~~

../X-CUBE-AI/App/sine_model_data.h:46:3: note: in expansion of macro 'AI_BUFFER_OBJ_INIT'

  46 |  AI_BUFFER_OBJ_INIT( \

   |  ^~~~~~~~~~~~~~~~~~

../Core/Src/main.c:121:5: note: in expansion of macro 'AI_SINE_MODEL_DATA_WEIGHTS'

 121 |   AI_SINE_MODEL_DATA_WEIGHTS(ai_sine_model_data_weights_get()),

   |   ^~~~~~~~~~~~~~~~~~~~~~~~~~

../Middlewares/ST/AI/Inc/ai_platform.h:324:4: error: 'union <anonymous>' has no member named 'n_batches'

 324 |  .n_batches = (n_batches_), \

   |  ^~~~~~~~~

../X-CUBE-AI/App/sine_model_data.h:46:3: note: in expansion of macro 'AI_BUFFER_OBJ_INIT'

  46 |  AI_BUFFER_OBJ_INIT( \

   |  ^~~~~~~~~~~~~~~~~~

../Core/Src/main.c:121:5: note: in expansion of macro 'AI_SINE_MODEL_DATA_WEIGHTS'

 121 |   AI_SINE_MODEL_DATA_WEIGHTS(ai_sine_model_data_weights_get()),

code that calls it:

main.c:

 // Set working memory and get weights/biases from model

 ai_network_params ai_params = {

  AI_SINE_MODEL_DATA_WEIGHTS(ai_sine_model_data_weights_get()),

  AI_SINE_MODEL_DATA_ACTIVATIONS(activations)

 };

sine_model_data.h:

#define AI_SINE_MODEL_DATA_ACTIVATIONS(ptr_) \

 AI_BUFFER_OBJ_INIT( \

  AI_BUFFER_FORMAT_U8, \

  AI_SINE_MODEL_DATA_ACTIVATIONS_COUNT, 1, AI_SINE_MODEL_DATA_ACTIVATIONS_SIZE, 1, \

  AI_HANDLE_PTR(ptr_) )

ai_platform.h:

#define AI_BUFFER_OBJ_INIT(format_, h_, w_, ch_, n_batches_, data_) \

{ .format = (ai_buffer_format)(format_),\

 .n_batches = (n_batches_), \

 .height = (h_), \

 .width = (w_), \

 .channels = (ch_), \

 .data = (ai_handle)(data_), \

 .meta_info = NULL \

}

X-Cube-AI version: 7.0.0

STM32CubeIDE version: 1.7.0

board: B-L475E-IOT01A2 (STM32L475VGT6 MCU)

7 REPLIES 7
GMarc.1
Associate

I have the same problem, did anyone found a solution?

Tim Langer
Associate II

I still have the same issue, did anyone find a solution so far?

Tim Langer
Associate II

TEMPORARY Workaround: Downgrade X-Cube-AI package to version 5.2.0

--> Errors were resolved.

However, a solution for the current version 7.0.0 would be very much appreciated!

DatTran
Associate

ai_network_params ai_params = {AI_SINE_MODEL_DATA_WEIGHTS(ai_sine_model_data_weights_get()), AI_SINE_MODEL_DATA_ACTIVATIONS(activations)};

to

ai_network_params ai_params = AI_NETWORK_PARAMS_INIT(AI_SINE_MODEL_DATA_WEIGHTS(ai_sine_model_data_weights_get()), AI_SINE_MODEL_DATA_ACTIVATIONS(activations));

Because you use the initialization of ver 5.2.0 instead of version 7.0.0

I installed the version 5.2.0 and made the firmware of Openmv Camera again, but I have the same error as before. So, there must be another problem, not the version as you said.

Thank you so much.

Now, I know what the problem was. I used this version X-CUBE-AI.6.0.0 and after that I added the STM32Cube.AI library to OpenMV, what I forgot to do. So, that was my problem. That was my fault and I didn’t do the following step:

1.4 Step 2 - Add the STM32Cube.AI library to OpenMV

Thank you very much for your help, again. But there is no need to use this version 5.2.0.

HElah.1
Associate II

I explain what I've done, then you can do it for your project as you need, if your project is a little bit different.

Now, I know what the problem was. I used this version X-CUBE-AI.6.0.0 and after that I added the STM32Cube.AI library to OpenMV, what I forgot to do. So, that was my problem. That was my fault and I didn’t do the following step:

1.4 Step 2 - Add the STM32Cube.AI library to OpenMV

But there is no need to use this version 5.2.0.