blob: db46fc1a98f4fafbfddecd0b0e9b025790b19d5f [file] [log] [blame]
wyhong0ca9aa42022-09-12 23:24:16 +08001# 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
15import("//build_overrides/build.gni")
16import("//build_overrides/chip.gni")
17
18import("//build_overrides/bouffalolab_iot_sdk.gni")
19import("${build_root}/toolchain/gcc_toolchain.gni")
20
21template("riscv_toolchain") {
22 gcc_toolchain(target_name) {
23 _tool_name_root = ""
24
25 if ("linux" == host_os) {
wyhongae9d1b22022-11-30 05:02:22 +080026 _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-"
wyhong0ca9aa42022-09-12 23:24:16 +080027 } else if ("mac" == host_os || "darwin" == host_os) {
wyhongae9d1b22022-11-30 05:02:22 +080028 _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-"
wyhong0ca9aa42022-09-12 23:24:16 +080029 }
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}