nuttx/arch/arm/src/armv7-a/Toolchain.defs
Huang Qi 536739d2da tools: Export LLVM style arch info for non-c language
Current Toolchain.defs set the compile flags directly, it's OK for
target specified gcc toolchain.

But some LLVM based toolchains (Rust/Zig etc) use single toolchain to handle all supported paltform.

In this patch, arch level Toolchain.defs export standard LLVM style arch flags, and let <Lang>.defs to map them into internal style,

This will simplify the intergration of non-c language.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-29 09:26:38 -03:00

99 lines
3.0 KiB
Plaintext

############################################################################
# arch/arm/src/armv7-a/Toolchain.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
ifeq ($(CONFIG_ARCH_CORTEXA5),y)
ARCHCPUFLAGS += -mcpu=cortex-a5
LLVM_CPUTYPE := cortex-a5
else ifeq ($(CONFIG_ARCH_CORTEXA7),y)
ARCHCPUFLAGS += -mcpu=cortex-a7
LLVM_CPUTYPE := cortex-a7
else ifeq ($(CONFIG_ARCH_CORTEXA8),y)
ARCHCPUFLAGS += -mcpu=cortex-a8
LLVM_CPUTYPE := cortex-a8
else ifeq ($(CONFIG_ARCH_CORTEXA9),y)
ARCHCPUFLAGS += -mcpu=cortex-a9
LLVM_CPUTYPE := cortex-a9
endif
ifeq ($(CONFIG_ARM_THUMB),y)
LLVM_ARCHTYPE := thumbv7
else
LLVM_ARCHTYPE := armv7a
endif
ifneq ($(CONFIG_ARM_DPFPU32),y)
ARCHFPUD16 = -d16
endif
# Cortex-A5 | -mfpu=vfpv4-fp16 | -mfpu=vfpv4-d16-fp16 | -mfpu=neon-fp16
# Cortex-A7 | -mfpu=vfpv4 | -mfpu=vfpv4-d16 | -mfpu=neon-vfpv4
# Cortex-A8 | -mfpu=vfpv3 | | -mfpu=neon (alias for neon-vfpv3)
# Cortex-A9 | -mfpu=vfpv3-fp16 | -mfpu=vfpv3-d16-fp16 | -mfpu=neon-fp16
# Cortex-A15 | -mfpu=vfpv4 | | -mfpu=neon-vfpv4
ifeq ($(CONFIG_ARCH_FPU),y)
LLVM_ABITYPE := eabihf
ifeq ($(CONFIG_ARM_FPU_ABI_SOFT),y)
ARCHCPUFLAGS += -mfloat-abi=softfp
else
ARCHCPUFLAGS += -mfloat-abi=hard
endif
ifeq ($(CONFIG_ARM_NEON),y)
ARCHNEON = neon-
endif
ifeq ($(CONFIG_ARCH_CORTEXA8),y)
ARCHFPU = vfpv3
else ifeq ($(CONFIG_ARCH_CORTEXA9),y)
ARCHFPU = vfpv3
else
ARCHFPU = vfpv4
endif
ARCHCPUFLAGS += -mfpu=$(ARCHNEON)$(ARCHFPU)$(ARCHFPUD16)
else
LLVM_ABITYPE := eabi
ARCHCPUFLAGS += -mfloat-abi=soft
endif
ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
ifeq ($(CONFIG_ARCH_CORTEXA5),y)
LDCPUFLAGS = Cortex-A5
else ifeq ($(CONFIG_ARCH_CORTEXA7),y)
LDCPUFLAGS = Cortex-A7
else ifeq ($(CONFIG_ARCH_CORTEXA8),y)
LDCPUFLAGS = Cortex-A8
else ifeq ($(CONFIG_ARCH_CORTEXA9),y)
LDCPUFLAGS = Cortex-A9
endif
ifeq ($(CONFIG_ARCH_FPU),)
LDFLAGS += --cpu=$(LDCPUFLAGS).no_neon.no_vfp
else ifeq ($(CONFIG_ARM_NEON),)
LDFLAGS += --cpu=$(LDCPUFLAGS).no_neon
else
LDFLAGS += --cpu=$(LDCPUFLAGS)
endif
endif
include $(TOPDIR)/arch/arm/src/common/Toolchain.defs