Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor cmsisnn feature and corstone300 (WIP) #14

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions cmake/features/cmsisnn.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
IF(NOT CMSIS_DIR)
MESSAGE(FATAL_ERROR "Missing value: CMSIS_DIR")
ENDIF()

IF(NOT CMSISNN_DIR)
MESSAGE(FATAL_ERROR "Missing value: CMSISNN_DIR")
ENDIF()
Expand All @@ -24,8 +28,12 @@ IF(RISCV_ABI)
SET(BUILD_FLAGS "${BUILD_FLAGS} -mabi=${RISCV_ABI}")
ENDIF()

SET(CMSISNN_INCLUDE_DIRS ${CMSISNN_DIR} ${CMSISNN_DIR}/CMSIS/Core/Include ${CMSISNN_DIR}/CMSIS/NN/Include
${CMSISNN_DIR}/CMSIS/DSP/Include
SET(CMSISNN_INCLUDE_DIRS
${CMSISNN_DIR}
${CMSISNN_DIR}/Include
${CMSIS_DIR}/CMSIS/Core/Include
# ${CMSISNN_DIR}/CMSIS/NN/Include
# ${CMSISNN_DIR}/CMSIS/DSP/Include
)

# TODO: propagarting all toolchain specific vars does not scale well
Expand All @@ -34,7 +42,8 @@ INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
cmsisnn
PREFIX cmsisnn
SOURCE_DIR ${CMSISNN_DIR}/CMSIS/NN/
# SOURCE_DIR ${CMSISNN_DIR}/CMSIS/NN/
SOURCE_DIR ${CMSISNN_DIR}/
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_C_FLAGS:STRING=${BUILD_FLAGS}
-DCMAKE_CXX_FLAGS:STRING=${BUILD_FLAGS}
Expand All @@ -46,12 +55,13 @@ EXTERNALPROJECT_ADD(
-DARM_FPU=${ARM_FPU}
-DRISCV_ARCH=${RISCV_ARCH}
-DRISCV_ABI=${RISCV_ABI}
-DCMSIS_PATH=${CMSIS_DIR}
BUILD_COMMAND "${CMAKE_COMMAND}" --build . -j 4
INSTALL_COMMAND ""
)

EXTERNALPROJECT_GET_PROPERTY(cmsisnn BINARY_DIR)
SET(CMSISNN_LIB ${BINARY_DIR}/Source/libcmsis-nn.a)
SET(CMSISNN_LIB ${BINARY_DIR}/libcmsis-nn.a)

# TFLite integration
IF(TFLM_OPTIMIZED_KERNEL_LIB)
Expand Down
6 changes: 5 additions & 1 deletion cmake/targets/corstone300.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ SET(CMSIS_PATH
""
CACHE PATH "Path to CMSIS."
)
SET(CMSISNN_PATH
""
CACHE PATH "Path to CMSIS-NN."
)

ADD_COMPILE_OPTIONS(
-fomit-frame-pointer
Expand All @@ -20,7 +24,7 @@ ADD_COMPILE_OPTIONS(
)

SET(FVP_CORSTONE_300_PATH
"${CMSIS_PATH}/CMSIS/NN/Tests/UnitTest/Corstone-300"
"${CMSISNN_PATH}/CMSIS/NN/Tests/UnitTest/Corstone-300"
CACHE PATH "Dependencies for using FVP based on Arm Corstone-300 software."
)
# set(CMAKE_EXECUTABLE_SUFFIX ".elf")
Expand Down