Invalid Initializer error with auto-generated code X-CUBE-AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-02 3:59 AM
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!
Solved! Go to Solution.
- Labels:
-
X-CUBE-AI
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-03 2:42 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-03 2:42 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-06 2:46 AM
This removed the compiling error, but still the code does not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-28 8:34 AM
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".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-06-13 3:10 AM
solved for me. thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-14 4:35 AM
This should solve your problem:
ai_buffer* ai_input = AI_SINE_MODEL_IN;
ai_buffer* ai_output = AI_SINE_MODEL_OUT;
