arch: arm: cortex_m: Add ARMv8.1-M MVE configs

This commit adds the ARMv8.1-M M-Profile Vector Extension (MVE)
configurations as well as the compiler flags to enable it.

The M-Profile Vector Extension consists of the MVE-I and MVE-F
instruction sets which are integer and floating-point vector
instruction sets, respectively.

The MVE-I instruction set is a superset of the ARM DSP instruction
set (ARMv7E-M) and therefore depends on ARMV8_M_DSP, and the MVE-F
instruction set is a superset of the ARM MVE-I instruction set and
therefore depends on ARMV8_1_M_MVEI.

The SoCs that implement the MVE instruction set should select the
following configurations:

  select ARMV8_M_DSP
  select ARMV8_1_M_MVEI
  select ARMV8_1_M_MVEF (if floating-point MVE is supported)

The GCC compiler flags for the MVE instruction set are specified
through the `-mcpu` flag.

In case of the Cortex-M55 (the only supported processor type for
ARMv8.1-M at the time of writing), the `-mcpu=cortex-m55` flag, by
default, enables all the supported extensions which are DSP, MVE-I and
MVE-F.

The extensions that are not supported can be specified by appending
`+no(ext)` to the `-mcpu=cortex-m55` flag:

  -mcpu=cortex-m55           Cortex-M55 with DSP + MVE-I + MVE-F
  -mcpu=cortex-m55+nomve.fp  Cortex-M55 with DSP + MVE-I
  -mcpu=cortex-m55+nomve     Cortex-M55 with DSP
  -mcpu=cortex-m55+nodsp     Cortex-M55 without any extensions

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2021-08-15 03:52:02 +09:00 committed by Christopher Friedt
commit 6df8f7e435
3 changed files with 29 additions and 5 deletions

View file

@ -257,6 +257,22 @@ config ARMV8_M_DSP
This option signifies the use of an ARMv8-M processor This option signifies the use of an ARMv8-M processor
implementation supporting the DSP Extension. implementation supporting the DSP Extension.
config ARMV8_1_M_MVEI
bool
depends on ARMV8_1_M_MAINLINE
depends on ARMV8_M_DSP
help
This option signifies the use of an ARMv8.1-M processor implementation
supporting the M-Profile Vector Extension (MVE) integer instruction set.
config ARMV8_1_M_MVEF
bool
depends on ARMV8_1_M_MVEI
help
This option signifies the use of an ARMv8.1-M processor implementation
supporting the M-Profile Vector Extension (MVE) floating-point
instruction set.
menu "ARM Cortex-M0/M0+/M1/M3/M4/M7/M23/M33 options" menu "ARM Cortex-M0/M0+/M1/M3/M4/M7/M23/M33 options"
depends on ARMV6_M_ARMV8_M_BASELINE || ARMV7_M_ARMV8_M_MAINLINE depends on ARMV6_M_ARMV8_M_BASELINE || ARMV7_M_ARMV8_M_MAINLINE

View file

@ -18,10 +18,14 @@ else()
set(PRECISION_TOKEN sp-) set(PRECISION_TOKEN sp-)
endif() endif()
set(FPU_FOR_cortex-m4 fpv4-${PRECISION_TOKEN}d16) set(FPU_FOR_cortex-m4 fpv4-${PRECISION_TOKEN}d16)
set(FPU_FOR_cortex-m7 fpv5-${PRECISION_TOKEN}d16) set(FPU_FOR_cortex-m7 fpv5-${PRECISION_TOKEN}d16)
set(FPU_FOR_cortex-m33 fpv5-${PRECISION_TOKEN}d16) set(FPU_FOR_cortex-m33 fpv5-${PRECISION_TOKEN}d16)
set(FPU_FOR_cortex-m33+nodsp fpv5-${PRECISION_TOKEN}d16) set(FPU_FOR_cortex-m33+nodsp fpv5-${PRECISION_TOKEN}d16)
set(FPU_FOR_cortex-m55 auto)
set(FPU_FOR_cortex-m55+nomve.fp auto)
set(FPU_FOR_cortex-m55+nomve auto)
set(FPU_FOR_cortex-m55+nodsp auto)
if(CONFIG_FPU) if(CONFIG_FPU)
list(APPEND TOOLCHAIN_C_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}}) list(APPEND TOOLCHAIN_C_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}})

View file

@ -25,8 +25,12 @@ if("${ARCH}" STREQUAL "arm")
set(GCC_M_CPU cortex-m33+nodsp) set(GCC_M_CPU cortex-m33+nodsp)
endif() endif()
elseif(CONFIG_CPU_CORTEX_M55) elseif(CONFIG_CPU_CORTEX_M55)
if (CONFIG_ARMV8_M_DSP) if (CONFIG_ARMV8_1_M_MVEF)
set(GCC_M_CPU cortex-m55) set(GCC_M_CPU cortex-m55)
elseif(CONFIG_ARMV8_1_M_MVEI)
set(GCC_M_CPU cortex-m55+nomve.fp)
elseif(CONFIG_ARMV8_M_DSP)
set(GCC_M_CPU cortex-m55+nomve)
else() else()
set(GCC_M_CPU cortex-m55+nodsp) set(GCC_M_CPU cortex-m55+nodsp)
endif() endif()