blob: 68676a286fe84e3017c6b488d6dccff0826a13cf [file] [log] [blame]
# Copyright 2023 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("thumb") {
asmflags = [
"-mabi=aapcs",
"-mthumb",
]
cflags = asmflags
ldflags = cflags
}
config("newlib_nano") {
cflags = [
"--sysroot=" + rebase_path(pw_env_setup_CIPD_ARM, root_build_dir),
"-specs=nano.specs",
]
ldflags = cflags + [ "-lc" ]
}
config("nosys") {
cflags = [ "-specs=nosys.specs" ]
ldflags = cflags + [ "-lnosys" ]
}
config("enable_float_printf") {
cflags = [ "-u_printf_float" ]
ldflags = cflags
}
config("cortex_m0") {
cflags = [ "-mcpu=cortex-m0" ]
asmflags = cflags
ldflags = cflags
}
config("cortex_m0_small_multiply") {
cflags = [ "-mcpu=cortex-m0.small-multiply" ]
asmflags = cflags
ldflags = cflags
}
config("cortex_m0plus") {
cflags = [ "-mcpu=cortex-m0plus" ]
asmflags = cflags
ldflags = cflags
}
config("cortex_m0plus_small_multiply") {
cflags = [ "-mcpu=cortex-m0plus.small-multiply" ]
asmflags = cflags
ldflags = cflags
}
config("cortex_m1") {
cflags = [ "-mcpu=cortex-m1" ]
asmflags = cflags
ldflags = cflags
}
config("cortex_m1_small_multiply") {
cflags = [ "-mcpu=cortex-m1.small-multiply" ]
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_m23") {
cflags = [ "-mcpu=cortex-m23" ]
asmflags = cflags
ldflags = cflags
}
config("cortex_m33") {
cflags = [ "-mcpu=cortex-m33" ]
asmflags = cflags
ldflags = cflags
}
config("cortex_m35p") {
cflags = [ "-mcpu=cortex-m35p" ]
asmflags = cflags
ldflags = cflags
}
config("cortex_m55") {
cflags = [ "-mcpu=cortex-m33" ]
asmflags = cflags
ldflags = cflags
}
config("fpu_soft") {
cflags = [ "-mfloat-abi=soft" ]
asmflags = cflags
ldflags = cflags
}
config("fpu_fpv4_sp") {
cflags = [
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
]
asmflags = cflags
defines = [ "PW_ARMV7M_ENABLE_FPU=1" ]
ldflags = cflags
}
config("fpu_fpv5") {
cflags = [
"-mfloat-abi=hard",
"-mfpu=fpv5-d16",
]
asmflags = cflags
defines = [ "PW_ARMV7M_ENABLE_FPU=1" ]
ldflags = cflags
}
config("fpu_fpv5_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 = [ "$dir_pw_toolchain/arm_gcc/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",
]
}