I have obtained a model by using Google Colab and translate it through TF Lite. I could apply validate on target and validate on desktop process and I did not get any error. However, once CubeAI generated related .h files and I used them, I got two errors, the errors are attached.
Please note that the errors are due to the files that are generated by CubeAI.
Thx for your responses.
Hey, I had the same problem. The error occured when running this code:
The problem was that the code was not inside a function, which means it has to be an initializer - which is assigned only when the item is declared - which means it must be a constant value at compile time!
So to solve the issue I just put the code above inside a function!
I hope it helps!
Hey RU.1,
the problem occured in my case because I tried to run the code from my first post outside of a function. To fix the error i created a function and ran the code in there. That fixed the issue. I hope you understand what I mean. Ill post a code snippet to clarify.
/*
* Test.c
* Created on: Jun 20, 2022
* Author: Cbapt
// The error occurs when you try to call the code from the first post outside of a c function
// The following Code shows the error
// Outside Funktion Call --> Causes Initializer Error!
ai_network_params ai_params ={
AI_CLASSIFYSPEED_DATA_WEIGHTS(ai_classifyspeed_data_weights_get()),
AI_CLASSIFYSPEED_DATA_ACTIVATIONS(activations)
//This fixed it --> Just create a function around the call
ai_error AI_INIT(void)
ai_network_params ai_params ={
AI_CLASSIFYSPEED_DATA_WEIGHTS(ai_classifyspeed_data_weights_get()),
AI_CLASSIFYSPEED_DATA_ACTIVATIONS(activations)
}
I hope it helps.
Best Regards,
cbapt
As I mentioned, the problem is STM32CubeIDE somehow didn't adjust the compiler and linker settings. Once you compile the code, the compiler cannot find the header and source file of XCUBEAI. Therefore, you need to say to compiler that these files are actually source files. You can this by following Right click your project name -> Properties -> C/C++ General -> Paths and Symbols -> Includes(TAB). You than add source files by clicking Add->Workspace buttons.
After that, Right click your project name -> Properties -> C/C++ Build -> MCU GCC Linker -> Libraries, add NetworkRuntime720_CM7_GCC.a here, which can be found under Middlewares -> ST -> Lib directory.
Those images might help you to find the tabs and files to be added. Hope this helps.