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

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

commit f654e5c307b0f31e1d9eb458f4f5bfd915babbe1
Author: Max Kriegleder <[email protected]>
AuthorDate: Thu Oct 29 17:54:48 2026 +0100

    arch/xtensa/cmake: Build the sources and use the flags of Make.
    
    * The ESP toolchain prefix ended in "-" and got "-gcc" appended:
      "xtensa-esp32s3-elf--gcc ... not found".
    * Add xtensa_fork.c, xtensa_debug.c, xtensa_tls.c and
      xtensa_addrenv_kstack.c under the conditions of Make.defs, and the
      syscall sources for every non-flat build, not only the protected one.
      Without xtensa_debug.c a build with ARCH_HAVE_DEBUG does not link
      (xtensa_debug_handler).
    * -mfix-esp32-psram-cache-issue with ESP32_SPIRAM, as the ESP32 boards'
      Make.defs.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: Max Kriegleder <[email protected]>
---
 arch/xtensa/src/cmake/Toolchain.cmake |  6 +++++-
 arch/xtensa/src/common/CMakeLists.txt | 18 +++++++++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/src/cmake/Toolchain.cmake 
b/arch/xtensa/src/cmake/Toolchain.cmake
index 79d33924334..758fd20253b 100644
--- a/arch/xtensa/src/cmake/Toolchain.cmake
+++ b/arch/xtensa/src/cmake/Toolchain.cmake
@@ -31,7 +31,7 @@ if(CONFIG_XTENSA_TOOLCHAIN_XCC OR 
CONFIG_XTENSA_TOOLCHAIN_XCLANG)
 endif()
 
 if(CONFIG_XTENSA_TOOLCHAIN_ESP)
-  set(TOOLCHAIN_PREFIX xtensa-${CONFIG_ARCH_CHIP}-elf-)
+  set(TOOLCHAIN_PREFIX xtensa-${CONFIG_ARCH_CHIP}-elf)
 endif()
 
 # Default toolchain
@@ -85,6 +85,10 @@ add_compile_options(-mlongcalls)
 
 add_compile_options(-mtext-section-literals)
 
+if(CONFIG_ESP32_SPIRAM)
+  add_compile_options(-mfix-esp32-psram-cache-issue)
+endif()
+
 if(CONFIG_MM_KASAN_INSTRUMENT_ALL)
   add_compile_options(-fsanitize=kernel-address)
   set(KASAN_PARAM "")
diff --git a/arch/xtensa/src/common/CMakeLists.txt 
b/arch/xtensa/src/common/CMakeLists.txt
index 60042af46f4..23355e606e9 100644
--- a/arch/xtensa/src/common/CMakeLists.txt
+++ b/arch/xtensa/src/common/CMakeLists.txt
@@ -75,6 +75,10 @@ list(
   xtensa_usestack.c
   xtensa_tcbinfo.c)
 
+if(CONFIG_ARCH_HAVE_FORK OR CONFIG_ARCH_HAVE_VFORK)
+  list(APPEND SRCS xtensa_fork.c)
+endif()
+
 if(CONFIG_ENABLE_ALL_SIGNALS)
   list(APPEND SRCS xtensa_schedsigaction.c xtensa_sigdeliver.c)
 endif()
@@ -89,10 +93,18 @@ if(CONFIG_ARCH_FPU)
   list(APPEND SRCS xtensa_fpucmp.c)
 endif()
 
+if(CONFIG_ARCH_HAVE_DEBUG)
+  list(APPEND SRCS xtensa_debug.c)
+endif()
+
 if(CONFIG_SCHED_BACKTRACE)
   list(APPEND SRCS xtensa_backtrace.c)
 endif()
 
+if(CONFIG_SCHED_THREAD_LOCAL)
+  list(APPEND SRCS xtensa_tls.c)
+endif()
+
 if(CONFIG_SMP)
   list(APPEND SRCS xtensa_smpcall.c)
 endif()
@@ -105,7 +117,11 @@ if(CONFIG_XTENSA_SEMIHOSTING_HOSTFS)
   list(APPEND SRCS xtensa_simcall.S xtensa_hostfs.c)
 endif()
 
-if(CONFIG_BUILD_PROTECTED)
+if(CONFIG_ARCH_KERNEL_STACK)
+  list(APPEND SRCS xtensa_addrenv_kstack.c)
+endif()
+
+if(NOT CONFIG_BUILD_FLAT)
   target_sources(arch_interface PRIVATE xtensa_signal_handler.S)
   list(APPEND SRCS xtensa_dispatch_syscall.S)
   list(APPEND SRCS xtensa_task_start.c xtensa_pthread_start.c)

Reply via email to