aboutsummaryrefslogtreecommitdiff
path: root/pw_toolchain/arm_gcc/BUILD.gn
blob: 436c4de8365aec7fea0399fbcca34b65005c8e38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

import("//build_overrides/pigweed.gni")
import("//build_overrides/pigweed_environment.gni")

import("$dir_pw_build/target_types.gni")

# Disable obnoxious ABI warning.
#
# GCC 7.1 adds an over-zealous ABI warning with little useful information
# on how to resolve the issue. The warning you get is:
#
#   note: parameter passing for argument of type '...' changed in GCC 7.1
#
# There is no other information, and searching for the error is needed to
# understand what is happening. For upstream Pigweed, we compile from
# source so this is irrelevant; so disable it.
#
# See: https://gcc.gnu.org/gcc-7/changes.html (search for "psabi").
#      https://gcc.gnu.org/ml/gcc/2017-05/msg00073.html
config("disable_psabi_warning") {
  cflags = [ "-Wno-psabi" ]
}

config("cortex_common") {
  asmflags = [
    "-mabi=aapcs",
    "-mthumb",
  ]
  cflags = asmflags + [
             "--sysroot=" + rebase_path(pw_env_setup_CIPD_ARM, root_build_dir),
             "-specs=nano.specs",
             "-specs=nosys.specs",
           ]
  ldflags = cflags + [
              "-lnosys",
              "-lc",
            ]
}

config("enable_float_printf") {
  cflags = [ "-u_printf_float" ]
  ldflags = cflags
}

config("cortex_m0plus") {
  cflags = [ "-mcpu=cortex-m0plus" ]
  asmflags = cflags
  ldflags = cflags
}

config("cortex_m3") {
  cflags = [ "-mcpu=cortex-m3" ]
  asmflags = cflags
  ldflags = cflags
}

config("cortex_m4") {
  cflags = [ "-mcpu=cortex-m4" ]
  asmflags = cflags
  ldflags = cflags
}

config("cortex_m7") {
  cflags = [ "-mcpu=cortex-m7" ]
  asmflags = cflags
  ldflags = cflags
}

config("cortex_m33") {
  cflags = [ "-mcpu=cortex-m33" ]
  asmflags = cflags
  ldflags = cflags
}

config("cortex_software_fpu") {
  cflags = [ "-mfloat-abi=soft" ]
  asmflags = cflags
  ldflags = cflags
}

config("cortex_hardware_fpu") {
  cflags = [
    "-mfloat-abi=hard",
    "-mfpu=fpv4-sp-d16",
  ]
  asmflags = cflags
  defines = [ "PW_ARMV7M_ENABLE_FPU=1" ]
  ldflags = cflags
}

config("cortex_hardware_fpu_v5") {
  cflags = [
    "-mfloat-abi=hard",
    "-mfpu=fpv5-d16",
  ]
  asmflags = cflags
  defines = [ "PW_ARMV7M_ENABLE_FPU=1" ]
  ldflags = cflags
}

config("cortex_hardware_fpu_v5_sp") {
  cflags = [
    "-mfloat-abi=hard",
    "-mfpu=fpv5-sp-d16",
  ]
  asmflags = cflags
  defines = [ "PW_ARMV7M_ENABLE_FPU=1" ]
  ldflags = cflags
}

config("wrap_newlib_stdio_functions") {
  ldflags = [
    "-Wl,--wrap=__sread",
    "-Wl,--wrap=__swrite",
    "-Wl,--wrap=__sseek",
    "-Wl,--wrap=__sclose",
  ]
  visibility = [ ":*" ]
}

pw_source_set("newlib_os_interface_stubs") {
  all_dependent_configs = [ ":wrap_newlib_stdio_functions" ]
  sources = [ "newlib_os_interface_stubs.cc" ]
  deps = [ dir_pw_assert ]
  visibility = [ ":*" ]
}

# Basic libraries any arm-none-eabi-gcc target should use. This library should
# be included in pw_build_LINK_DEPS.
group("arm_none_eabi_gcc_support") {
  deps = [
    ":newlib_os_interface_stubs",
    "$dir_pw_toolchain:wrap_abort",
  ]
}