Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be1f9cb2 authored by Anton Hansson's avatar Anton Hansson
Browse files

Make it an error to specify the wrong ARCH_VARIANT

It was previously a warning to set an incorrect ARCH_VARIANT
when CPU_VARIANT was set to a cpu for which we knew the arch.

Make it an error, as there are no offenders in the tree.

Re-structure the code to make it a little clearer when you get
a default and when you get an error.

Test: build_test
Change-Id: I5821a8162a59e8c2aed2370068f9eb656ced9d99
parent a2f536f9
Loading
Loading
Loading
Loading
+13 −20
Original line number Diff line number Diff line
@@ -29,35 +29,28 @@
# include defines, and compiler settings for the given architecture
# version.
#
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),)
TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT := generic
endif

KNOWN_ARMv8_CORES := cortex-a53 cortex-a53.a57 cortex-a55 cortex-a73 cortex-a75 cortex-a76
KNOWN_ARMv8_CORES += kryo kryo385 exynos-m1 exynos-m2

KNOWN_ARMv82a_CORES := cortex-a55 cortex-a75 kryo385

# Check for cores that implement armv8-2a ISAs.
ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv82a_CORES)))
  ifneq ($(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT),armv8-2a)
    $(warning $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT) is armv8-2a.)
    ifneq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
      $(warning TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT, $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT), ignored! Use armv8-2a instead.)
ifeq (,$(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
  TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT := generic
endif
    # Overwrite TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT

# This sanity checks TARGET_2ND_ARCH_VARIANT against the lists above.
ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv82a_CORES)))
  ifeq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
    TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv8-2a
  else ifneq (armv8-2a,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
    $(error Incorrect TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT, $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT). Use armv8-2a instead.)
  endif
# Many devices (incorrectly) use armv7-a-neon as the 2nd architecture variant
# for cores that implement armv8-a ISAs. The following sets it to armv8-a.
else ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv8_CORES)))
  ifneq ($(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT),armv8-a)
    $(warning $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT) is armv8-a.)
    ifneq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
      $(warning TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT, $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT), ignored! Use armv8-a instead.)
    endif
    # Overwrite TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT
  ifeq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
    TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv8-a
  else ifneq ($(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT),armv8-a)
    $(error Incorrect TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT, $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT). Use armv8-a instead.)
  endif
endif