|
| 1 | +# Copyright (c) 2021 Project CHIP Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +import("//build_overrides/build.gni") |
| 16 | +import("//build_overrides/chip.gni") |
| 17 | + |
| 18 | +import("//build_overrides/qcc74x_iot_sdk.gni") |
| 19 | +import("${build_root}/toolchain/gcc_toolchain.gni") |
| 20 | +import("${chip_root}/src/platform/device.gni") |
| 21 | + |
| 22 | +template("riscv_toolchain") { |
| 23 | + gcc_toolchain(target_name) { |
| 24 | + _tool_name_root = "" |
| 25 | + |
| 26 | + if ("linux" == host_os) { |
| 27 | + if (chip_device_platform == "qcc743") { |
| 28 | + _tool_name_root = "${qcc74x_sdk_root}/toolchain/t-head-riscv/gcc_t-head_v2.6.1/bin/riscv64-unknown-elf-" |
| 29 | + } else { |
| 30 | + _tool_name_root = "${qcc74x_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-" |
| 31 | + } |
| 32 | + } else if ("mac" == host_os || "darwin" == host_os) { |
| 33 | + _tool_name_root = "${qcc74x_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-" |
| 34 | + } |
| 35 | + |
| 36 | + ar = _tool_name_root + "ar" |
| 37 | + cc = _tool_name_root + "gcc" |
| 38 | + cxx = _tool_name_root + "g++" |
| 39 | + |
| 40 | + toolchain_args = { |
| 41 | + current_cpu = "riscv" |
| 42 | + current_os = invoker.current_os |
| 43 | + is_clang = false |
| 44 | + |
| 45 | + forward_variables_from(invoker.toolchain_args, "*") |
| 46 | + } |
| 47 | + } |
| 48 | +} |
0 commit comments