blob: 6f7dac5c1f47e2f0a186151f7b5940105e2aff33 [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
Kshitij Sisodia8bc863d2022-03-24 17:53:34 +000034## Source generated Source path check
35if (NOT DEFINED SOURCE_GEN_DIR)
36 set(SOURCE_GEN_DIR ${CMAKE_BINARY_DIR}/generated/ta)
37endif()
38
Kshitij Sisodiad5679cc2022-03-03 16:30:07 +000039## If a TA config file is provided, we generate a settings file
40if (DEFINED TA_CONFIG_FILE)
41 include(${TA_CONFIG_FILE})
42 set(TA_SETTINGS_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/timing_adapter_settings.template)
43 configure_file("${TA_SETTINGS_TEMPLATE}" "${SOURCE_GEN_DIR}/timing_adapter_settings.h")
44endif()
45
46## Timing adapter Source path check
47if (NOT DEFINED ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH)
48 message(FATAL_ERROR "ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH should"
49 " be defined when ETHOS_U_NPU_ENABLED=${ETHOS_U_NPU_ENABLED}")
50endif()
51
52add_subdirectory(${ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH} ${CMAKE_BINARY_DIR}/timing_adapter)
53
54# Create static library
55add_library(${ETHOS_U_NPU_TA_COMPONENT} STATIC)
56
57## Include directories - public
58target_include_directories(${ETHOS_U_NPU_TA_COMPONENT}
59 PUBLIC
60 include
61 ${SOURCE_GEN_DIR})
62
63## Component sources
64target_sources(${ETHOS_U_NPU_TA_COMPONENT}
65 PRIVATE
66 ethosu_ta_init.c)
67
Kshitij Sisodiac22e80e2022-03-14 09:26:48 +000068## Compile definitions
69target_compile_definitions(${ETHOS_U_NPU_TA_COMPONENT}
70 PUBLIC
71 ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
72
Kshitij Sisodiad5679cc2022-03-03 16:30:07 +000073## Add dependencies
74target_link_libraries(${ETHOS_U_NPU_TA_COMPONENT} PUBLIC
75 timing_adapter
76 log)
77
78# Display status
79message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
80message(STATUS "*******************************************************")
81message(STATUS "Library : " ${ETHOS_U_NPU_TA_COMPONENT})
82message(STATUS "*******************************************************")