Skip to content

Commit

Permalink
Add cmsis-nn
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Gloor <code@stefan-gloor.ch>
  • Loading branch information
stgloorious committed Jun 8, 2024
1 parent b268b75 commit 98f4ff1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "third_party/libcrc"]
path = third_party/libcrc
url = https://github.com/lammertb/libcrc.git
[submodule "third_party/CMSIS-NN"]
path = third_party/CMSIS-NN
url = https://github.com/ARM-software/CMSIS-NN.git
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ project(stm32-speech-recognition C ASM CXX)
# Bare-metal project
set(CMAKE_SYSTEM_NAME Generic)

# For CMSIS-NN
include(ExternalProject)

# Compiler settings
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-c++)
Expand Down Expand Up @@ -125,6 +128,14 @@ add_custom_target(gentab32 COMMAND make -C
add_library(crc32 STATIC ${CMAKE_SOURCE_DIR}/third_party/libcrc/src/crc32.c)
add_dependencies(crc32 gentab32)

# CMSIS-NN
ExternalProject_Add(cmsis-nn
SOURCE_DIR ${CMAKE_SOURCE_DIR}/third_party/CMSIS-NN
INSTALL_COMMAND ""
)
add_library(cmsisnn SHARED IMPORTED)
set_target_properties(cmsisnn PROPERTIES IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/cmsis-nn-prefix/src/cmsis-nn-build/libcmsis-nn.a)
# Project sources
FILE(GLOB demo_srcs src/*.c
src/*.cc
Expand All @@ -134,7 +145,7 @@ FILE(GLOB demo_srcs src/*.c
)

add_executable(demo.elf ${demo_srcs})
target_link_libraries(demo.elf hal tflm crc32)
target_link_libraries(demo.elf hal tflm crc32 cmsisnn)

# st-util wants a binary-only format, not an ELF
add_custom_target(bin ALL DEPENDS demo.elf
Expand Down
1 change: 1 addition & 0 deletions third_party/CMSIS-NN
Submodule CMSIS-NN added at 0d42c3

0 comments on commit 98f4ff1

Please sign in to comment.