ARMv7 target is driven by ARM_ARCH_MAJOR==7

External build environment shall sets directive ARM_ARCH_MAJOR to 7
to specify a target ARMv7-A core.

As ARM-TF expects AARCH to be set, ARM_ARCH_MAJOR==7 mandates
AARCH=aarch32.

The toolchain target architecture/cpu is delegated after the platform
configuration is parsed. Platform shall define target core through
ARM_CORTEX_A<x>=yes, <x> being 5, 7, 9, 12, 15 and/or 17.

Platform can bypass ARM_CORTEX_A<x>=yes directive and provide straight
the toolchain target directive through MARCH32_DIRECTIVE.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
This commit is contained in:
Etienne Carriere 2017-11-08 13:48:40 +01:00
parent 2904f84e3c
commit 26e63c4450
5 changed files with 86 additions and 5 deletions

View File

@ -126,20 +126,28 @@ OD := ${CROSS_COMPILE}objdump
NM := ${CROSS_COMPILE}nm
PP := ${CROSS_COMPILE}gcc -E
ifeq (${ARM_ARCH_MAJOR},7)
target32-directive = -target arm-none-eabi
# Will set march32-directive from platform configuration
else
target32-directive = -target armv8a-none-eabi
march32-directive = -march armv8-a
endif
ifeq ($(notdir $(CC)),armclang)
TF_CFLAGS_aarch32 = -target arm-arm-none-eabi -march=armv8-a
TF_CFLAGS_aarch32 = -target arm-arm-none-eabi $(march32-directive)
TF_CFLAGS_aarch64 = -target aarch64-arm-none-eabi -march=armv8-a
else ifneq ($(findstring clang,$(notdir $(CC))),)
TF_CFLAGS_aarch32 = -target armv8a-none-eabi
TF_CFLAGS_aarch32 = $(target32-directive)
TF_CFLAGS_aarch64 = -target aarch64-elf
else
TF_CFLAGS_aarch32 = -march=armv8-a
TF_CFLAGS_aarch32 = $(march32-directive)
TF_CFLAGS_aarch64 = -march=armv8-a
endif
TF_CFLAGS_aarch64 += -mgeneral-regs-only -mstrict-align
ASFLAGS_aarch32 = -march=armv8-a
ASFLAGS_aarch32 = $(march32-directive)
ASFLAGS_aarch64 = -march=armv8-a
CPPFLAGS = ${DEFINES} ${INCLUDES} -nostdinc \
@ -262,6 +270,10 @@ include ${PLAT_MAKEFILE_FULL}
$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT}))
ifeq (${ARM_ARCH_MAJOR},7)
include make_helpers/armv7-a-cpus.mk
endif
# Platform compatibility is not supported in AArch32
ifneq (${ARCH},aarch32)
# If the platform has not defined ENABLE_PLAT_COMPAT, then enable it by default

View File

@ -2520,6 +2520,35 @@ This Architecture Extension is targeted when ``ARM_ARCH_MAJOR`` == 8 and
table entries for a given stage of translation for a particular translation
regime.
ARMv7
~~~~~
This Architecture Extension is targeted when ``ARM_ARCH_MAJOR`` == 7.
There are several ARMv7 extensions available. Obviously the TrustZone
extension is mandatory to support the ARM Trusted Firmware bootloader
and runtime services.
Platform implementing an ARMv7 system can to define from its target
Cortex-A architecture through ``ARM_CORTEX_A<X> = yes`` in their
``plaform.mk`` script. For example ``ARM_CORTEX_A15=yes`` for a
Cortex-A15 target.
Platform can also set ``ARM_WITH_NEON=yes`` to enable neon support.
Note that using neon at runtime has constraints on non secure wolrd context.
The trusted firmware does not yet provide VFP context management.
Directive ``ARM_CORTEX_A<x>`` and ``ARM_WITH_NEON`` are used to set
the toolchain target architecture directive.
Platform may choose to not define straight the toolchain target architecture
directive by defining ``MARCH32_DIRECTIVE``.
I.e:
::
MARCH32_DIRECTIVE := -mach=armv7-a
Code Structure
--------------

View File

@ -219,7 +219,8 @@ Common build options
- ``ARM_ARCH_MAJOR``: The major version of ARM Architecture to target when
compiling ARM Trusted Firmware. Its value must be numeric, and defaults to
8 . See also, *ARMv8 Architecture Extensions* in `Firmware Design`_.
8 . See also, *ARMv8 Architecture Extensions* and
*ARMv7 Architecture Extensions* in `Firmware Design`_.
- ``ARM_ARCH_MINOR``: The minor version of ARM Architecture to target when
compiling ARM Trusted Firmware. Its value must be a numeric, and defaults

View File

@ -91,6 +91,11 @@ Files:
- docs/plat/xilinx-zynqmp.md
- plat/xilinx/\*
ARMv7 architecture sub-maintainer
---------------------------------
Etienne Carriere (etienne.carriere@linaro.org, `etienne-lms`_)
.. _danh-arm: https://github.com/danh-arm
.. _davidcunado-arm: https://github.com/davidcunado-arm
.. _jenswi-linaro: https://github.com/jenswi-linaro
@ -100,3 +105,4 @@ Files:
.. _TonyXie06: https://github.com/TonyXie06
.. _rkchrome: https://github.com/rkchrome
.. _sorenb-xlnx: https://github.com/sorenb-xlnx
.. _etienne-lms: https://github.com/etienne-lms

View File

@ -0,0 +1,33 @@
#
# Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
ifneq (${ARCH},aarch32)
$(error ARM_ARCH_MAJOR=7 mandates ARCH=aarch32)
endif
# For ARMv7, set march32 from platform directive ARMV7_CORTEX_Ax=yes
# and ARM_WITH_NEON=yes/no.
#
# GCC and Clang require -march=armv7-a for C-A9 and -march=armv7ve for C-A15.
# armClang requires -march=armv7-a for all ARMv7 Cortex-A. To comply with
# all, just drop -march and supply only -mcpu.
# Platform can override march32-directive through MARCH32_DIRECTIVE
ifdef MARCH32_DIRECTIVE
march32-directive := $(MARCH32_DIRECTIVE)
else
march32-set-${ARM_CORTEX_A5} := -mcpu=cortex-a5
march32-set-${ARM_CORTEX_A7} := -mcpu=cortex-a7
march32-set-${ARM_CORTEX_A9} := -mcpu=cortex-a9
march32-set-${ARM_CORTEX_A12} := -mcpu=cortex-a12
march32-set-${ARM_CORTEX_A15} := -mcpu=cortex-a15
march32-set-${ARM_CORTEX_A17} := -mcpu=cortex-a17
march32-neon-$(ARM_WITH_NEON) := -mfpu=neon
# default to -march=armv7-a as target directive
march32-set-yes ?= -march=armv7-a
march32-directive := ${march32-set-yes} ${march32-neon-yes}
endif