Kshitij Sisodia | d5679cc | 2022-03-03 16:30:07 +0000 | [diff] [blame] | 1 | #---------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2022 Arm Limited. All rights reserved. |
| 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 | # Ethos-U NPU timing adapter initialization library # |
| 20 | ######################################################### |
| 21 | |
Kshitij Sisodia | c22e80e | 2022-03-14 09:26:48 +0000 | [diff] [blame^] | 22 | # Timing adapter component is only available on certain implementations |
| 23 | # on FPGA and FVP where it is necessary to run bandwidth and latency |
| 24 | # sweeps on the Arm Ethos-U NPUs. The wrapper library here provides an |
| 25 | # easy way to add initialisation of the timing adapter block. |
| 26 | |
Kshitij Sisodia | d5679cc | 2022-03-03 16:30:07 +0000 | [diff] [blame] | 27 | cmake_minimum_required(VERSION 3.15.6) |
Kshitij Sisodia | c22e80e | 2022-03-14 09:26:48 +0000 | [diff] [blame^] | 28 | set(ETHOS_U_NPU_TA_COMPONENT ethos_u_ta) |
Kshitij Sisodia | d5679cc | 2022-03-03 16:30:07 +0000 | [diff] [blame] | 29 | project(${ETHOS_U_NPU_TA_COMPONENT} |
| 30 | DESCRIPTION "Ethos-U NPU timing adapter initialization library" |
| 31 | LANGUAGES C CXX ASM) |
| 32 | |
| 33 | # Checks |
| 34 | ## If a TA config file is provided, we generate a settings file |
| 35 | if (DEFINED TA_CONFIG_FILE) |
| 36 | include(${TA_CONFIG_FILE}) |
| 37 | set(TA_SETTINGS_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/timing_adapter_settings.template) |
| 38 | configure_file("${TA_SETTINGS_TEMPLATE}" "${SOURCE_GEN_DIR}/timing_adapter_settings.h") |
| 39 | endif() |
| 40 | |
| 41 | ## Timing adapter Source path check |
| 42 | if (NOT DEFINED ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH) |
| 43 | message(FATAL_ERROR "ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH should" |
| 44 | " be defined when ETHOS_U_NPU_ENABLED=${ETHOS_U_NPU_ENABLED}") |
| 45 | endif() |
| 46 | |
| 47 | add_subdirectory(${ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH} ${CMAKE_BINARY_DIR}/timing_adapter) |
| 48 | |
| 49 | # Create static library |
| 50 | add_library(${ETHOS_U_NPU_TA_COMPONENT} STATIC) |
| 51 | |
| 52 | ## Include directories - public |
| 53 | target_include_directories(${ETHOS_U_NPU_TA_COMPONENT} |
| 54 | PUBLIC |
| 55 | include |
| 56 | ${SOURCE_GEN_DIR}) |
| 57 | |
| 58 | ## Component sources |
| 59 | target_sources(${ETHOS_U_NPU_TA_COMPONENT} |
| 60 | PRIVATE |
| 61 | ethosu_ta_init.c) |
| 62 | |
Kshitij Sisodia | c22e80e | 2022-03-14 09:26:48 +0000 | [diff] [blame^] | 63 | ## Compile definitions |
| 64 | target_compile_definitions(${ETHOS_U_NPU_TA_COMPONENT} |
| 65 | PUBLIC |
| 66 | ETHOS_U_NPU_TIMING_ADAPTER_ENABLED) |
| 67 | |
Kshitij Sisodia | d5679cc | 2022-03-03 16:30:07 +0000 | [diff] [blame] | 68 | ## Add dependencies |
| 69 | target_link_libraries(${ETHOS_U_NPU_TA_COMPONENT} PUBLIC |
| 70 | timing_adapter |
| 71 | log) |
| 72 | |
| 73 | # Display status |
| 74 | message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR}) |
| 75 | message(STATUS "*******************************************************") |
| 76 | message(STATUS "Library : " ${ETHOS_U_NPU_TA_COMPONENT}) |
| 77 | message(STATUS "*******************************************************") |