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

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


The following commit(s) were added to refs/heads/master by this push:
     new 693513f0343 arch/arm64: make per-core -mcpu flags reachable in both 
build systems
693513f0343 is described below

commit 693513f0343d1aefcb6826fdfe600bedb8efd138
Author: rikaken2004 <[email protected]>
AuthorDate: Wed Sep 30 16:30:54 2026 +0800

    arch/arm64: make per-core -mcpu flags reachable in both build systems
    
    Every ARCH_CORTEX_A5x config selects ARCH_ARMV8A, and both
    Toolchain.defs and cmake/Toolchain.cmake test CONFIG_ARCH_ARMV8A at
    the head of the chain, so the -mcpu=cortex-a53/a55/a57/a72 branches
    were unreachable and all Cortex-A targets built with plain
    -march=armv8-a, losing per-core scheduling/tuning.
    
    Test the specific cores first so -mcpu wins for them; the generic
    ARCH_ARMV8A branch still covers cores without a dedicated entry and
    keeps the armv8.5-a/MTE handling. Also add the missing cortex-a55
    branch to the cmake toolchain for parity with the makefile.
    
    Signed-off-by: rikaken2004 <[email protected]>
---
 arch/arm64/src/Toolchain.defs        | 18 +++++++++---------
 arch/arm64/src/cmake/Toolchain.cmake | 16 +++++++++-------
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/arm64/src/Toolchain.defs b/arch/arm64/src/Toolchain.defs
index 3fc5950552a..dad042310ce 100644
--- a/arch/arm64/src/Toolchain.defs
+++ b/arch/arm64/src/Toolchain.defs
@@ -32,7 +32,15 @@
 #                   reliable code generation.
 #
 
-ifeq ($(CONFIG_ARCH_ARMV8A),y)
+ifeq ($(CONFIG_ARCH_CORTEX_A53),y)
+  ARCHCPUFLAGS += -mcpu=cortex-a53
+else ifeq ($(CONFIG_ARCH_CORTEX_A55),y)
+  ARCHCPUFLAGS += -mcpu=cortex-a55
+else ifeq ($(CONFIG_ARCH_CORTEX_A57),y)
+  ARCHCPUFLAGS += -mcpu=cortex-a57
+else ifeq ($(CONFIG_ARCH_CORTEX_A72),y)
+  ARCHCPUFLAGS += -mcpu=cortex-a72
+else ifeq ($(CONFIG_ARCH_ARMV8A),y)
   ifeq ($(CONFIG_ARCH_AS_HAS_ARMV8_5),y)
     OPTION_MARCH = -march=armv8.5-a
   else
@@ -48,14 +56,6 @@ else ifeq ($(CONFIG_ARCH_ARMV8R),y)
   else
     ARCHCPUFLAGS += -march=armv8-r+nofp
   endif
-else ifeq ($(CONFIG_ARCH_CORTEX_A53),y)
-  ARCHCPUFLAGS += -mcpu=cortex-a53
-else ifeq ($(CONFIG_ARCH_CORTEX_A55),y)
-  ARCHCPUFLAGS += -mcpu=cortex-a55
-else ifeq ($(CONFIG_ARCH_CORTEX_A57),y)
-  ARCHCPUFLAGS += -mcpu=cortex-a57
-else ifeq ($(CONFIG_ARCH_CORTEX_A72),y)
-  ARCHCPUFLAGS += -mcpu=cortex-a72
 else ifeq ($(CONFIG_ARCH_CORTEX_R82),y)
   ARCHCPUFLAGS += -mcpu=cortex-r82
 endif
diff --git a/arch/arm64/src/cmake/Toolchain.cmake 
b/arch/arm64/src/cmake/Toolchain.cmake
index ab7cb6928a6..0ff14f48c33 100644
--- a/arch/arm64/src/cmake/Toolchain.cmake
+++ b/arch/arm64/src/cmake/Toolchain.cmake
@@ -25,7 +25,15 @@ set(CMAKE_SYSTEM_VERSION 1)
 set(CMAKE_C_COMPILER_FORCED TRUE)
 set(CMAKE_CXX_COMPILER_FORCED TRUE)
 
-if(CONFIG_ARCH_ARMV8A)
+if(CONFIG_ARCH_CORTEX_A53)
+  add_compile_options(-mcpu=cortex-a53)
+elseif(CONFIG_ARCH_CORTEX_A55)
+  add_compile_options(-mcpu=cortex-a55)
+elseif(CONFIG_ARCH_CORTEX_A57)
+  add_compile_options(-mcpu=cortex-a57)
+elseif(CONFIG_ARCH_CORTEX_A72)
+  add_compile_options(-mcpu=cortex-a72)
+elseif(CONFIG_ARCH_ARMV8A)
   add_compile_options(-march=armv8-a)
 elseif(CONFIG_ARCH_ARMV8R)
   if(CONFIG_ARCH_FPU)
@@ -33,12 +41,6 @@ elseif(CONFIG_ARCH_ARMV8R)
   else()
     add_compile_options(-march=armv8-r+nofp)
   endif()
-elseif(CONFIG_ARCH_CORTEX_A53)
-  add_compile_options(-mcpu=cortex-a53)
-elseif(CONFIG_ARCH_CORTEX_A57)
-  add_compile_options(-mcpu=cortex-a57)
-elseif(CONFIG_ARCH_CORTEX_A72)
-  add_compile_options(-mcpu=cortex-a72)
 elseif(CONFIG_ARCH_CORTEX_R82)
   add_compile_options(-mcpu=cortex-r82)
 endif()

Reply via email to