Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 1 | # |
Anton Moberg | fa3e51b | 2021-03-31 11:05:02 +0200 | [diff] [blame] | 2 | # Copyright (c) 2020-2021 Arm Limited. All rights reserved. |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 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 | |
Kristofer Jonsson | ec45155 | 2021-06-04 18:02:59 +0200 | [diff] [blame] | 23 | set(TARGET_CPU "cortex-m55" CACHE INTERNAL "") |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 24 | |
| 25 | if (NOT CMAKE_TOOLCHAIN_FILE) |
| 26 | set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/toolchain/armclang.cmake") |
| 27 | endif() |
| 28 | |
Kristofer Jonsson | ec45155 | 2021-06-04 18:02:59 +0200 | [diff] [blame] | 29 | set(ETHOSU_COMMAND_DEFAULT python3 ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/run_ctest.py -t corstone-300 CACHE INTERNAL "Default test command") |
Jonny Svärd | 991af2b | 2021-04-15 17:31:01 +0200 | [diff] [blame] | 30 | |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 31 | ############################################################################# |
| 32 | # Project |
| 33 | ############################################################################# |
| 34 | |
Jonas Ohlsson | e0da7e0 | 2021-05-04 12:38:27 +0200 | [diff] [blame] | 35 | # Note: On Windows systems CMake 3.20.0 might cause issues with errouneous dependency make files. |
| 36 | # Issues solved with CMake 3.20.1. |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 37 | cmake_minimum_required(VERSION 3.15.6) |
| 38 | |
| 39 | project(ethos-u-corstone-300 VERSION 0.0.1) |
| 40 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 41 | include(CTest) |
| 42 | |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 43 | include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/helpers.cmake) |
| 44 | |
| 45 | ############################################################################# |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 46 | # Corstone-300 |
| 47 | ############################################################################# |
| 48 | |
Per Åstrand | 79929ff | 2021-01-26 14:42:43 +0100 | [diff] [blame] | 49 | get_filename_component(ETHOSU_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME) |
| 50 | message("Configuring target ${ETHOSU_TARGET}") |
| 51 | |
Per Åstrand | dfcc017 | 2021-01-29 10:27:40 +0100 | [diff] [blame] | 52 | # Enable trustzone support in core_software |
| 53 | set(TRUSTZONE_BUILD ON) |
| 54 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 55 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common target) |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 56 | |
Kristofer Jonsson | ec45155 | 2021-06-04 18:02:59 +0200 | [diff] [blame] | 57 | set(ETHOSU_TARGET_NPU_CONFIG "ethos-u55-128" CACHE STRING "NPU configuration") |
Jonny Svärd | d667090 | 2021-03-18 15:49:27 +0100 | [diff] [blame] | 58 | set(ETHOSU_TARGET_NPU_COUNT 1 CACHE INTERNAL "Number of NPUs") |
| 59 | set(ETHOSU_TARGET_NPU_TA_COUNT 2 CACHE INTERNAL "Number of timing adapters per NPU") |
| 60 | |
| 61 | target_compile_definitions(ethosu_target_common INTERFACE |
| 62 | ETHOSU_NPU_TA_COUNT=${ETHOSU_TARGET_NPU_TA_COUNT} |
| 63 | ETHOSU_NPU_COUNT=${ETHOSU_TARGET_NPU_COUNT}) |
| 64 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 65 | # Linker script |
Kristofer Jonsson | ec45155 | 2021-06-04 18:02:59 +0200 | [diff] [blame] | 66 | set(LINK_FILE platform CACHE STRING "Link file") |
| 67 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 68 | ethosu_target_link_options(ethosu_target_link INTERFACE |
Kristofer Jonsson | ec45155 | 2021-06-04 18:02:59 +0200 | [diff] [blame] | 69 | LINK_FILE ${LINK_FILE} |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 70 | ENTRY Reset_Handler) |
| 71 | |
| 72 | # Add drivers |
| 73 | target_sources(ethosu_target_startup INTERFACE |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 74 | retarget.c |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 75 | uart.c |
Jonny Svärd | 991af2b | 2021-04-15 17:31:01 +0200 | [diff] [blame] | 76 | target.cpp |
| 77 | mpu.cpp) |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 78 | |
Kristofer Jonsson | 3b13732 | 2021-06-28 20:17:04 +0200 | [diff] [blame] | 79 | target_link_libraries(ethosu_target_startup INTERFACE |
| 80 | $<$<TARGET_EXISTS:ethosu_core_driver>:ethosu_core_driver;timing_adapter>) |
| 81 | |
| 82 | if (TARGET ethosu_core_driver) |
| 83 | target_compile_definitions(ethosu_core_driver PUBLIC |
| 84 | ETHOSU) |
| 85 | endif() |
Kristofer Jonsson | 43ce491 | 2020-11-20 09:42:53 +0100 | [diff] [blame] | 86 | |
Kristofer Jonsson | f62c3d7 | 2021-01-21 17:39:03 +0100 | [diff] [blame] | 87 | ############################################################################### |
| 88 | # Applications |
| 89 | ############################################################################### |
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 | # Add all applications |
| 92 | add_subdirectory(../../applications applications) |