summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2020-12-09 19:09:35 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-15 03:55:56 +0000
commit1a697dfdc386066b8d2c8d0224679ed82741580a (patch)
tree370df32316de9e145e81ba739ed2af23176ca161
parent73978cf7a156c81c493e2ed9a22a9a2623fd43b7 (diff)
downloadchrome-ec-1a697dfdc386066b8d2c8d0224679ed82741580a.tar.gz
Add toolchain definition for coreboot-sdk
Add a toolchain definition for coreboot-sdk, so that volteer can build with coreboot-sdk instead by adding -t coreboot-sdk to the "zmake configure". BUG=b:175248887 TEST=zmake configure -b -t coreboot-sdk -B $(mktemp -d) \ projects/experimental/volteer Change-Id: I1ac9dbf96d893846077e9a7cdc970f57d7a4890d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/zephyr-chrome/+/2583409 Tested-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2630159 Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--zephyr/cmake/bintools/gnu/target.cmake7
-rw-r--r--zephyr/cmake/compiler/gcc/compiler_flags.cmake7
-rw-r--r--zephyr/cmake/compiler/gcc/target.cmake7
-rw-r--r--zephyr/cmake/linker/ld/linker_flags.cmake7
-rw-r--r--zephyr/cmake/linker/ld/target.cmake7
-rw-r--r--zephyr/cmake/toolchain/coreboot-sdk/generic.cmake17
-rw-r--r--zephyr/cmake/toolchain/coreboot-sdk/target.cmake31
7 files changed, 83 insertions, 0 deletions
diff --git a/zephyr/cmake/bintools/gnu/target.cmake b/zephyr/cmake/bintools/gnu/target.cmake
new file mode 100644
index 0000000000..2ec9d075dc
--- /dev/null
+++ b/zephyr/cmake/bintools/gnu/target.cmake
@@ -0,0 +1,7 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Zephyr cmake system looks into ${TOOLCHAIN_ROOT}, but we just send
+# this out to the copy in ${ZEPHYR_BASE}.
+include("${ZEPHYR_BASE}/cmake/bintools/gnu/target.cmake")
diff --git a/zephyr/cmake/compiler/gcc/compiler_flags.cmake b/zephyr/cmake/compiler/gcc/compiler_flags.cmake
new file mode 100644
index 0000000000..125f909c87
--- /dev/null
+++ b/zephyr/cmake/compiler/gcc/compiler_flags.cmake
@@ -0,0 +1,7 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Zephyr cmake system looks into ${TOOLCHAIN_ROOT}, but we just send
+# this out to the copy in ${ZEPHYR_BASE}.
+include("${ZEPHYR_BASE}/cmake/compiler/gcc/compiler_flags.cmake")
diff --git a/zephyr/cmake/compiler/gcc/target.cmake b/zephyr/cmake/compiler/gcc/target.cmake
new file mode 100644
index 0000000000..39e5839eba
--- /dev/null
+++ b/zephyr/cmake/compiler/gcc/target.cmake
@@ -0,0 +1,7 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Zephyr cmake system looks into ${TOOLCHAIN_ROOT}, but we just send
+# this out to the copy in ${ZEPHYR_BASE}.
+include("${ZEPHYR_BASE}/cmake/compiler/gcc/target.cmake")
diff --git a/zephyr/cmake/linker/ld/linker_flags.cmake b/zephyr/cmake/linker/ld/linker_flags.cmake
new file mode 100644
index 0000000000..c80d1d2452
--- /dev/null
+++ b/zephyr/cmake/linker/ld/linker_flags.cmake
@@ -0,0 +1,7 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Zephyr cmake system looks into ${TOOLCHAIN_ROOT}, but we just send
+# this out to the copy in ${ZEPHYR_BASE}.
+include("${ZEPHYR_BASE}/cmake/linker/ld/linker_flags.cmake")
diff --git a/zephyr/cmake/linker/ld/target.cmake b/zephyr/cmake/linker/ld/target.cmake
new file mode 100644
index 0000000000..0e2ad1f4d7
--- /dev/null
+++ b/zephyr/cmake/linker/ld/target.cmake
@@ -0,0 +1,7 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Zephyr cmake system looks into ${TOOLCHAIN_ROOT}, but we just send
+# this out to the copy in ${ZEPHYR_BASE}.
+include("${ZEPHYR_BASE}/cmake/linker/ld/target.cmake")
diff --git a/zephyr/cmake/toolchain/coreboot-sdk/generic.cmake b/zephyr/cmake/toolchain/coreboot-sdk/generic.cmake
new file mode 100644
index 0000000000..7f5f6d3df5
--- /dev/null
+++ b/zephyr/cmake/toolchain/coreboot-sdk/generic.cmake
@@ -0,0 +1,17 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# generic.cmake is used for host-side compilation and preprocessing
+# (e.g., for device-tree). Thus, we should use LLVM for this
+# actually, as that's what's currently supported compiler-wise in the
+# chroot right now.
+
+set(CMAKE_C_COMPILER "/usr/bin/x86_64-pc-linux-gnu-clang")
+
+set(CMAKE_AR "/usr/bin/llvm-ar")
+set(CMAKE_NM "/usr/bin/llvm-nm")
+set(CMAKE_OBJCOPY "/usr/bin/llvm-objcopy")
+set(CMAKE_OBJDUMP "/usr/bin/llvm-objdump")
+set(CMAKE_RANLIB "/usr/bin/llvm-ar")
+set(CMAKE_READELF "/usr/bin/llvm-readelf")
diff --git a/zephyr/cmake/toolchain/coreboot-sdk/target.cmake b/zephyr/cmake/toolchain/coreboot-sdk/target.cmake
new file mode 100644
index 0000000000..cf3a6ec736
--- /dev/null
+++ b/zephyr/cmake/toolchain/coreboot-sdk/target.cmake
@@ -0,0 +1,31 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Coreboot SDK uses GCC
+set(COMPILER gcc)
+set(LINKER ld)
+set(BINTOOLS gnu)
+
+# Mapping of Zephyr architecture -> coreboot-sdk toolchain
+set(CROSS_COMPILE_TARGET_arm arm-eabi)
+set(CROSS_COMPILE_TARGET_riscv riscv64-elf)
+set(CROSS_COMPILE_TARGET_x86 i386-elf)
+
+set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
+
+if("${ARCH}" STREQUAL "arm" AND CONFIG_ARM64)
+ set(CROSS_COMPILE_TARGET aarch64-elf)
+elseif("${ARCH}" STREQUAL "x86" AND CONFIG_X86_64)
+ set(CROSS_COMPILE_TARGET x86_64-elf)
+endif()
+
+set(CC gcc)
+set(CROSS_COMPILE "/opt/coreboot-sdk/bin/${CROSS_COMPILE_TARGET}-")
+
+set(CMAKE_AR "${CROSS_COMPILE}ar")
+set(CMAKE_NM "${CROSS_COMPILE}nm")
+set(CMAKE_OBJCOPY "${CROSS_COMPILE}objcopy")
+set(CMAKE_OBJDUMP "${CROSS_COMPILE}objdump")
+set(CMAKE_RANLIB "${CROSS_COMPILE}ranlib")
+set(CMAKE_READELF "${CROSS_COMPILE}readelf")