• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15import("//build_overrides/pigweed.gni")
16
17# Specifies the tools used by host Clang toolchains.
18_arm_clang_toolchain = {
19  # Note: On macOS, there is no "llvm-ar", only "ar", which happens to be LLVM
20  # ar. This should get updated for linux systems.
21  ar = "ar"
22  cc = "clang"
23  cxx = "clang++"
24
25  link_whole_archive = true
26}
27
28# Configs specific to different architectures.
29_cortex_m3 = [ "$dir_pw_toolchain/arm_clang:cortex_m3" ]
30
31_cortex_m4 = [ "$dir_pw_toolchain/arm_clang:cortex_m4" ]
32
33_cortex_m4f = [ "$dir_pw_toolchain/arm_clang:cortex_m4f" ]
34
35# Describes ARM clang toolchains for specific targets.
36pw_toolchain_arm_clang = {
37  cortex_m3_debug = {
38    name = "arm_clang_cortex_m3_debug"
39    forward_variables_from(_arm_clang_toolchain, "*")
40    defaults = {
41      default_configs = _cortex_m3 + [ "$dir_pw_build:optimize_debugging" ]
42    }
43  }
44  cortex_m3_speed_optimized = {
45    name = "arm_clang_cortex_m3_speed_optimized"
46    forward_variables_from(_arm_clang_toolchain, "*")
47    defaults = {
48      default_configs = _cortex_m3 + [ "$dir_pw_build:optimize_speed" ]
49    }
50  }
51  cortex_m3_size_optimized = {
52    name = "arm_clang_cortex_m3_size_optimized"
53    forward_variables_from(_arm_clang_toolchain, "*")
54    defaults = {
55      default_configs = _cortex_m3 + [ "$dir_pw_build:optimize_size" ]
56    }
57  }
58  cortex_m4_debug = {
59    name = "arm_clang_cortex_m4_debug"
60    forward_variables_from(_arm_clang_toolchain, "*")
61    defaults = {
62      default_configs = _cortex_m4 + [ "$dir_pw_build:optimize_debugging" ]
63    }
64  }
65  cortex_m4_speed_optimized = {
66    name = "arm_clang_cortex_m4_speed_optimized"
67    forward_variables_from(_arm_clang_toolchain, "*")
68    defaults = {
69      default_configs = _cortex_m4 + [ "$dir_pw_build:optimize_speed" ]
70    }
71  }
72  cortex_m4_size_optimized = {
73    name = "arm_clang_cortex_m4_size_optimized"
74    forward_variables_from(_arm_clang_toolchain, "*")
75    defaults = {
76      default_configs = _cortex_m4 + [ "$dir_pw_build:optimize_size" ]
77    }
78  }
79  cortex_m4f_debug = {
80    name = "arm_clang_cortex_m4f_debug"
81    forward_variables_from(_arm_clang_toolchain, "*")
82    defaults = {
83      default_configs = _cortex_m4f + [ "$dir_pw_build:optimize_debugging" ]
84    }
85  }
86  cortex_m4f_speed_optimized = {
87    name = "arm_clang_cortex_m4f_speed_optimized"
88    forward_variables_from(_arm_clang_toolchain, "*")
89    defaults = {
90      default_configs = _cortex_m4f + [ "$dir_pw_build:optimize_speed" ]
91    }
92  }
93  cortex_m4f_size_optimized = {
94    name = "arm_clang_cortex_m4f_size_optimized"
95    forward_variables_from(_arm_clang_toolchain, "*")
96    defaults = {
97      default_configs = _cortex_m4f + [ "$dir_pw_build:optimize_size" ]
98    }
99  }
100}
101
102# This list just contains the members of the above scope for convenience to make
103# it trivial to generate all the toolchains in this file via a
104# `generate_toolchains` target.
105pw_toolchain_arm_clang_list = [
106  pw_toolchain_arm_clang.cortex_m3_debug,
107  pw_toolchain_arm_clang.cortex_m3_speed_optimized,
108  pw_toolchain_arm_clang.cortex_m3_size_optimized,
109  pw_toolchain_arm_clang.cortex_m4_debug,
110  pw_toolchain_arm_clang.cortex_m4_speed_optimized,
111  pw_toolchain_arm_clang.cortex_m4_size_optimized,
112  pw_toolchain_arm_clang.cortex_m4f_debug,
113  pw_toolchain_arm_clang.cortex_m4f_speed_optimized,
114  pw_toolchain_arm_clang.cortex_m4f_size_optimized,
115]
116