blob: 2efd329a67e014d63bd47fac8e83e66fb8a65e53 [file] [log] [blame]
Kristofer Jonsson43ce4912020-11-20 09:42:53 +01001#
2# Copyright (c) 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
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
Per Åstrand95550fd2021-02-24 10:39:15 +010029execute_process(
30 COMMAND FVP_Corstone_SSE-300_Ethos-U55 --version
31 OUTPUT_VARIABLE FVP_VERSION_OUTPUT
32 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
33 COMMAND_ERROR_IS_FATAL ANY)
34
35if (${FVP_VERSION_OUTPUT} MATCHES "Fast Models \\[([0-9]+\\.[0-9]+\\.[0-9]+)")
36 set(FVP_VERSION ${CMAKE_MATCH_1})
37else()
38 message("Unknown version")
39endif()
40
41if (${FVP_VERSION} STREQUAL "11.13.41")
42 set(FVP_EXTRA_ARGS "ethosu.num_macs=128")
43elseif (${FVP_VERSION} STREQUAL "11.12.57")
44 set(FVP_EXTRA_ARGS "ethosu.config=H128")
45endif ()
46
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010047set(ETHOSU_COMMAND_DEFAULT
48 FVP_Corstone_SSE-300_Ethos-U55
Per Åstrand95550fd2021-02-24 10:39:15 +010049 -C ${FVP_EXTRA_ARGS}
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010050 -C mps3_board.visualisation.disable-visualisation=1
51 -C mps3_board.telnetterminal0.start_telnet=0
52 -C mps3_board.uart0.out_file="-"
53 -C mps3_board.uart0.unbuffered_output=1
54 -C mps3_board.uart0.shutdown_tag="EXITTHESIM")
55
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010056#############################################################################
57# Project
58#############################################################################
59
60cmake_minimum_required(VERSION 3.15.6)
61
62project(ethos-u-corstone-300 VERSION 0.0.1)
63
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010064include(CTest)
65
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010066include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/helpers.cmake)
67
68#############################################################################
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010069# Corstone-300
70#############################################################################
71
Per Åstrand79929ff2021-01-26 14:42:43 +010072get_filename_component(ETHOSU_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME)
73message("Configuring target ${ETHOSU_TARGET}")
74
Per Åstranddfcc0172021-01-29 10:27:40 +010075# Enable trustzone support in core_software
76set(TRUSTZONE_BUILD ON)
77
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010078add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common target)
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010079
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010080# Linker script
81ethosu_target_link_options(ethosu_target_link INTERFACE
82 LINK_FILE platform
83 ENTRY Reset_Handler)
84
85# Add drivers
86target_sources(ethosu_target_startup INTERFACE
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010087 retarget.c
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010088 uart.c
89 target.cpp)
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010090
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010091target_compile_definitions(ethosu_core_driver PUBLIC ETHOSU)
92target_link_libraries(ethosu_target_startup INTERFACE ethosu_core_driver)
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010093
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010094###############################################################################
95# Applications
96###############################################################################
Kristofer Jonsson43ce4912020-11-20 09:42:53 +010097
Kristofer Jonssonf62c3d72021-01-21 17:39:03 +010098# Add all applications
99add_subdirectory(../../applications applications)
Kristofer Jonsson43ce4912020-11-20 09:42:53 +0100100