wyhong | 0ca9aa4 | 2022-09-12 23:24:16 +0800 | [diff] [blame] | 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/bouffalolab_iot_sdk.gni") |
| 19 | import("${build_root}/toolchain/gcc_toolchain.gni") |
| 20 | |
| 21 | template("riscv_toolchain") { |
| 22 | gcc_toolchain(target_name) { |
| 23 | _tool_name_root = "" |
| 24 | |
| 25 | if ("linux" == host_os) { |
wyhong | ae9d1b2 | 2022-11-30 05:02:22 +0800 | [diff] [blame] | 26 | _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-" |
wyhong | 0ca9aa4 | 2022-09-12 23:24:16 +0800 | [diff] [blame] | 27 | } else if ("mac" == host_os || "darwin" == host_os) { |
wyhong | ae9d1b2 | 2022-11-30 05:02:22 +0800 | [diff] [blame] | 28 | _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-" |
wyhong | 0ca9aa4 | 2022-09-12 23:24:16 +0800 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | ar = _tool_name_root + "ar" |
| 32 | cc = _tool_name_root + "gcc" |
| 33 | cxx = _tool_name_root + "g++" |
| 34 | |
| 35 | toolchain_args = { |
| 36 | current_cpu = "riscv" |
| 37 | current_os = invoker.current_os |
| 38 | is_clang = false |
| 39 | |
| 40 | forward_variables_from(invoker.toolchain_args, "*") |
| 41 | } |
| 42 | } |
| 43 | } |