Kristofer Jonsson | 1823930 | 2020-04-17 08:45:38 +0200 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2019-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 | cmake_minimum_required(VERSION 3.15.6) |
| 20 | |
| 21 | project(core_software VERSION 0.0.1) |
| 22 | |
| 23 | # |
| 24 | # Define build options |
| 25 | # |
| 26 | |
| 27 | # Setup paths |
| 28 | set(CMSIS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmsis" CACHE PATH "Path to CMSIS.") |
| 29 | set(CORE_DRIVER_PATH "${CMAKE_CURRENT_SOURCE_DIR}/core_driver" CACHE PATH "Path to core driver.") |
| 30 | set(TENSORFLOW_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tensorflow" CACHE PATH "Path to Tensorflow.") |
| 31 | |
Per Åstrand | 94ca355 | 2020-06-30 10:33:58 +0200 | [diff] [blame] | 32 | # Select accelerator for tensorflow |
| 33 | set(CORE_SOFTWARE_ACCELERATOR "NPU" CACHE STRING "Set NPU backend for TFLU") |
| 34 | set_property(CACHE CORE_SOFTWARE_ACCELERATOR PROPERTY STRINGS CPU CMSIS-NN NPU) |
Kristofer Jonsson | 1823930 | 2020-04-17 08:45:38 +0200 | [diff] [blame] | 35 | |
| 36 | # Define build options |
| 37 | set(CORE_SOFTWARE_RTOS "None" CACHE STRING "Select RTOS to include. (None, MbedOS, FreeRTOS, Zephyr)") |
| 38 | |
| 39 | # |
| 40 | # Build |
| 41 | # |
Per Åstrand | 94ca355 | 2020-06-30 10:33:58 +0200 | [diff] [blame] | 42 | add_library(ethosu_core INTERFACE) |
Kristofer Jonsson | 1823930 | 2020-04-17 08:45:38 +0200 | [diff] [blame] | 43 | |
| 44 | # Build CMSIS |
| 45 | include(cmsis.cmake) |
| 46 | |
| 47 | # Build core driver |
Per Åstrand | 94ca355 | 2020-06-30 10:33:58 +0200 | [diff] [blame] | 48 | if (CORE_SOFTWARE_ACCELERATOR STREQUAL "NPU") |
| 49 | set(ETHOSU_PMU_INTERACTIVE OFF) |
| 50 | add_subdirectory(${CORE_DRIVER_PATH} core_driver) |
| 51 | target_link_libraries(ethosu_core INTERFACE ethosu_core_driver) |
| 52 | endif() |
Kristofer Jonsson | 1823930 | 2020-04-17 08:45:38 +0200 | [diff] [blame] | 53 | |
| 54 | # Build Tensorflow library |
| 55 | include(tensorflow.cmake) |
| 56 | |
| 57 | # Merge libraries into static library |
Bhavik Patel | 50aa51d | 2020-07-27 17:23:31 +0200 | [diff] [blame] | 58 | target_link_libraries(ethosu_core INTERFACE tflu cmsis_core cmsis_device) |