xref: /aosp_15_r20/external/pigweed/pw_toolchain_bazel/constraints/arm_mcpu/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2023 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# flag for Arm gcc. 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 (processor type + optional architectural
32# extensions) forms of -mcpu (e.g., cortex-m4 or cortex-m4+nofp), not march
33# values (e.g., armv7e-m). This is because it is recommended to use (processor
34# type + optional architectural extensions) when configuring Arm GCC (see
35# https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu).
36# In addition, the march values can already be captured using @platforms//cpu.
37constraint_setting(
38    name = "mcpu",
39    default_constraint_value = "none",
40)
41
42constraint_value(
43    name = "none",
44    constraint_setting = ":mcpu",
45)
46
47constraint_value(
48    name = "cortex-a32",
49    constraint_setting = ":mcpu",
50)
51
52constraint_value(
53    name = "cortex-m0",
54    constraint_setting = ":mcpu",
55)
56
57constraint_value(
58    name = "cortex-m0plus",
59    constraint_setting = ":mcpu",
60)
61
62constraint_value(
63    name = "cortex-m3",
64    constraint_setting = ":mcpu",
65)
66
67constraint_value(
68    name = "cortex-m4",
69    constraint_setting = ":mcpu",
70)
71
72constraint_value(
73    name = "cortex-m4+nofp",
74    constraint_setting = ":mcpu",
75)
76
77constraint_value(
78    name = "cortex-m7",
79    constraint_setting = ":mcpu",
80)
81
82constraint_value(
83    name = "cortex-m33",
84    constraint_setting = ":mcpu",
85)
86
87constraint_value(
88    name = "cortex-m33+nofp",
89    constraint_setting = ":mcpu",
90)
91