• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 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
15package(default_visibility = ["//visibility:public"])
16
17licenses(["notice"])
18
19# The target Arm processor.
20#
21# The values of this constraint_setting correspond to valid values of the -mcpu
22# compiler flag. See
23# https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-mcpu-2. These
24# values are intended to be used in `target_compatible_with` attributes of
25# toolchains which specify the corresponding value of -mcpu.
26#
27# The constraint_values are not currently exhaustively enumerated (only a few
28# of the legal -mcpu values have corresponding constraint_values). The intent
29# is for additional values to be added when needed.
30#
31# The intent is to support only the base processor type, not -march
32# values (e.g., armv7e-m). This is because it is recommended to use (processor
33# type + optional architectural extensions) when configuring Arm GCC (see
34# https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu).
35# In addition, the march values can already be captured using @platforms//cpu.
36#
37# Additionally, extensions should be represented via separate constraints to
38# prevent the explosion of many variants.
39constraint_setting(
40    name = "mcpu",
41    default_constraint_value = "none",
42)
43
44constraint_value(
45    name = "none",
46    constraint_setting = ":mcpu",
47)
48
49constraint_value(
50    name = "cortex-a32",
51    constraint_setting = ":mcpu",
52)
53
54constraint_value(
55    name = "cortex-a35",
56    constraint_setting = ":mcpu",
57)
58
59constraint_value(
60    name = "cortex-m0",
61    constraint_setting = ":mcpu",
62)
63
64constraint_value(
65    name = "cortex-m0plus",
66    constraint_setting = ":mcpu",
67)
68
69constraint_value(
70    name = "cortex-m3",
71    constraint_setting = ":mcpu",
72)
73
74constraint_value(
75    name = "cortex-m4",
76    constraint_setting = ":mcpu",
77)
78
79constraint_value(
80    name = "cortex-m4+nofp",
81    constraint_setting = ":mcpu",
82    deprecation = "FPU properties should be expressed with different constraints",
83)
84
85constraint_value(
86    name = "cortex-m7",
87    constraint_setting = ":mcpu",
88)
89
90constraint_value(
91    name = "cortex-m33",
92    constraint_setting = ":mcpu",
93)
94
95constraint_value(
96    name = "cortex-m33+nofp",
97    constraint_setting = ":mcpu",
98    deprecation = "FPU properties should be expressed with different constraints",
99)
100