zephyr/cmake/gcc-m-cpu.cmake
Stephanos Ioannidis 6df8f7e435 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>
2021-08-14 20:29:57 -04:00

71 lines
1.9 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
# Determines what argument to give to -mcpu= based on the
# KConfig'uration and sets this to GCC_M_CPU
if("${ARCH}" STREQUAL "arm")
if (CONFIG_CPU_CORTEX_M0)
set(GCC_M_CPU cortex-m0)
elseif(CONFIG_CPU_CORTEX_M0PLUS)
set(GCC_M_CPU cortex-m0plus)
elseif(CONFIG_CPU_CORTEX_M1)
set(GCC_M_CPU cortex-m1)
elseif(CONFIG_CPU_CORTEX_M3)
set(GCC_M_CPU cortex-m3)
elseif(CONFIG_CPU_CORTEX_M4)
set(GCC_M_CPU cortex-m4)
elseif(CONFIG_CPU_CORTEX_M7)
set(GCC_M_CPU cortex-m7)
elseif(CONFIG_CPU_CORTEX_M23)
set(GCC_M_CPU cortex-m23)
elseif(CONFIG_CPU_CORTEX_M33)
if (CONFIG_ARMV8_M_DSP)
set(GCC_M_CPU cortex-m33)
else()
set(GCC_M_CPU cortex-m33+nodsp)
endif()
elseif(CONFIG_CPU_CORTEX_M55)
if (CONFIG_ARMV8_1_M_MVEF)
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()
set(GCC_M_CPU cortex-m55+nodsp)
endif()
elseif(CONFIG_CPU_CORTEX_R4)
set(GCC_M_CPU cortex-r4)
elseif(CONFIG_CPU_CORTEX_R5)
set(GCC_M_CPU cortex-r5)
elseif(CONFIG_CPU_CORTEX_R7)
set(GCC_M_CPU cortex-r7)
else()
message(FATAL_ERROR "Expected CONFIG_CPU_CORTEX_x to be defined")
endif()
elseif("${ARCH}" STREQUAL "arm64")
if(CONFIG_CPU_CORTEX_A53)
set(GCC_M_CPU cortex-a53)
elseif(CONFIG_CPU_CORTEX_A72)
set(GCC_M_CPU cortex-a72)
elseif(CONFIG_CPU_CORTEX_R82)
set(GCC_M_ARCH armv8.4-a)
endif()
elseif("${ARCH}" STREQUAL "arc")
if(CONFIG_CPU_EM4_FPUS)
set(GCC_M_CPU em4_fpus)
elseif(CONFIG_CPU_EM4_DMIPS)
set(GCC_M_CPU em4_dmips)
elseif(CONFIG_CPU_EM4_FPUDA)
set(GCC_M_CPU em4_fpuda)
elseif(CONFIG_CPU_HS3X)
set(GCC_M_CPU archs)
elseif(CONFIG_CPU_HS6X)
set(GCC_M_CPU arc64)
elseif(CONFIG_CPU_EM4)
set(GCC_M_CPU arcem)
elseif(CONFIG_CPU_EM6)
set(GCC_M_CPU arcem)
endif()
endif()