blob: fdda723ad496d740dd92f06d86b1236239e0cd70 [file] [log] [blame]
Kshitij Sisodiad5679cc2022-03-03 16:30:07 +00001#----------------------------------------------------------------------------
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 Sisodiac22e80e2022-03-14 09:26:48 +000022# 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 Sisodiad5679cc2022-03-03 16:30:07 +000027cmake_minimum_required(VERSION 3.15.6)
Kshitij Sisodiac22e80e2022-03-14 09:26:48 +000028set(ETHOS_U_NPU_TA_COMPONENT ethos_u_ta)
Kshitij Sisodiad5679cc2022-03-03 16:30:07 +000029project(${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
35if (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")
39endif()
40
41## Timing adapter Source path check
42if (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}")
45endif()
46
47add_subdirectory(${ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH} ${CMAKE_BINARY_DIR}/timing_adapter)
48
49# Create static library
50add_library(${ETHOS_U_NPU_TA_COMPONENT} STATIC)
51
52## Include directories - public
53target_include_directories(${ETHOS_U_NPU_TA_COMPONENT}
54 PUBLIC
55 include
56 ${SOURCE_GEN_DIR})
57
58## Component sources
59target_sources(${ETHOS_U_NPU_TA_COMPONENT}
60 PRIVATE
61 ethosu_ta_init.c)
62
Kshitij Sisodiac22e80e2022-03-14 09:26:48 +000063## Compile definitions
64target_compile_definitions(${ETHOS_U_NPU_TA_COMPONENT}
65 PUBLIC
66 ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
67
Kshitij Sisodiad5679cc2022-03-03 16:30:07 +000068## Add dependencies
69target_link_libraries(${ETHOS_U_NPU_TA_COMPONENT} PUBLIC
70 timing_adapter
71 log)
72
73# Display status
74message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
75message(STATUS "*******************************************************")
76message(STATUS "Library : " ${ETHOS_U_NPU_TA_COMPONENT})
77message(STATUS "*******************************************************")