cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid Initializer error with auto-generated code X-CUBE-AI

C. Mart
Associate III

Hello!

I'm having the exact same issue than the one described here: https://community.st.com/s/question/0D53W00001YbCCCSA3/invalid-initializer-and-initializer-element-is-not-constant-errors-in-stmcubeai?t=1662110397892

Wrapping ai_network_params inside a function didn't solve the issue, and also it doesn't make much sense.

OP suggests to adjust settings for the compiler and linker. Anyone can give some guidelines on how to do this properly without breaking anything, or knows any workaround?

Thank you in advance

Regards!

1 ACCEPTED SOLUTION

Accepted Solutions
C. Mart
Associate III

My problem solved when I modified the error occurrences in sin_model.h from this:

AI_DEPRECATED
#define AI_SIN_MODEL_IN  \
  ai_sin_model_inputs_get(AI_HANDLE_NULL, NULL)

to this:

AI_DEPRECATED
#define AI_SIN_MODEL_IN { \
  {ai_sin_model_inputs_get(AI_HANDLE_NULL, NULL)} \
}

 Occurrences were on lines 38-41 and 55-58

View solution in original post

4 REPLIES 4
C. Mart
Associate III

My problem solved when I modified the error occurrences in sin_model.h from this:

AI_DEPRECATED
#define AI_SIN_MODEL_IN  \
  ai_sin_model_inputs_get(AI_HANDLE_NULL, NULL)

to this:

AI_DEPRECATED
#define AI_SIN_MODEL_IN { \
  {ai_sin_model_inputs_get(AI_HANDLE_NULL, NULL)} \
}

 Occurrences were on lines 38-41 and 55-58

C. Mart
Associate III

This removed the compiling error, but still the code does not work.

KK.10
Associate II

X-CUBE-AI 7.0 code example doesn't work with later versions. In my case 7.3.0.

Completely disregard example code for 7.0 version and use code from ST example: "How to perform motion sensing on STM32L4 IoTnode".

Section 6: "Create an STM32Cube.AI application using X-CUBE-AI".

solved for me. thanks