Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 1 | # |
Jonny Svärd | 3629310 | 2024-06-17 13:16:38 +0200 | [diff] [blame] | 2 | # SPDX-FileCopyrightText: Copyright 2020-2024 Arm Limited and/or its affiliates <open-source-office@arm.com> |
Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the License); you may |
| 6 | # not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | |
| 18 | ############################################################################# |
| 19 | # Default parameters |
| 20 | ############################################################################# |
| 21 | |
Davide Grohmann | a8832cc | 2022-05-06 16:35:16 +0200 | [diff] [blame] | 22 | set(TARGET_CPU "cortex-m85" CACHE INTERNAL "") |
Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 23 | |
| 24 | if (NOT CMAKE_TOOLCHAIN_FILE) |
| 25 | set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/toolchain/armclang.cmake") |
| 26 | endif() |
| 27 | |
Davide Grohmann | 7275f50 | 2022-08-09 14:32:52 +0200 | [diff] [blame] | 28 | set(ETHOSU_TARGET_NPU_CONFIG "ethos-u55-256" CACHE STRING "NPU configuration") |
Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 29 | |
| 30 | set(ETHOSU_PMU_EVENT_0 -1 CACHE STRING "PMU Event #0") |
| 31 | set(ETHOSU_PMU_EVENT_1 -1 CACHE STRING "PMU Event #1") |
| 32 | set(ETHOSU_PMU_EVENT_2 -1 CACHE STRING "PMU Event #2") |
| 33 | set(ETHOSU_PMU_EVENT_3 -1 CACHE STRING "PMU Event #3") |
| 34 | |
| 35 | set(FAST_MEMORY_SIZE 0 CACHE STRING "Size of relocated fast memory scratch tensor") |
| 36 | |
| 37 | if (${FAST_MEMORY_SIZE} EQUAL 0) |
| 38 | set(MEMORY_DEFAULT "sram") |
| 39 | else() |
| 40 | set(MEMORY_DEFAULT "dram") |
| 41 | endif() |
| 42 | |
| 43 | set(MEMORY_MODEL ${MEMORY_DEFAULT} CACHE STRING "Memory config for model") |
| 44 | set(MEMORY_ARENA ${MEMORY_DEFAULT} CACHE STRING "Memory config for arena") |
| 45 | |
| 46 | set(SYSTEM_CORE_CLOCK "25000000" CACHE INTERNAL "System core clock (Hz)") |
| 47 | |
| 48 | ############################################################################# |
| 49 | # Project |
| 50 | ############################################################################# |
| 51 | |
| 52 | cmake_minimum_required(VERSION 3.21) |
| 53 | |
Kristofer Jonsson | de1a9f6 | 2022-08-03 15:51:08 +0200 | [diff] [blame] | 54 | project(ethos-u-corstone-310 VERSION 0.0.1) |
Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 55 | |
| 56 | include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/helpers.cmake) |
| 57 | |
| 58 | ############################################################################# |
Ledion Daja | 204210b | 2023-08-15 13:32:07 +0200 | [diff] [blame] | 59 | # Corstone-310 |
Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 60 | ############################################################################# |
| 61 | |
| 62 | get_filename_component(ETHOSU_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME) |
| 63 | message("Configuring target ${ETHOSU_TARGET}") |
| 64 | |
| 65 | # Enable CTest |
| 66 | include(CTest) |
| 67 | set(Python3_FIND_STRATEGY LOCATION) |
| 68 | find_package(Python3 COMPONENTS Interpreter) |
| 69 | ethosu_get_architecture(${ETHOSU_TARGET_NPU_CONFIG}) |
| 70 | set(ETHOSU_COMMAND_DEFAULT ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/run_ctest.py |
| 71 | -t corstone-310 |
| 72 | -a ethos-${ETHOSU_ARCH} |
| 73 | -m ${ETHOSU_NUM_MACS} |
| 74 | CACHE INTERNAL "Default test command") |
| 75 | |
| 76 | # Enable trustzone support in core_software |
| 77 | set(TRUSTZONE_BUILD OFF) |
| 78 | |
| 79 | # Include common targets |
| 80 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common target) |
| 81 | |
| 82 | target_compile_definitions(ethosu_target_common INTERFACE |
Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 83 | # Configure PMU events |
| 84 | ETHOSU_PMU_EVENT_0=${ETHOSU_PMU_EVENT_0} |
| 85 | ETHOSU_PMU_EVENT_1=${ETHOSU_PMU_EVENT_1} |
| 86 | ETHOSU_PMU_EVENT_2=${ETHOSU_PMU_EVENT_2} |
| 87 | ETHOSU_PMU_EVENT_3=${ETHOSU_PMU_EVENT_3} |
| 88 | |
| 89 | # Placement or TLFu model and area. 0 = SRAM, 1 = DRAM |
| 90 | ETHOSU_FAST_MEMORY_SIZE=${FAST_MEMORY_SIZE} |
| 91 | ETHOSU_MODEL=$<STREQUAL:${MEMORY_MODEL},dram> |
| 92 | ETHOSU_ARENA=$<STREQUAL:${MEMORY_ARENA},dram>) |
| 93 | |
Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 94 | # Linker script |
| 95 | set(LINK_FILE platform CACHE STRING "Link file") |
| 96 | |
| 97 | ethosu_target_link_options(ethosu_target_link INTERFACE |
| 98 | LINK_FILE ${LINK_FILE} |
| 99 | ENTRY Reset_Handler) |
| 100 | |
| 101 | # Add drivers |
| 102 | target_sources(ethosu_target_startup INTERFACE |
| 103 | retarget.c |
| 104 | target.cpp) |
| 105 | |
| 106 | target_link_libraries(ethosu_target_startup INTERFACE |
| 107 | $<$<TARGET_EXISTS:ethosu_core_driver>:ethosu_core_driver;timing_adapter> |
| 108 | mpu |
| 109 | ethosu_mhu_dummy |
| 110 | ethosu_uart_cmsdk_apb) |
| 111 | |
Kristofer Jonsson | 9317581 | 2022-04-21 19:27:11 +0200 | [diff] [blame] | 112 | ############################################################################### |
| 113 | # Applications |
| 114 | ############################################################################### |
| 115 | |
| 116 | # Add all applications |
| 117 | add_subdirectory(../../applications applications) |