You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/09/15 09:55:50 UTC

[GitHub] [incubator-nuttx] anchao opened a new pull request, #7100: arch/arm: add support for armclang compiler(AC6)

anchao opened a new pull request, #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100

   ## Summary
   
   arch/arm: add support for armclang compiler(AC6)
   
   Reference:
   https://developer.arm.com/tools-and-software/embedded/arm-compiler
   
   Signed-off-by: chao an <an...@xiaomi.com>
   
   
   ## Impact
   
   N/A
   
   ## Testing
   
   CI


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#discussion_r972562794


##########
boards/arm/stm32/stm32f4discovery/scripts/Make.defs:
##########
@@ -27,7 +27,7 @@ ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
 
 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
 
-ifneq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
+ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)

Review Comment:
   flag for all clang toolchain, ARMCLANG will select ARCH_TOOLCHAIN_CLANG



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#issuecomment-1249294999

   @anchao do we have any chart comparing code and data size under the equivalent build options between armclang and GCC for example?
   I recall we had some chart when adding LLVM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#discussion_r972564907


##########
arch/arm/src/common/Toolchain.defs:
##########
@@ -174,23 +200,35 @@ endif
 ARCHOPTIMIZATION += -fno-common -Wall -Wshadow -Wundef
 ARCHOPTIMIZATION += -nostdlib
 
-LDFLAGS += -nostdlib
+ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),)

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#discussion_r972569957


##########
arch/arm/src/Makefile:
##########
@@ -85,37 +85,49 @@ UOBJS = $(UAOBJS) $(UCOBJS)
 KBIN = libkarch$(LIBEXT)
 BIN  = libarch$(LIBEXT)
 
-LDFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
-
 # Override in Make.defs if linker is not 'ld'
 
-ifeq ($(LD),$(CC))
-  LDSTARTGROUP ?= -Wl,--start-group
-  LDENDGROUP   ?= -Wl,--end-group
-  LDFLAGS      := $(addprefix -Xlinker ,$(LDFLAGS))
-  LDFLAGS      += $(CFLAGS)
+ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
+  ifeq ($(LD),$(CC))
+    LDSTARTGROUP ?= -Wl,--start-group
+    LDENDGROUP   ?= -Wl,--end-group
+    LDFLAGS      := $(addprefix -Xlinker ,$(LDFLAGS))
+    LDFLAGS      += $(CFLAGS)
+  else
+    LDSTARTGROUP ?= --start-group
+    LDENDGROUP   ?= --end-group
+  endif
+
+  LIBPATH_OPT = -L
 else
-  LDSTARTGROUP ?= --start-group
-  LDENDGROUP   ?= --end-group
+  LIBPATH_OPT = --userlibpath
+  EXTRA_LIBS += arm_vectors.o
 endif
 
-BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
+ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#discussion_r972563339


##########
arch/arm/src/armv7-a/Toolchain.defs:
##########
@@ -61,4 +61,26 @@ else
   ARCHCPUFLAGS += -mfloat-abi=soft
 endif
 
+ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
+
+  ifeq ($(CONFIG_ARCH_CORTEXA5),y)
+    CPUFLAG = Cortex-A5

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
anchao commented on PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#issuecomment-1249330810

   > @anchao do we have any chart comparing code and data size under the equivalent build options between armclang and GCC for example? I recall we had some chart when adding LLVM
   
   Yes, the test results will be updated later, let me add the ac6 support for board spresense and imx6 first.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#discussion_r972564443


##########
arch/arm/src/armv7-m/Toolchain.defs:
##########
@@ -75,10 +75,28 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
       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
 
-ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
-  ARCHOPTIMIZATION += -finstrument-functions -ffixed-r10

Review Comment:
   emm, merge issue, let me restore the change



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#discussion_r972275099


