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 15import("//build_overrides/pigweed.gni") 16import("//build_overrides/pigweed_environment.gni") 17 18import("$dir_pw_build/target_types.gni") 19 20# Disable obnoxious ABI warning. 21# 22# GCC 7.1 adds an over-zealous ABI warning with little useful information 23# on how to resolve the issue. The warning you get is: 24# 25# note: parameter passing for argument of type '...' changed in GCC 7.1 26# 27# There is no other information, and searching for the error is needed to 28# understand what is happening. For upstream Pigweed, we compile from 29# source so this is irrelevant; so disable it. 30# 31# See: https://gcc.gnu.org/gcc-7/changes.html (search for "psabi"). 32# https://gcc.gnu.org/ml/gcc/2017-05/msg00073.html 33config("disable_psabi_warning") { 34 cflags = [ "-Wno-psabi" ] 35} 36 37config("cortex_common") { 38 asmflags = [ 39 "-mabi=aapcs", 40 "-mthumb", 41 ] 42 cflags = asmflags + [ 43 "--sysroot=" + rebase_path(pw_env_setup_CIPD_ARM, root_build_dir), 44 "-specs=nano.specs", 45 "-specs=nosys.specs", 46 ] 47 ldflags = cflags + [ 48 "-lnosys", 49 "-lc", 50 ] 51} 52 53config("enable_float_printf") { 54 cflags = [ "-u_printf_float" ] 55 ldflags = cflags 56} 57 58config("cortex_m0plus") { 59 cflags = [ "-mcpu=cortex-m0plus" ] 60 asmflags = cflags 61 ldflags = cflags 62} 63 64config("cortex_m3") { 65 cflags = [ "-mcpu=cortex-m3" ] 66 asmflags = cflags 67 ldflags = cflags 68} 69 70config("cortex_m4") { 71 cflags = [ "-mcpu=cortex-m4" ] 72 asmflags = cflags 73 ldflags = cflags 74} 75 76config("cortex_m7") { 77 cflags = [ "-mcpu=cortex-m7" ] 78 asmflags = cflags 79 ldflags = cflags 80} 81 82config("cortex_m33") { 83 cflags = [ "-mcpu=cortex-m33" ] 84 asmflags = cflags 85 ldflags = cflags 86} 87 88config("cortex_software_fpu") { 89 cflags = [ "-mfloat-abi=soft" ] 90 asmflags = cflags 91 ldflags = cflags 92} 93 94config("cortex_hardware_fpu") { 95 cflags = [ 96 "-mfloat-abi=hard", 97 "-mfpu=fpv4-sp-d16", 98 ] 99 asmflags = cflags 100 defines = [ "PW_ARMV7M_ENABLE_FPU=1" ] 101 ldflags = cflags 102} 103 104config("cortex_hardware_fpu_v5") { 105 cflags = [ 106 "-mfloat-abi=hard", 107 "-mfpu=fpv5-d16", 108 ] 109 asmflags = cflags 110 defines = [ "PW_ARMV7M_ENABLE_FPU=1" ] 111 ldflags = cflags 112} 113 114config("cortex_hardware_fpu_v5_sp") { 115 cflags = [ 116 "-mfloat-abi=hard", 117 "-mfpu=fpv5-sp-d16", 118 ] 119 asmflags = cflags 120 defines = [ "PW_ARMV7M_ENABLE_FPU=1" ] 121 ldflags = cflags 122} 123 124config("wrap_newlib_stdio_functions") { 125 ldflags = [ 126 "-Wl,--wrap=__sread", 127 "-Wl,--wrap=__swrite", 128 "-Wl,--wrap=__sseek", 129 "-Wl,--wrap=__sclose", 130 ] 131 visibility = [ ":*" ] 132} 133 134pw_source_set("newlib_os_interface_stubs") { 135 all_dependent_configs = [ ":wrap_newlib_stdio_functions" ] 136 sources = [ "newlib_os_interface_stubs.cc" ] 137 deps = [ dir_pw_assert ] 138 visibility = [ ":*" ] 139} 140 141# Basic libraries any arm-none-eabi-gcc target should use. This library should 142# be included in pw_build_LINK_DEPS. 143group("arm_none_eabi_gcc_support") { 144 deps = [ 145 ":newlib_os_interface_stubs", 146 "$dir_pw_toolchain:wrap_abort", 147 ] 148} 149