Kshitij Sisodia | b59ba68 | 2021-11-23 17:19:52 +0000 | [diff] [blame] | 1 | #---------------------------------------------------------------------------- |
Isabella Gottardi | ee4920b | 2022-02-25 14:29:32 +0000 | [diff] [blame] | 2 | # Copyright (c) 2021-2022 Arm Limited. All rights reserved. |
Kshitij Sisodia | b59ba68 | 2021-11-23 17:19:52 +0000 | [diff] [blame] | 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | #---------------------------------------------------------------------------- |
| 17 | |
| 18 | #---------------------------------------------------------------------------- |
| 19 | # This file should contain all the common user options for the application |
| 20 | # For use case specific options, see individual usecase.cmake files under |
| 21 | # each example use case. |
| 22 | #---------------------------------------------------------------------------- |
| 23 | |
| 24 | if (NOT DEFINED USER_OPTIONS_INCLUDED) |
| 25 | set(USER_OPTIONS_INCLUDED ON) |
| 26 | else() |
| 27 | return() |
| 28 | endif() |
| 29 | |
| 30 | message(STATUS "Assessing common user options...") |
| 31 | |
Kshitij Sisodia | b59ba68 | 2021-11-23 17:19:52 +0000 | [diff] [blame] | 32 | include(${CMAKE_CURRENT_LIST_DIR}/util_functions.cmake) |
| 33 | |
| 34 | USER_OPTION(LOG_LEVEL "Log level for the application" |
| 35 | LOG_LEVEL_INFO |
| 36 | STRING) |
| 37 | |
| 38 | USER_OPTION(TENSORFLOW_SRC_PATH "Path to the root of the tensor flow directory" |
| 39 | "${DEPENDENCY_ROOT_DIR}/tensorflow" |
| 40 | PATH) |
| 41 | |
| 42 | USER_OPTION(TARGET_PLATFORM "Target platform to execute evaluation application: mps3, simple_platform, native" |
| 43 | mps3 |
| 44 | STRING) |
| 45 | |
| 46 | USER_OPTION(TARGET_SUBSYSTEM "Specify platform target subsystem: sse-300 or none" |
| 47 | sse-300 |
| 48 | STRING) |
| 49 | |
| 50 | if (TARGET_PLATFORM STREQUAL native) |
| 51 | set(NPU_AVAILABLE OFF) |
| 52 | else() |
| 53 | set(NPU_AVAILABLE ON) |
| 54 | endif() |
| 55 | |
| 56 | USER_OPTION(ETHOS_U_NPU_ENABLED "If Arm Ethos-U NPU is enabled in the target system." |
| 57 | ${NPU_AVAILABLE} |
| 58 | BOOL) |
| 59 | |
| 60 | USER_OPTION(USE_CASE_BUILD "Optional. Defines the use-case to build from the available sources. By default, all use-cases are built." |
| 61 | all |
| 62 | STRING) |
| 63 | |
| 64 | USER_OPTION(CPU_PROFILE_ENABLED "Output CPU performance profiling information. Should be used only for MPS3 board." |
| 65 | OFF |
| 66 | BOOL) |
| 67 | |
| 68 | USER_OPTION(TENSORFLOW_LITE_MICRO_BUILD_TYPE "TensorFlow Lite Mirco build type (release/debug etc.)" |
| 69 | $<IF:$<CONFIG:RELEASE>,release_with_logs,debug> |
| 70 | STRING) |
| 71 | |
| 72 | USER_OPTION(TENSORFLOW_LITE_MICRO_CLEAN_DOWNLOADS "Select if TPIP downloads should be cleaned before each build." |
| 73 | OFF |
| 74 | BOOL) |
| 75 | |
| 76 | USER_OPTION(TENSORFLOW_LITE_MICRO_CLEAN_BUILD "Select if clean target should be added to a list of targets" |
| 77 | ON |
| 78 | BOOL) |
| 79 | |
| 80 | if (NOT TARGET_PLATFORM STREQUAL native) |
| 81 | |
| 82 | USER_OPTION(CMSIS_SRC_PATH |
| 83 | "Path to CMSIS-5 sources" |
| 84 | "${DEPENDENCY_ROOT_DIR}/cmsis" |
| 85 | PATH) |
| 86 | |
Kshitij Sisodia | b59ba68 | 2021-11-23 17:19:52 +0000 | [diff] [blame] | 87 | # If we need NPU libraries: |
| 88 | if (ETHOS_U_NPU_ENABLED) |
| 89 | USER_OPTION(ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH |
| 90 | "Path to Ethos-U NPU timing adapter sources" |
Richard Burton | b4123fd | 2022-03-04 09:19:09 +0000 | [diff] [blame] | 91 | "${DEPENDENCY_ROOT_DIR}/core-platform/drivers/timing_adapter" |
Kshitij Sisodia | b59ba68 | 2021-11-23 17:19:52 +0000 | [diff] [blame] | 92 | PATH |
| 93 | ) |
| 94 | |
| 95 | USER_OPTION(ETHOS_U_NPU_DRIVER_SRC_PATH |
| 96 | "Path to Ethos-U NPU core driver sources" |
| 97 | "${DEPENDENCY_ROOT_DIR}/core-driver" |
| 98 | PATH |
| 99 | ) |
| 100 | |
| 101 | USER_OPTION(ETHOS_U_NPU_ID "Arm Ethos-U NPU IP (U55 or U65)" |
| 102 | "U55" |
| 103 | STRING) |
| 104 | |
| 105 | if ((ETHOS_U_NPU_ID STREQUAL U55) OR (ETHOS_U_NPU_ID STREQUAL U65)) |
| 106 | if (ETHOS_U_NPU_ID STREQUAL U55) |
| 107 | set(DEFAULT_NPU_MEM_MODE "Shared_Sram") |
Isabella Gottardi | ee4920b | 2022-02-25 14:29:32 +0000 | [diff] [blame] | 108 | set(DEFAULT_NPU_CONFIG_ID "H128") |
Kshitij Sisodia | b59ba68 | 2021-11-23 17:19:52 +0000 | [diff] [blame] | 109 | elseif(ETHOS_U_NPU_ID STREQUAL U65) |
| 110 | set(DEFAULT_NPU_MEM_MODE "Dedicated_Sram") |
Isabella Gottardi | ee4920b | 2022-02-25 14:29:32 +0000 | [diff] [blame] | 111 | set(DEFAULT_NPU_CONFIG_ID "Y256") |
| 112 | set(DEFAULT_NPU_CACHE_SIZE "393216") |
| 113 | |
| 114 | USER_OPTION(ETHOS_U_NPU_CACHE_SIZE "Arm Ethos-U65 NPU Cache Size" |
| 115 | "${DEFAULT_NPU_CACHE_SIZE}" |
| 116 | STRING) |
Kshitij Sisodia | b59ba68 | 2021-11-23 17:19:52 +0000 | [diff] [blame] | 117 | endif() |
| 118 | else () |
| 119 | message(FATAL_ERROR "Non compatible Ethos-U NPU processor ${ETHOS_U_NPU_ID}") |
| 120 | endif () |
| 121 | |
| 122 | USER_OPTION(ETHOS_U_NPU_MEMORY_MODE "Specifies the memory mode used in the Vela command." |
| 123 | "${DEFAULT_NPU_MEM_MODE}" |
| 124 | STRING) |
| 125 | |
| 126 | USER_OPTION(ETHOS_U_NPU_CONFIG_ID "Specifies the configuration ID for the NPU." |
| 127 | "${DEFAULT_NPU_CONFIG_ID}" |
| 128 | STRING) |
| 129 | |
| 130 | if (ETHOS_U_NPU_ID STREQUAL U55) |
| 131 | set(DEFAULT_TA_CONFIG_FILE_PATH "${CMAKE_CURRENT_LIST_DIR}/timing_adapter/ta_config_u55_high_end.cmake") |
| 132 | else () |
| 133 | set(DEFAULT_TA_CONFIG_FILE_PATH "${CMAKE_CURRENT_LIST_DIR}/timing_adapter/ta_config_u65_high_end.cmake") |
| 134 | endif () |
| 135 | |
Kshitij Sisodia | d5679cc | 2022-03-03 16:30:07 +0000 | [diff] [blame] | 136 | USER_OPTION(ETHOS_U_NPU_TIMING_ADAPTER_ENABLED "Specifies if the Ethos-U timing adapter is enabled" |
| 137 | ON |
| 138 | BOOL) |
| 139 | |
| 140 | if (ETHOS_U_NPU_TIMING_ADAPTER_ENABLED) |
| 141 | USER_OPTION(TA_CONFIG_FILE "Path to the timing adapter configuration file" |
| 142 | ${DEFAULT_TA_CONFIG_FILE_PATH} |
| 143 | FILEPATH) |
| 144 | endif() |
Kshitij Sisodia | b59ba68 | 2021-11-23 17:19:52 +0000 | [diff] [blame] | 145 | endif() |
| 146 | endif() |