2024-06-03 09:43 AM
Hello,
I am trying to build a simple AI app on my stm32f7 discovery board.
In VSCode when I try to build my cmake project (simple hello world DNN) generated with STM32CubeMX and TFlite Micro runtime (application template), I get a lot of linker errors:
[build] C:/ST/STM32CubeCLT_1.15.1/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/ai_app2_tfruntime.dir/X-CUBE-AI/App/app_x-cube-ai.c.obj: in function `ai_boostrap':
[build] C:/projects/ml/st_trials/ai_app2_tfruntime/X-CUBE-AI/App/app_x-cube-ai.c:77: undefined reference to `tflm_c_create'
[build] C:/ST/STM32CubeCLT_1.15.1/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/projects/ml/st_trials/ai_app2_tfruntime/X-CUBE-AI/App/app_x-cube-ai.c:87: undefined reference to `tflm_c_operators_size'
[build] C:/ST/STM32CubeCLT_1.15.1/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/projects/ml/st_trials/ai_app2_tfruntime/X-CUBE-AI/App/app_x-cube-ai.c:88: undefined reference to `tflm_c_tensors_size'
[...lots of other errors...]
All of them seem related to the declarations in tflm_c.h and the linker not finding the C++ definition in tflm_c.cc.
If I add tflm_c.cc as source (in cmake/stm32cubemx/CMakeLists.txt), I get a lot of other linker errors:
[build] C:/ST/STM32CubeCLT_1.15.1/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/ai_app2_tfruntime.dir/X-CUBE-AI/App/tflm_c.cc.obj: in function `AbortImpl()':
[build] C:/projects/ml/st_trials/ai_app2_tfruntime/cmake/stm32cubemx/../../Middlewares/tensorflow/tensorflow/lite/kernels/op_macros.h:25: undefined reference to `DebugLog'
[build] C:/ST/STM32CubeCLT_1.15.1/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/ai_app2_tfruntime.dir/X-CUBE-AI/App/tflm_c.cc.obj: in function `tflite::MicroErrorReporter::~MicroErrorReporter()':
[build] C:/projects/ml/st_trials/ai_app2_tfruntime/cmake/stm32cubemx/../../Middlewares/tensorflow/tensorflow/lite/micro/tflite_bridge/micro_error_reporter.h:28: undefined reference to `vtable for tflite::MicroErrorReporter'
[...lots of other errors...]
How can I solve this?
N-B: I use the toolchain that comes with CubeCLT version 1.15.1.
Thanks in advance, Best regards
Jérémie