##########
arch/arm/src/common/Toolchain.defs:
##########
@@ -0,0 +1,219 @@
+############################################################################
+# arch/arm/src/armv8-m/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.
+#
+############################################################################
+
+#
+# Supported toolchains
+#
+# Each toolchain definition should set:
+#
+#  CROSSDEV         The GNU toolchain triple (command prefix)
+#  ARCHCPUFLAGS     CPU-specific flags selecting the instruction set
+#                   FPU options, etc.
+#  ARCHOPTIMIZATION The optimization level that results in
+#                   reliable code generation.
+#
+
+ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
+  ARCHOPTIMIZATION += $(CONFIG_DEBUG_OPTLEVEL)
+else ifeq ($(CONFIG_DEBUG_FULLOPT),y)
+  ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
+    ARCHOPTIMIZATION += -Oz
+  else
+    ARCHOPTIMIZATION += -Os
+  endif
+endif
+
+ifneq ($(CONFIG_DEBUG_NOOPT),y)
+  ARCHOPTIMIZATION += -fno-strict-aliasing
+endif
+
+ifeq ($(CONFIG_FRAME_POINTER),y)
+  ARCHOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
+else
+  ARCHOPTIMIZATION += -fomit-frame-pointer
+endif
+
+ifeq ($(CONFIG_STACK_CANARIES),y)
+  ARCHOPTIMIZATION += -fstack-protector-all
+endif
+
+ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
+  ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
+endif
+
+ifeq ($(CONFIG_MM_UBSAN_ALL),y)
+  ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
+endif
+
+ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
+  ARCHOPTIMIZATION += -fsanitize-undefined-trap-on-error
+endif
+
+ifeq ($(CONFIG_MM_KASAN_ALL),y)
+  ARCHOPTIMIZATION += -fsanitize=kernel-address
+endif
+
+ifeq ($(CONFIG_ARM_THUMB),y)
+  ARCHOPTIMIZATION += -mthumb
+endif
+
+# Link Time Optimization
+
+ifeq ($(CONFIG_LTO_THIN),y)
+  ARCHOPTIMIZATION += -flto=thin
+else ifeq ($(CONFIG_LTO_FULL),y)
+  ARCHOPTIMIZATION += -flto
+  ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)
+    ARCHOPTIMIZATION += -fuse-linker-plugin
+  endif
+endif
+
+# NuttX buildroot under Linux or Cygwin
+
+ifeq ($(CONFIG_ENDIAN_BIG),y)
+  ARCHCPUFLAGS += -mbig-endian
+  TARGET_ARCH := armeb
+else
+  ARCHCPUFLAGS += -mlittle-endian
+  TARGET_ARCH := arm
+endif
+
+ARCHCPUFLAGS += $(TOOLCHAIN_MARCH) $(TOOLCHAIN_MTUNE) $(TOOLCHAIN_MFLOAT)
+
+ifeq ($(CONFIG_ARM_TOOLCHAIN_BUILDROOT),y)
+  CROSSDEV ?= $(TARGET_ARCH)-nuttx-eabi-
+endif
+
+ifeq ($(CONFIG_ARM_TOOLCHAIN_BUILDROOT_OABI),y)
+  CROSSDEV ?= $(TARGET_ARCH)-nuttx-elf-
+endif
+
+# Generic GNU EABI toolchain
+
+ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)
+  CROSSDEV ?= $(TARGET_ARCH)-none-eabi-
+endif
+
+# Clang toolchain
+
+ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
+
+  CC      = clang
+  CXX     = clang++
+  CPP     = clang -E -P -x c
+  LD      = ld.lld -m armelf
+  STRIP   = llvm-strip --strip-unneeded
+  AR      = llvm-ar 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
+
+# Default toolchain
+
+else
+  CC      = $(CROSSDEV)gcc
+  CXX     = $(CROSSDEV)g++
+  CPP     = $(CROSSDEV)gcc -E -P -x c
+  LD      = $(CROSSDEV)ld
+  STRIP   = $(CROSSDEV)strip --strip-unneeded
+  AR      = $(CROSSDEV)ar rcs
+  NM      = $(CROSSDEV)nm
+  OBJCOPY = $(CROSSDEV)objcopy
+  OBJDUMP = $(CROSSDEV)objdump
+
+  ifeq ($(CONFIG_LTO_FULL),y)
+    ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)

