You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/09/22 14:19:12 UTC

[incubator-nuttx] branch master updated: arch/arm: fallback to common toolchain if armeb(endian big) is unavailable

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 59499c0bb2 arch/arm: fallback to common toolchain if armeb(endian big) is unavailable
59499c0bb2 is described below

commit 59499c0bb243ad21d45476e6ff2df66eadd60d8a
Author: chao an <an...@xiaomi.com>
AuthorDate: Wed Sep 21 21:42:11 2022 +0800

    arch/arm: fallback to common toolchain if armeb(endian big) is unavailable
    
    Signed-off-by: chao an <an...@xiaomi.com>
---
 arch/arm/src/common/Toolchain.defs | 40 ++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs
index f5c8c65fe1..ffe4d44534 100644
--- a/arch/arm/src/common/Toolchain.defs
+++ b/arch/arm/src/common/Toolchain.defs
@@ -87,30 +87,36 @@ 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-
+  TARGET_TOOL := -nuttx-eabi-
+else ifeq ($(CONFIG_ARM_TOOLCHAIN_BUILDROOT_OABI),y)
+  TARGET_TOOL := -nuttx-elf-
+else ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)
+  TARGET_TOOL := -none-eabi-
 endif
 
-ifeq ($(CONFIG_ARM_TOOLCHAIN_BUILDROOT_OABI),y)
-  CROSSDEV ?= $(TARGET_ARCH)-nuttx-elf-
-endif
+ifneq ($(TARGET_TOOL),)
+  ifeq ($(CONFIG_ENDIAN_BIG),y)
 
-# Generic GNU EABI toolchain
+    # Fallback to common toolchain if "armeb" is unavailable
 
-ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)
-  CROSSDEV ?= $(TARGET_ARCH)-none-eabi-
+    ifeq ($(shell command -v armeb$(TARGET_TOOL)gcc 2> /dev/null),)
+      TARGET_ARCH := arm
+      ARCHCPUFLAGS += -mlittle-endian
+    else
+      TARGET_ARCH := armeb
+      ARCHCPUFLAGS += -mbig-endian
+    endif
+  else
+    ARCHCPUFLAGS += -mlittle-endian
+    TARGET_ARCH := arm
+  endif
+
+  CROSSDEV ?= $(TARGET_ARCH)$(TARGET_TOOL)
 endif
 
+ARCHCPUFLAGS += $(TOOLCHAIN_MARCH) $(TOOLCHAIN_MTUNE) $(TOOLCHAIN_MFLOAT)
+
 # Clang toolchain
 
 ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)