diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-06-10 08:57:07 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-15 20:44:47 +0000 |
commit | a0be010122974a3d05a5db3a77171f2118df3c7b (patch) | |
tree | 289bec89ab0bb81e3855e76df1915771313137cd | |
parent | b92a66983180596e8f8a9c4003c099ee1febb86e (diff) | |
download | chrome-ec-a0be010122974a3d05a5db3a77171f2118df3c7b.tar.gz |
core/cortex-m: Set FPU to auto
Use "-mfpu=auto" so that the compiler will choose the correct FPU
settings based on the settings of -mcpu and -march:
https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html.
According to the above doc "-mfpu=auto" is the default and shouldn't be
required, but compilation using gcc fails without the flag.
clang does not support the "-mfpu=auto" flag, but will choose the
correct floating point unit based on the -mcpu flag:
https://lists.llvm.org/pipermail/llvm-dev/2018-September/126468.html
BRANCH=none
BUG=b:145677491, b:234181908
TEST=./util/compare_build.sh -b all -j 120
=> MATCH
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I3c255ee53e31763d29dfb2086fcebf3d8290dc56
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3699793
Reviewed-by: Andrea Grandi <agrandi@google.com>
-rw-r--r-- | core/cortex-m/build.mk | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/cortex-m/build.mk b/core/cortex-m/build.mk index 489990ec7a..cab5fab0f4 100644 --- a/core/cortex-m/build.mk +++ b/core/cortex-m/build.mk @@ -12,7 +12,19 @@ $(call set-option,CROSS_COMPILE,\ /opt/coreboot-sdk/bin/arm-eabi-) # FPU compilation flags -CFLAGS_FPU-$(CONFIG_FPU)=-mfpu=fpv4-sp-d16 -mfloat-abi=hard +CFLAGS_FPU-$(CONFIG_FPU)=-mfloat-abi=hard +ifeq ($(cc-name),gcc) +# -mfpu=auto will choose correct hardware based on settings of -mcpu and -march +# https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html. +# +# According to the above doc "-mfpu=auto" is the default and shouldn't be +# required, but compilation using gcc fails without the flag. +# +# clang does not support "-mfpu=auto" flag, but will choose the correct floating +# point unit based on the -mcpu flag: +# https://lists.llvm.org/pipermail/llvm-dev/2018-September/126468.html +CFLAGS_FPU-$(CONFIG_FPU)+=-mfpu=auto +endif # CPU specific compilation flags CFLAGS_CPU+=-mthumb |