blob: 4e766dff50008e66015db93e2a5e4b05f769e0d4 [file] [log] [blame]
Kristofer Jonsson43ce4912020-11-20 09:42:53 +01001#
Anton Mobergfa3e51b2021-03-31 11:05:02 +02002# Copyright (c) 2020-2021 Arm Limited. All rights reserved.
Kristofer Jonsson43ce4912020-11-20 09:42:53 +01003#
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
19#############################################################################
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010020# Default parameters
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010021#############################################################################
22
23set(TARGET_CPU "cortex-m55")
24
25if (NOT CMAKE_TOOLCHAIN_FILE)
26 set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/toolchain/armclang.cmake")
27endif()
28
Jonas Ohlssone0da7e02021-05-04 12:38:27 +020029set(ETHOSU_COMMAND_DEFAULT python3 ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/run_ctest.py -t corstone-300)
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010030
Jonny Svärd991af2b2021-04-15 17:31:01 +020031option(CPU_CACHE_ENABLE "Enable CPU instruction- and data cache" ON)
32
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010033#############################################################################
34# Project
35#############################################################################
36
Jonas Ohlssone0da7e02021-05-04 12:38:27 +020037# Note: On Windows systems CMake 3.20.0 might cause issues with errouneous dependency make files.
38# Issues solved with CMake 3.20.1.
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010039cmake_minimum_required(VERSION 3.15.6)
40
41project(ethos-u-corstone-300 VERSION 0.0.1)
42
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010043include(CTest)
44
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010045include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/helpers.cmake)
46
Per Åstrand0954a8a2021-03-26 09:52:07 +010047set(SCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts)
48
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010049#############################################################################
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010050# Corstone-300
51#############################################################################
52
Per Åstrand79929ff2021-01-26 14:42:43 +010053get_filename_component(ETHOSU_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME)
54message("Configuring target ${ETHOSU_TARGET}")
55
Per Åstranddfcc0172021-01-29 10:27:40 +010056# Enable trustzone support in core_software
57set(TRUSTZONE_BUILD ON)
58
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010059add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common target)
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010060
Jonny Svärdd6670902021-03-18 15:49:27 +010061set(ETHOSU_TARGET_NPU_COUNT 1 CACHE INTERNAL "Number of NPUs")
62set(ETHOSU_TARGET_NPU_TA_COUNT 2 CACHE INTERNAL "Number of timing adapters per NPU")
63
64target_compile_definitions(ethosu_target_common INTERFACE
65 ETHOSU_NPU_TA_COUNT=${ETHOSU_TARGET_NPU_TA_COUNT}
66 ETHOSU_NPU_COUNT=${ETHOSU_TARGET_NPU_COUNT})
67
Jonny Svärd991af2b2021-04-15 17:31:01 +020068if (CPU_CACHE_ENABLE)
69 target_compile_definitions(ethosu_target_common INTERFACE
70 CPU_CACHE_ENABLE)
71endif()
72
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010073# Linker script
74ethosu_target_link_options(ethosu_target_link INTERFACE
75 LINK_FILE platform
76 ENTRY Reset_Handler)
77
78# Add drivers
79target_sources(ethosu_target_startup INTERFACE
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010080 retarget.c
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010081 uart.c
Jonny Svärd991af2b2021-04-15 17:31:01 +020082 target.cpp
83 mpu.cpp)
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010084
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010085target_compile_definitions(ethosu_core_driver PUBLIC ETHOSU)
Jonny Svärdd6670902021-03-18 15:49:27 +010086target_link_libraries(ethosu_target_startup INTERFACE ethosu_core_driver timing_adapter)
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010087
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010088###############################################################################
89# Applications
90###############################################################################
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010091
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010092# Add all applications
93add_subdirectory(../../applications applications)
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010094