| # 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_toolchain:wrap_abort", |
| dir_pw_assert, |
| ] |
| } |