Review Comment:
   remove?



##########
arch/arm/src/armv7-m/Toolchain.defs:
##########
@@ -75,10 +75,28 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
       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
 
-ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
-  ARCHOPTIMIZATION += -finstrument-functions -ffixed-r10

Review Comment:
   why remove



##########
boards/arm/stm32/stm32f4discovery/scripts/Make.defs:
##########
@@ -27,7 +27,7 @@ ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
 
 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
 
-ifneq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
+ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)

Review Comment:
   revert?



##########
arch/arm/src/Makefile:
##########
@@ -85,37 +85,49 @@ UOBJS = $(UAOBJS) $(UCOBJS)
 KBIN = libkarch$(LIBEXT)
 BIN  = libarch$(LIBEXT)
 
-LDFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
-
 # Override in Make.defs if linker is not 'ld'
 
-ifeq ($(LD),$(CC))
-  LDSTARTGROUP ?= -Wl,--start-group
-  LDENDGROUP   ?= -Wl,--end-group
-  LDFLAGS      := $(addprefix -Xlinker ,$(LDFLAGS))
-  LDFLAGS      += $(CFLAGS)
+ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
+  ifeq ($(LD),$(CC))
+    LDSTARTGROUP ?= -Wl,--start-group
+    LDENDGROUP   ?= -Wl,--end-group
+    LDFLAGS      := $(addprefix -Xlinker ,$(LDFLAGS))
+    LDFLAGS      += $(CFLAGS)
+  else
+    LDSTARTGROUP ?= --start-group
+    LDENDGROUP   ?= --end-group
+  endif
+
+  LIBPATH_OPT = -L
 else
-  LDSTARTGROUP ?= --start-group
-  LDENDGROUP   ?= --end-group
+  LIBPATH_OPT = --userlibpath
+  EXTRA_LIBS += arm_vectors.o
 endif
 
-BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
+ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)

Review Comment:
   merge to line 90-99



##########
arch/arm/src/armv7-a/Toolchain.defs:
##########
@@ -61,4 +61,26 @@ else
   ARCHCPUFLAGS += -mfloat-abi=soft
 endif
 
+ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
+
+  ifeq ($(CONFIG_ARCH_CORTEXA5),y)
+    CPUFLAG = Cortex-A5

Review Comment:
   CPUFLAG->LDCPUFLAGS?



##########
arch/arm/src/common/Toolchain.defs:
##########
@@ -174,23 +200,35 @@ endif
 ARCHOPTIMIZATION += -fno-common -Wall -Wshadow -Wundef
 ARCHOPTIMIZATION += -nostdlib
 
-LDFLAGS += -nostdlib
+ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),)

Review Comment:
   CONFIG_ARM_TOOLCHAIN_ARMCLANG



##########
boards/misoc/lm32/misoc/README.txt:
##########
@@ -58,7 +58,7 @@ Buildroot Toolchain
   In order to use the buildroot toolchain, you also must set the following
   in your .config file:
 
-    CONFIG_LM3S_TOOLCHAIN_BUILDROOT=y
+    CONFIG_LM3S_ARM_TOOLCHAIN_BUILDROOT=y

Review Comment:
   revert



##########
boards/arm/eoss3/quickfeather/scripts/Make.defs:
##########
@@ -27,7 +27,7 @@ ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
 
 ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
 
-ifneq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
+ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)

Review Comment:
   revert



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100#discussion_r972562318


##########
boards/misoc/lm32/misoc/README.txt:
##########
@@ -58,7 +58,7 @@ Buildroot Toolchain
   In order to use the buildroot toolchain, you also must set the following
   in your .config file:
 
-    CONFIG_LM3S_TOOLCHAIN_BUILDROOT=y
+    CONFIG_LM3S_ARM_TOOLCHAIN_BUILDROOT=y

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #7100: arch/arm: add support for armclang compiler(AC6)

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #7100:
URL: https://github.com/apache/incubator-nuttx/pull/7100


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org