aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Svärd <jonny.svaerd@arm.com>2022-12-15 12:40:00 +0100
committerJonny Svärd <jonny.svaerd@arm.com>2022-12-19 13:04:44 +0100
commit2b8922d5c2f31f7a71d84a8aa86946cef00589de (patch)
tree23bbcc0edd10ff65b4d88d2f65a962ab4be040db
parent8fd2fd7972bb5421b639e380ce955d65fcf47166 (diff)
downloadethos-u-linux-driver-stack-2b8922d5c2f31f7a71d84a8aa86946cef00589de.tar.gz
Add custom cross compilation documentation
Change-Id: I1ab89146bf897c4c35180ab09f08064511f573f8
-rw-r--r--README.md8
-rw-r--r--cmake/toolchain/aarch64-linux-gnu-custom.cmake40
-rw-r--r--cmake/toolchain/aarch64-linux-gnu.cmake2
3 files changed, 49 insertions, 1 deletions
diff --git a/README.md b/README.md
index e8c095b..aa8cf33 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,14 @@ subsystem, consisting of an Arm Cortex-M of choice and an Arm Ethos-U NPU.
The driver stack comes with a CMake based build system. A toolchain file is
provided for reference how to cross compile for an Aarch64 based system.
+Note that if your host system provides cross compilers and libraries of newer
+versions than what is supported on your target system, you might be required to
+download an older version of compilers and toolchains for your target system.
+While out of scope for this README, an example
+[toolchain file](cmake/toolchain/aarch64-linux-gnu-custom.cmake) is provided to
+show what it could look like. Another option is to run a Docker image of an
+appropriate Linux distribution suited to build for your needs.
+
Building the kernel modules requires a configured Linux kernel source tree. How
to download and configure the Linux kernel goes beyond the scope of this readme.
Please refer to the Linux kernel official documentation.
diff --git a/cmake/toolchain/aarch64-linux-gnu-custom.cmake b/cmake/toolchain/aarch64-linux-gnu-custom.cmake
new file mode 100644
index 0000000..2c02a76
--- /dev/null
+++ b/cmake/toolchain/aarch64-linux-gnu-custom.cmake
@@ -0,0 +1,40 @@
+#
+# SPDX-FileCopyrightText: Copyright 2020-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
+#
+# 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.
+#
+
+# Cross compilation example when using a custom compiler and toolchain files
+
+set(CMAKE_SYSTEM_NAME Generic)
+
+set(CMAKE_C_COMPILER /opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc)
+set(CMAKE_CXX_COMPILER /opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-g++)
+
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_SYSTEM_PROCESSOR "aarch64")
+
+add_compile_options(-Wall -Wextra)
+
+set(CMAKE_FIND_ROOT_PATH /opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/aarch64-linux-gnu/)
+
+set(FIND_LIBRARY_USE_LIB64_PATHS TRUE)
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+
diff --git a/cmake/toolchain/aarch64-linux-gnu.cmake b/cmake/toolchain/aarch64-linux-gnu.cmake
index 6bbefb9..31fd953 100644
--- a/cmake/toolchain/aarch64-linux-gnu.cmake
+++ b/cmake/toolchain/aarch64-linux-gnu.cmake
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2020-2021 Arm Limited. All rights reserved.
+# SPDX-FileCopyrightText: Copyright 2020-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
#
# SPDX-License-Identifier: Apache-2.0
#