Error when using Tflite Micro + CMSIS-NN

Hello everyone!
I am designing a TfLite Micro project using CMSIS-NN:

  • Configuration in platformio.ini:
[env:portenta_h7_m7]
platform = ststm32
board = portenta_h7_m7
framework = arduino
  • Using CMSIS-NN placed in the lib folder: \lib\tensorflow-lite\third_party\cmsis_nn
    → When compiling, the following error occurs:
  Linking .pio\\build\\portenta_h7_m7\\firmware.elf
  .pio\\build\\portenta_h7_m7\\libb7a\\libtensorflow-lite.a(arm_elementwise_add_s8.c.o): In function `arm_elementwise_add_s8': arm_elementwise_add_s8.c:(.text.arm_elementwise_add_s8+0x11c): undefined reference to `\__sadd16’
  arm_elementwise_add_s8.c:(.text.arm_elementwise_add_s8+0x12a): undefined reference to `__sadd16' arm_elementwise_add_s8.c:(.text.arm_elementwise_add_s8+0x138): undefined reference to `\__sadd16’
  arm_elementwise_add_s8.c:(.text.arm_elementwise_add_s8+0x14a): undefined reference to `__sadd16' .pio\build\portenta_h7_m7\libb7a\libtensorflow-lite.a(arm_depthwise_conv_3x3_s8.c.o): In function `arm_depthwise_conv_3x3_s8’:
  arm_depthwise_conv_3x3_s8.c:(.text.arm_depthwise_conv_3x3_s8+0x396): undefined reference to `__smlabb' arm_depthwise_conv_3x3_s8.c:(.text.arm_depthwise_conv_3x3_s8+0x3aa): undefined reference to `\__smlatt’
  arm_depthwise_conv_3x3_s8.c:(.text.arm_depthwise_conv_3x3_s8+0x3ba): undefined reference to \`\__smlabb’ 

I’ve tried many methods and used many different CMSIS-NN libraries but haven’t been able to fix it. I need help.

Thank you very much.

How can reproduce your exact project? You don’t link to the exact source of your tensorflow-lite library version or CMSIS-NN.

1 Like

Sorry, I’m resending the project’s git file:

https://github.com/IzIzumi/H_TFlitemicro_CMSISNN.git

Please confirm this for me.

If you have a working version of tflitemicro + CMSIS-NN, could you send it to me for reference? : ))

Yeah that one’s a 404 not found.

1 Like

I already made it public, I don’t understand why you can’t access it :((
I’ve fixed this error, although it’s not perfect (create a header file .h myself).
Thank you for your help.

https://github.com/IzIzumi

Even the username cannot resolved! Typo?

1 Like

Sorry maxgerhardt, sivar2311, for bothering you again.
Cc: All members

Although I created my own intrinsic functions for __smlabb, __sxtb16… to build successfully, the model’s inference results are inaccurate. I searched online (GPT chat, web) and found that self-defined functions lead to functions that don’t work according to CMSIS’s nature.

I tried changing the gcc toolchain to newer versions like gcc 9.3, 10.3, 12.2, 14.x (platform_packages = toolchain-gccarmnoneeabi@~1.120201.0), the build was successful, but when I turned on Serial Monitor, the COM port was not visible.

Additionally, I’ve set many flags in platformio.ini to enable SMSIS DSP, but the result is still the same error.

I’m sending the project link again (if the git file is broken, please download from Google Drive) and I’d appreciate it if you could help me fix it.

https://github.com/IzIzumi/Test.git

Thank you very much.