blob: 4651cf296d277d9639411a83abe314a883e4b940 [file] [log] [blame]
Kristofer Jonsson49bdee82020-04-06 13:21:21 +02001#
2# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: Apache-2.0
5#
6# Licensed under the Apache License, Version 2.0 (the License); you may
7# not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an AS IS BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19cmake_minimum_required(VERSION 3.15.6)
20
21project(ethosu_core_driver VERSION 0.0.1)
22
23#
24# Build options
25#
26
Kristofer Jonsson537c71c2020-05-05 14:17:22 +020027option(DRIVER_PMU_AUTOINIT "Enable PMU boot auto-initialization" OFF)
Kristofer Jonssondaa0d202020-05-12 12:23:16 +020028option(DRIVER_LOG_SUPPORT "Enable logging." OFF)
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020029
Kristofer Jonsson537c71c2020-05-05 14:17:22 +020030set(CMSIS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmsis" CACHE PATH "Path to CMSIS.")
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020031
32#
33# Global settings
34#
35
36if(CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m0")
37 add_compile_definitions(CPU_CORTEX_M0)
38elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m3")
39 add_compile_definitions(CPU_CORTEX_M3)
40elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m33")
41 add_compile_definitions(CPU_CORTEX_M33)
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020042elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m4")
43 add_compile_definitions(CPU_CORTEX_M4)
44elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m55")
45 add_compile_definitions(CPU_CORTEX_M55)
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020046elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m7")
47 add_compile_definitions(CPU_CORTEX_M7)
48else()
49 message(FATAL_ERROR "Unsupported compiler ${CMAKE_SYSTEM_PROCESSOR}.")
50endif()
51
52# Enable logging support
Kristofer Jonssondaa0d202020-05-12 12:23:16 +020053if(DRIVER_LOG_SUPPORT)
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020054 add_compile_definitions(LOG_ENABLED)
55endif()
56
Jonny Svärdb64628f2020-06-02 15:24:54 +020057# Enable PMU boot auto-initialization
58if(DRIVER_PMU_AUTOINIT)
59 add_compile_definitions(PMU_AUTOINIT)
60endif()
61
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020062# Make include directories available for current- and sub projects
63include_directories(include src)
64include_directories(${CMSIS_PATH}/CMSIS/Core/Include)
65
66#
67# Build libraries
68#
69
70# Build driver library
71add_library(ethosu_core_driver STATIC)
Kristofer Jonsson537c71c2020-05-05 14:17:22 +020072target_include_directories(ethosu_core_driver PUBLIC include)
73target_sources(ethosu_core_driver PRIVATE src/ethosu_driver.c src/ethosu_device.c src/ethosu_pmu.c)
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020074
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020075#
76# Print build status
77#
78
79message(STATUS "*******************************************************")
80message(STATUS "PROJECT_NAME : ${PROJECT_NAME}")
81message(STATUS "CMAKE_SYSTEM_PROCESSOR : ${CMAKE_SYSTEM_PROCESSOR}")
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020082message(STATUS "CMSIS_PATH : ${CMSIS_PATH}")
Kristofer Jonssondaa0d202020-05-12 12:23:16 +020083message(STATUS "DRIVER_LOG_SUPPORT : ${DRIVER_LOG_SUPPORT}")
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020084message(STATUS "*******************************************************")