CMSIS NN Libraries in Segger Embedded Studio project

Hi,

I am trying to include the CMSIS-NN libraries inside the segger project. Since they are not available in the software package inside Segger Embedded Studio, I pulled in the repo and copied the file manually to the include location. Here is what I did step by step:

  1. Cloned the https://github.com/ARM-software/CMSIS_5 repsitory
  2. Copied the NN folder inside $(PackagesDir)/CMSIS_5/CMSIS/ folder
  3. Added the entry $(PackagesDir)/CMSIS_5/CMSIS/NN/Include to project options->preprocessor (common configuration) -> User include directories inside segger
  4. Built the NN library using the command (using instructions posted here https://github.com/ARM-software/CMSIS_5/tree/develop/CMSIS/NN ): 
    1. cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../ethos-u-core-platform/cmake/toolchain/arm-none-eabi-gcc.cmake
      -DTARGET_CPU=cortex-m4
    2. make
  5. Copied the generated libcmsis-nn.a file to the $(PackagesDir)/CMSIS_5/CMSIS/lib/ES folder
  6. Added the entry $(PackagesDir)/CMSIS_5/CMSIS/Lib/ES/libcmsis-nn.a to linker->additional input files  inside segger
  7. I included the #include "arm_nnfunctions.h" headerand tried compiling a code with one function that is available inside the NN library (function name is arm_convolve_HWC_q7_RGB)

All entries were added inside segger under the common configuration.

However, during compile time, I get the following error:

undefined reference to `arm_convolve_HWC_q7_RGB'

Parents
  • Hi,

    If the only errors you get are from the linker, then there is either a problem with how you built the library (is there some configuration of which functions are included when you build the library perhaps?), or there is a problem with how you added the library to your project.

    Assuming you built the library properly for the correct target and toolchain, then you just need to add the binary library file to the project in the exact same way as you add a C file (right click on a folder under Project items and select "Add existing file"). I believe that should do the same as "Additional input files" as you do in step 6 though, but I suggest you do as I suggested as that should work and is what we do in all SDK example projects. Lastly, you need to add the include path in your SES  project, as you write in 3. That seems to be in order though, as the "undefined reference to" error is from the linker (assuming you did not get any other warnings or errors before this?).

Reply
  • Hi,

    If the only errors you get are from the linker, then there is either a problem with how you built the library (is there some configuration of which functions are included when you build the library perhaps?), or there is a problem with how you added the library to your project.

    Assuming you built the library properly for the correct target and toolchain, then you just need to add the binary library file to the project in the exact same way as you add a C file (right click on a folder under Project items and select "Add existing file"). I believe that should do the same as "Additional input files" as you do in step 6 though, but I suggest you do as I suggested as that should work and is what we do in all SDK example projects. Lastly, you need to add the include path in your SES  project, as you write in 3. That seems to be in order though, as the "undefined reference to" error is from the linker (assuming you did not get any other warnings or errors before this?).

Children
Related