summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Burton <richard.burton@arm.com>2022-03-04 14:16:49 +0000
committerRichard Burton <richard.burton@arm.com>2022-03-04 14:16:49 +0000
commitf4f240b13feff77cb85d184c98694388540400f5 (patch)
treebff6f3c8d1bd45b504d2602fbcc7e52d2782e661
parentd5679cc8db0a6ab43369eb91089ea5fe015f552f (diff)
downloadml-embedded-evaluation-kit-f4f240b13feff77cb85d184c98694388540400f5.tar.gz
MLECO-2978: Update to 22.02 dependencies
* Add missing CMake setting used for building driver Signed-off-by: Richard Burton <richard.burton@arm.com> Change-Id: I2aae67d6780f88e661f9a54177943553b0f0dd4c
-rw-r--r--source/hal/components/ethosu_npu_init/CMakeLists.txt54
1 files changed, 30 insertions, 24 deletions
diff --git a/source/hal/components/ethosu_npu_init/CMakeLists.txt b/source/hal/components/ethosu_npu_init/CMakeLists.txt
index 57eef61..59f32bd 100644
--- a/source/hal/components/ethosu_npu_init/CMakeLists.txt
+++ b/source/hal/components/ethosu_npu_init/CMakeLists.txt
@@ -32,27 +32,15 @@ endif()
# For the driver, we need to provide the CMSIS_PATH variable
set(CMSIS_PATH ${CMSIS_SRC_PATH} CACHE PATH "Path to CMSIS directory")
-add_subdirectory(${ETHOS_U_NPU_DRIVER_SRC_PATH} ${CMAKE_BINARY_DIR}/ethos-u-driver)
-
-# Create static library
-add_library(${ETHOS_U_NPU_INIT_COMPONENT} STATIC)
-
-## Include directories - public
-target_include_directories(${ETHOS_U_NPU_INIT_COMPONENT}
- PUBLIC
- include
- ${SOURCE_GEN_DIR})
-
-## Component sources
-target_sources(${ETHOS_U_NPU_INIT_COMPONENT}
- PRIVATE
- ethosu_npu_init.c)
-## Add dependencies:
-target_link_libraries(${ETHOS_U_NPU_INIT_COMPONENT} PUBLIC
- cmsis_device
- ethosu_core_driver
- log)
+# Driver needs to know what MAC configuration to build for.
+if(ETHOS_U_NPU_CONFIG_ID MATCHES "^[A-Z]([0-9]+$)")
+ set(ETHOSU_MACS ${CMAKE_MATCH_1})
+else()
+ message(FATAL_ERROR "Couldn't work out Ethos-U number of MACS from ${ETHOS_U_NPU_CONFIG_ID}")
+endif()
+set(ETHOSU_TARGET_NPU_CONFIG
+ "ethos-${ETHOS_U_NPU_ID}-${ETHOSU_MACS}" CACHE STRING "Target Ethos-U configuration for driver.")
## Memory mode target definition
if (NOT DEFINED ETHOS_U_NPU_ID)
@@ -69,11 +57,9 @@ if (ETHOS_U_NPU_MEMORY_MODE STREQUAL Sram_Only)
else ()
message(FATAL_ERROR "Non compatible Ethos-U NPU memory mode and processor ${ETHOS_U_NPU_MEMORY_MODE} - ${ETHOS_U_NPU_ID}. `sram_only` can be used only for Ethos-U55.")
endif ()
-
elseif (ETHOS_U_NPU_MEMORY_MODE STREQUAL Shared_Sram)
# Shared Sram can be used for Ethos-U55 and Ethos-U65
set(ETHOS_U_NPU_MEMORY_MODE_FLAG "-DETHOS_U_NPU_MEMORY_MODE=ETHOS_U_NPU_MEMORY_MODE_SHARED_SRAM")
-
elseif (ETHOS_U_NPU_MEMORY_MODE STREQUAL Dedicated_Sram)
# Dedicated Sram is used only for Ethos-U65
if (ETHOS_U_NPU_ID STREQUAL U65)
@@ -81,12 +67,32 @@ elseif (ETHOS_U_NPU_MEMORY_MODE STREQUAL Dedicated_Sram)
else ()
message(FATAL_ERROR "Non compatible Ethos-U NPU memory mode and processor ${ETHOS_U_NPU_MEMORY_MODE} - ${ETHOS_U_NPU_ID}. `dedicated_sram` can be used only for Ethos-U65.")
endif ()
-
else ()
message(FATAL_ERROR "Non compatible Ethos-U NPU memory mode ${ETHOS_U_NPU_MEMORY_MODE}")
-
endif ()
+add_subdirectory(${ETHOS_U_NPU_DRIVER_SRC_PATH} ${CMAKE_BINARY_DIR}/ethos-u-driver)
+
+# Create static library
+add_library(${ETHOS_U_NPU_INIT_COMPONENT} STATIC)
+
+## Include directories - public
+target_include_directories(${ETHOS_U_NPU_INIT_COMPONENT}
+ PUBLIC
+ include
+ ${SOURCE_GEN_DIR})
+
+## Component sources
+target_sources(${ETHOS_U_NPU_INIT_COMPONENT}
+ PRIVATE
+ ethosu_npu_init.c)
+
+## Add dependencies:
+target_link_libraries(${ETHOS_U_NPU_INIT_COMPONENT} PUBLIC
+ cmsis_device
+ ethosu_core_driver
+ log)
+
target_compile_definitions(${ETHOS_U_NPU_INIT_COMPONENT}
PUBLIC
${ETHOS_U_NPU_MEMORY_MODE_FLAG})