arch/arm: add support for armclang compiler(AC6)
Reference: https://developer.arm.com/Tools%20and%20Software/Arm%20Compiler%20for%20Embedded Signed-off-by: chao an <anchao@xiaomi.com> Signed-off-by: sheyunhu <sheyunhu@xiaomi.com>
This commit is contained in:
parent
54aa91f02b
commit
7dbaa4f4c4
@ -42,6 +42,10 @@ config ARM_TOOLCHAIN_CLANG
|
|||||||
bool "Generic Clang toolchain"
|
bool "Generic Clang toolchain"
|
||||||
select ARCH_TOOLCHAIN_CLANG
|
select ARCH_TOOLCHAIN_CLANG
|
||||||
|
|
||||||
|
config ARM_TOOLCHAIN_ARMCLANG
|
||||||
|
bool "ARM Compiler Clang toolchain"
|
||||||
|
select ARCH_TOOLCHAIN_CLANG
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
choice
|
choice
|
||||||
|
@ -85,37 +85,45 @@ UOBJS = $(UAOBJS) $(UCOBJS)
|
|||||||
KBIN = libkarch$(LIBEXT)
|
KBIN = libkarch$(LIBEXT)
|
||||||
BIN = libarch$(LIBEXT)
|
BIN = libarch$(LIBEXT)
|
||||||
|
|
||||||
LDFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
|
|
||||||
|
|
||||||
# Override in Make.defs if linker is not 'ld'
|
# Override in Make.defs if linker is not 'ld'
|
||||||
|
|
||||||
ifeq ($(LD),$(CC))
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
|
||||||
LDSTARTGROUP ?= -Wl,--start-group
|
ifeq ($(LD),$(CC))
|
||||||
LDENDGROUP ?= -Wl,--end-group
|
LDSTARTGROUP ?= -Wl,--start-group
|
||||||
LDFLAGS := $(addprefix -Xlinker ,$(LDFLAGS))
|
LDENDGROUP ?= -Wl,--end-group
|
||||||
LDFLAGS += $(CFLAGS)
|
LDFLAGS := $(addprefix -Xlinker ,$(LDFLAGS))
|
||||||
|
LDFLAGS += $(CFLAGS)
|
||||||
|
else
|
||||||
|
LDSTARTGROUP ?= --start-group
|
||||||
|
LDENDGROUP ?= --end-group
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIBPATH_OPT = -L
|
||||||
|
SCRIPT_OPT = -T
|
||||||
else
|
else
|
||||||
LDSTARTGROUP ?= --start-group
|
LIBPATH_OPT = --userlibpath
|
||||||
LDENDGROUP ?= --end-group
|
EXTRA_LIBS += arm_vectors.o
|
||||||
|
SCRIPT_OPT = --scatter=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
LDFLAGS += $(addprefix $(SCRIPT_OPT),$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
|
||||||
|
LIBPATHS += $(LIBPATH_OPT) $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging)
|
||||||
|
|
||||||
BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
|
BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
|
||||||
|
|
||||||
LIBPATHS += -L $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging)
|
|
||||||
ifeq ($(BOARDMAKE),y)
|
ifeq ($(BOARDMAKE),y)
|
||||||
LIBPATHS += -L $(call CONVERT_PATH,$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board)
|
LIBPATHS += $(LIBPATH_OPT) $(call CONVERT_PATH,$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
|
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,--library=%,$(LINKLIBS)))
|
||||||
ifeq ($(BOARDMAKE),y)
|
ifeq ($(BOARDMAKE),y)
|
||||||
LDLIBS += -lboard
|
LDLIBS += --library=board
|
||||||
endif
|
endif
|
||||||
|
|
||||||
VPATH += chip
|
VPATH += chip
|
||||||
VPATH += common
|
VPATH += common
|
||||||
VPATH += $(ARCH_SUBDIR)
|
VPATH += $(ARCH_SUBDIR)
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_TOOLCHAIN_IAR),y)
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_IAR),y)
|
||||||
VPATH += common$(DELIM)iar
|
VPATH += common$(DELIM)iar
|
||||||
else # ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
|
else # ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
|
||||||
VPATH += common$(DELIM)gnu
|
VPATH += common$(DELIM)gnu
|
||||||
|
@ -27,6 +27,8 @@ TOOLCHAIN_MFLOAT := -mfloat-abi=soft
|
|||||||
|
|
||||||
ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
|
||||||
TOOLCHAIN_MARCH := --config armv6m_soft_nofp_nosys
|
TOOLCHAIN_MARCH := --config armv6m_soft_nofp_nosys
|
||||||
|
else ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(TOPDIR)/arch/arm/src/common/Toolchain.defs
|
include $(TOPDIR)/arch/arm/src/common/Toolchain.defs
|
||||||
|
@ -61,4 +61,26 @@ else
|
|||||||
ARCHCPUFLAGS += -mfloat-abi=soft
|
ARCHCPUFLAGS += -mfloat-abi=soft
|
||||||
endif
|
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
|
include $(TOPDIR)/arch/arm/src/common/Toolchain.defs
|
||||||
|
@ -75,6 +75,28 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
|
|||||||
TOOLCHAIN_MARCH += --config armv7m_soft_nofp_nosys
|
TOOLCHAIN_MARCH += --config armv7m_soft_nofp_nosys
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
else ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_CORTEXM4),y)
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M4
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-M4.no_fp
|
||||||
|
endif
|
||||||
|
else ifeq ($(CONFIG_ARCH_CORTEXM7),y)
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
ifeq ($(CONFIG_ARCH_DPFPU),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M7
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-M7.fp.sp
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-M7.no_fp
|
||||||
|
endif
|
||||||
|
else # ifeq ($(CONFIG_ARCH_CORTEXM3),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M3
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
|
ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
|
||||||
|
@ -37,4 +37,24 @@ else
|
|||||||
ARCHCPUFLAGS += -mfloat-abi=soft
|
ARCHCPUFLAGS += -mfloat-abi=soft
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_CORTEXR4),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-R4
|
||||||
|
else ifeq ($(CONFIG_ARCH_CORTEXR5),y)
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-R5
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-R5.no_vfp
|
||||||
|
endif
|
||||||
|
else ifeq ($(CONFIG_ARCH_CORTEXR7),y)
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-R7
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-R7.no_vfp
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
include $(TOPDIR)/arch/arm/src/common/Toolchain.defs
|
include $(TOPDIR)/arch/arm/src/common/Toolchain.defs
|
||||||
|
@ -84,6 +84,38 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
else ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_CORTEXM23),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M23
|
||||||
|
else ifeq ($(CONFIG_ARCH_CORTEXM33),y)
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M33
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-M33.no_fp
|
||||||
|
endif
|
||||||
|
else ifeq ($(CONFIG_ARCH_CORTEXM35P),y)
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M35P
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-M35P.no_fp
|
||||||
|
endif
|
||||||
|
else ifeq ($(CONFIG_ARCH_CORTEXM55),y)
|
||||||
|
ifeq ($(CONFIG_ARM_HAVE_MVE),y)
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M55
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-M55.no_fp
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
LDFLAGS += --cpu=Cortex-M55.no_mve
|
||||||
|
else
|
||||||
|
LDFLAGS += --cpu=Cortex-M55.no_mve.no_fp
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARMV8M_STACKCHECK),y)
|
ifeq ($(CONFIG_ARMV8M_STACKCHECK),y)
|
||||||
|
@ -131,6 +131,32 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
|
|||||||
|
|
||||||
ARCHOPTIMIZATION += -fno-builtin
|
ARCHOPTIMIZATION += -fno-builtin
|
||||||
|
|
||||||
|
# ARM Compiler Clang toolchain
|
||||||
|
|
||||||
|
else ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
|
||||||
|
|
||||||
|
CC = armclang
|
||||||
|
CXX = armclang
|
||||||
|
CPP = armclang -E -P -x c
|
||||||
|
LD = armlink
|
||||||
|
STRIP = llvm-strip --strip-unneeded
|
||||||
|
AR = armar -rcs
|
||||||
|
NM = llvm-nm
|
||||||
|
OBJCOPY = llvm-objcopy
|
||||||
|
OBJDUMP = llvm-objdump
|
||||||
|
|
||||||
|
# Since the no_builtin attribute is not fully supported on Clang
|
||||||
|
# disable the built-in functions, refer:
|
||||||
|
# https://github.com/apache/incubator-nuttx/pull/5971
|
||||||
|
|
||||||
|
ARCHOPTIMIZATION += -fno-builtin
|
||||||
|
ARCHOPTIMIZATION += --target=arm-arm-none-eabi
|
||||||
|
|
||||||
|
# Suppress license warning
|
||||||
|
|
||||||
|
ARCHCPUFLAGS += -Wno-license-management
|
||||||
|
LDFLAGS += --diag_suppress=9931
|
||||||
|
|
||||||
# Default toolchain
|
# Default toolchain
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -174,23 +200,35 @@ endif
|
|||||||
ARCHOPTIMIZATION += -fno-common -Wall -Wshadow -Wundef
|
ARCHOPTIMIZATION += -fno-common -Wall -Wshadow -Wundef
|
||||||
ARCHOPTIMIZATION += -nostdlib
|
ARCHOPTIMIZATION += -nostdlib
|
||||||
|
|
||||||
LDFLAGS += -nostdlib
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
|
||||||
|
LDFLAGS += -nostdlib
|
||||||
|
endif
|
||||||
|
|
||||||
# Optimization of unused sections
|
# Optimization of unused sections
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
|
||||||
LDFLAGS += --gc-sections
|
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
|
||||||
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
|
LDFLAGS += --gc-sections
|
||||||
|
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Debug link map
|
# Debug link map
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
|
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
|
||||||
LDFLAGS += --cref -Map=$(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx.map)
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
|
||||||
|
LDFLAGS += --cref -Map=$(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx.map)
|
||||||
|
else
|
||||||
|
LDFLAGS += --strict --map --xref --symbols --info=unused --info=veneers
|
||||||
|
LDFLAGS += --info=summarysizes --info=summarystack
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
ARCHOPTIMIZATION += -g
|
ARCHOPTIMIZATION += -g
|
||||||
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
|
||||||
|
LDFLAGS += --debug
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Add the builtin library
|
# Add the builtin library
|
||||||
|
Loading…
Reference in New Issue
Block a user