aboutsummaryrefslogtreecommitdiff
path: root/targets/corstone-300/CMakeLists.txt
blob: 2efd329a67e014d63bd47fac8e83e66fb8a65e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#
# Copyright (c) 2020 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the License); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#############################################################################
# Default parameters
#############################################################################

set(TARGET_CPU "cortex-m55")

if (NOT CMAKE_TOOLCHAIN_FILE)
    set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/toolchain/armclang.cmake")
endif()

execute_process(
    COMMAND FVP_Corstone_SSE-300_Ethos-U55 --version
    OUTPUT_VARIABLE FVP_VERSION_OUTPUT
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    COMMAND_ERROR_IS_FATAL ANY)

if (${FVP_VERSION_OUTPUT} MATCHES "Fast Models \\[([0-9]+\\.[0-9]+\\.[0-9]+)")
    set(FVP_VERSION ${CMAKE_MATCH_1})
else()
    message("Unknown version")
endif()

if (${FVP_VERSION} STREQUAL "11.13.41")
    set(FVP_EXTRA_ARGS "ethosu.num_macs=128")
elseif (${FVP_VERSION} STREQUAL "11.12.57")
    set(FVP_EXTRA_ARGS "ethosu.config=H128")
endif ()

set(ETHOSU_COMMAND_DEFAULT
    FVP_Corstone_SSE-300_Ethos-U55
        -C ${FVP_EXTRA_ARGS}
        -C mps3_board.visualisation.disable-visualisation=1
        -C mps3_board.telnetterminal0.start_telnet=0
        -C mps3_board.uart0.out_file="-"
        -C mps3_board.uart0.unbuffered_output=1
        -C mps3_board.uart0.shutdown_tag="EXITTHESIM")

#############################################################################
# Project
#############################################################################

cmake_minimum_required(VERSION 3.15.6)

project(ethos-u-corstone-300 VERSION 0.0.1)

include(CTest)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/helpers.cmake)

#############################################################################
# Corstone-300
#############################################################################

get_filename_component(ETHOSU_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME)
message("Configuring target ${ETHOSU_TARGET}")

# Enable trustzone support in core_software
set(TRUSTZONE_BUILD ON)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common target)

# Linker script
ethosu_target_link_options(ethosu_target_link INTERFACE
    LINK_FILE platform
    ENTRY Reset_Handler)

# Add drivers
target_sources(ethosu_target_startup INTERFACE
    retarget.c
    uart.c
    target.cpp)

target_compile_definitions(ethosu_core_driver PUBLIC ETHOSU)
target_link_libraries(ethosu_target_startup INTERFACE ethosu_core_driver)

###############################################################################
# Applications
###############################################################################

# Add all applications
add_subdirectory(../../applications applications)