Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_toolchain / arm_gcc / BUILD.gn
1 # Copyright 2020 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
15 import("//build_overrides/pigweed.gni")
16
17 # Disable obnoxious ABI warning.
18 #
19 # GCC 7.1 adds an over-zealous ABI warning with little useful information
20 # on how to resolve the issue. The warning you get is:
21 #
22 #   note: parameter passing for argument of type '...' changed in GCC 7.1
23 #
24 # There is no other information, and searching for the error is needed to
25 # understand what is happening. For upstream Pigweed, we compile from
26 # source so this is irrelevant; so disable it.
27 #
28 # See: https://gcc.gnu.org/gcc-7/changes.html (search for "psabi").
29 #      https://gcc.gnu.org/ml/gcc/2017-05/msg00073.html
30 config("disable_psabi_warning") {
31   cflags = [ "-Wno-psabi" ]
32 }
33
34 config("cortex_common") {
35   asmflags = [
36     "-mabi=aapcs",
37     "-mthumb",
38   ]
39   cflags = asmflags + [
40              "-specs=nano.specs",
41              "-specs=nosys.specs",
42            ]
43   ldflags = cflags + [
44               "-lnosys",
45               "-lc",
46             ]
47 }
48
49 config("enable_float_printf") {
50   cflags = [ "-u_printf_float" ]
51   ldflags = cflags
52 }
53
54 config("cortex_m0plus") {
55   cflags = [ "-mcpu=cortex-m0plus" ]
56   asmflags = cflags
57   ldflags = cflags
58 }
59
60 config("cortex_m3") {
61   cflags = [ "-mcpu=cortex-m3" ]
62   asmflags = cflags
63   ldflags = cflags
64 }
65
66 config("cortex_m4") {
67   cflags = [ "-mcpu=cortex-m4" ]
68   asmflags = cflags
69   ldflags = cflags
70 }
71
72 config("cortex_m7") {
73   cflags = [ "-mcpu=cortex-m7" ]
74   asmflags = cflags
75   ldflags = cflags
76 }
77
78 config("cortex_software_fpu") {
79   cflags = [ "-mfloat-abi=soft" ]
80   asmflags = cflags
81   ldflags = cflags
82 }
83
84 config("cortex_hardware_fpu") {
85   cflags = [
86     "-mfloat-abi=hard",
87     "-mfpu=fpv4-sp-d16",
88   ]
89   asmflags = cflags
90   defines = [ "PW_ARMV7M_ENABLE_FPU=1" ]
91   ldflags = cflags
92 }
93
94 config("cortex_hardware_fpu_v5") {
95   cflags = [
96     "-mfloat-abi=hard",
97     "-mfpu=fpv5-d16",
98   ]
99   asmflags = cflags
100   defines = [ "PW_ARMV7M_ENABLE_FPU=1" ]
101   ldflags = cflags
102 }