Build C++ Library with STM32CubeIDE

Hi, here’s a quick guide on how to build the C++ Library using STM32CubeIDE.

  1. Export as C++ Library from the Deployment tab in Edge Impulse.
  2. Add the edge-impulse-sdk, tflite-model and model-parameters folder to the Core directory of your project [1]
  3. Right click on the project, select Properties > C/C++ Build > Settings > Tool Settings and add these lines to the ‘Include paths’ for both the GCC and G++ Compiler:
"${workspace_loc:/${ProjName}/Core}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/CMSIS/Core/Include}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/third_party/flatbuffers/include}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/CMSIS/DSP/Include}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/CMSIS/DSP/PrivateInclude}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/CMSIS/NN/Include}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/third_party}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/third_party/flatbuffers}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/third_party/gemmlowp}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/third_party/ruy}"
"${workspace_loc:/${ProjName}/Core/edge-impulse-sdk/third_party}"

That’s it. You can now build as usual.

[1] Because I have no f@&* clue how to mark a folder as ‘contains source code that you need to compile’

3 Likes

[1] Me neither, which is part of my dislike for Eclipse :slight_smile:

I also recommend adding those includes to Debug and Release configurations as well. The Debug configuration will automatically add the -DDEBUG flag, which causes tflite inference to run much more slowly.

1 Like

Thanks a lot @janjongboom …yeah [1] did the trick its compiling fine now. thanks a lot for your help