Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 1 | # |
| 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 Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 20 | # Default parameters |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 21 | ############################################################################# |
| 22 | |
| 23 | set(TARGET_CPU "cortex-m55") |
| 24 | |
| 25 | if (NOT CMAKE_TOOLCHAIN_FILE) |
| 26 | set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/toolchain/armclang.cmake") |
| 27 | endif() |
| 28 | |
Per Åstrand | 95550fd | 2021-02-24 10:39:15 +0100 | [diff] [blame] | 29 | execute_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 | |
| 35 | if (${FVP_VERSION_OUTPUT} MATCHES "Fast Models \\[([0-9]+\\.[0-9]+\\.[0-9]+)") |
| 36 | set(FVP_VERSION ${CMAKE_MATCH_1}) |
| 37 | else() |
| 38 | message("Unknown version") |
| 39 | endif() |
| 40 | |
| 41 | if (${FVP_VERSION} STREQUAL "11.13.41") |
| 42 | set(FVP_EXTRA_ARGS "ethosu.num_macs=128") |
| 43 | elseif (${FVP_VERSION} STREQUAL "11.12.57") |
| 44 | set(FVP_EXTRA_ARGS "ethosu.config=H128") |
| 45 | endif () |
| 46 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 47 | set(ETHOSU_COMMAND_DEFAULT |
| 48 | FVP_Corstone_SSE-300_Ethos-U55 |
Per Åstrand | 95550fd | 2021-02-24 10:39:15 +0100 | [diff] [blame] | 49 | -C ${FVP_EXTRA_ARGS} |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 50 | -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 Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 56 | ############################################################################# |
| 57 | # Project |
| 58 | ############################################################################# |
| 59 | |
| 60 | cmake_minimum_required(VERSION 3.15.6) |
| 61 | |
| 62 | project(ethos-u-corstone-300 VERSION 0.0.1) |
| 63 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 64 | include(CTest) |
| 65 | |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 66 | include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/helpers.cmake) |
| 67 | |
| 68 | ############################################################################# |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 69 | # Corstone-300 |
| 70 | ############################################################################# |
| 71 | |
Per Åstrand | 79929ff | 2021-01-26 14:42:43 +0100 | [diff] [blame] | 72 | get_filename_component(ETHOSU_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME) |
| 73 | message("Configuring target ${ETHOSU_TARGET}") |
| 74 | |
Per Åstrand | dfcc017 | 2021-01-29 10:27:40 +0100 | [diff] [blame] | 75 | # Enable trustzone support in core_software |
| 76 | set(TRUSTZONE_BUILD ON) |
| 77 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 78 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common target) |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 79 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 80 | # Linker script |
| 81 | ethosu_target_link_options(ethosu_target_link INTERFACE |
| 82 | LINK_FILE platform |
| 83 | ENTRY Reset_Handler) |
| 84 | |
| 85 | # Add drivers |
| 86 | target_sources(ethosu_target_startup INTERFACE |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 87 | retarget.c |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 88 | uart.c |
| 89 | target.cpp) |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 90 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 91 | target_compile_definitions(ethosu_core_driver PUBLIC ETHOSU) |
| 92 | target_link_libraries(ethosu_target_startup INTERFACE ethosu_core_driver) |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 93 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 94 | ############################################################################### |
| 95 | # Applications |
| 96 | ############################################################################### |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 97 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 98 | # Add all applications |
| 99 | add_subdirectory(../../applications applications) |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 100 | |