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 d5b3a2ea29514990ff3a364a759646aba6271790
Author: Max Kriegleder <[email protected]>
AuthorDate: Thu Oct 29 17:54:48 2026 +0100

    arch/xtensa/espressif: Complete the CMake build of the Xtensa ESP32 chips.
    
    * Clone esp-hal-3rdparty at configure time (or take it from nxtmpdir),
      apply the mbedtls patches and, with ESPRESSIF_WIRELESS, initialize the
      Wi-Fi and Bluetooth submodules of the chip, as the chips' Make.defs.
    * hal_<chip>.cmake: the HAL include paths, sources, ROM linker scripts and
      libraries of hal.mk; the shared hal_xtensa_espressif.cmake (a partial
      list nothing included) goes.
    * The chips' CMakeLists.txt: all sources and flags of their Make.defs.
    * Wireless.cmake: Wireless.mk (Wi-Fi, mbedtls, wpa_supplicant, the
      Bluetooth controller libraries).
    * Build nuttx.bin with espressif_mkimage.cmake and add a flash target.
    * Initialize the wireless submodules also when wireless is enabled in a
      build directory whose HAL was cloned without it.
    * Only simple boot: MCUboot and the legacy app format stop at configure
      time with a message to use Make (their bootloader build is not ported);
      so do configs with the ULP RISC-V coprocessor (its program is built by
      the boards' Make files).
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: Max Kriegleder <[email protected]>
---
 arch/xtensa/src/common/espressif/CMakeLists.txt | 215 +++++++++++-
 arch/xtensa/src/common/espressif/Wireless.cmake | 342 ++++++++++++++++++
 arch/xtensa/src/esp32/CMakeLists.txt            | 137 ++++++--
 arch/xtensa/src/esp32/hal_esp32.cmake           | 406 +++++++++++++++++++++-
 arch/xtensa/src/esp32s2/CMakeLists.txt          |  91 ++++-
 arch/xtensa/src/esp32s2/hal_esp32s2.cmake       | 405 +++++++++++++++++++++-
 arch/xtensa/src/esp32s3/CMakeLists.txt          | 161 ++++++++-
 arch/xtensa/src/esp32s3/hal_esp32s3.cmake       | 442 +++++++++++++++++++++++-
 8 files changed, 2148 insertions(+), 51 deletions(-)

diff --git a/arch/xtensa/src/common/espressif/CMakeLists.txt 
b/arch/xtensa/src/common/espressif/CMakeLists.txt
index 48762d1a824..dd423a7c1ae 100644
--- a/arch/xtensa/src/common/espressif/CMakeLists.txt
+++ b/arch/xtensa/src/common/espressif/CMakeLists.txt
@@ -4,6 +4,25 @@
 # SPDX-License-Identifier: Apache-2.0
 # 
##############################################################################
 
+# The CMake build makes simple boot images only; MCUboot and the legacy app
+# format (the bootloader build of the chips' Bootloader.mk) need Make for now.
+
+if(NOT CONFIG_ESPRESSIF_SIMPLE_BOOT)
+  message(
+    FATAL_ERROR
+      "CMake builds of ${CONFIG_ARCH_CHIP} support ESPRESSIF_SIMPLE_BOOT only, 
use Make for MCUboot or the legacy app format"
+  )
+endif()
+
+# The ULP RISC-V program is built by the boards' Make files only.
+
+if(CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE)
+  message(
+    FATAL_ERROR
+      "CMake builds of ${CONFIG_ARCH_CHIP} do not build the ULP RISC-V 
program, use Make for ESPRESSIF_USE_ULP_RISCV_CORE"
+  )
+endif()
+
 set(SRCS)
 
 if(CONFIG_ESP_RMT)
@@ -132,6 +151,198 @@ if(CONFIG_ESPRESSIF_EFUSE)
   target_link_options(nuttx PRIVATE "SHELL:-u esp_efuse_startup_include_func")
 endif()
 
-target_include_directories(arch
-                           PRIVATE 
${CMAKE_CURRENT_SOURCE_DIR}/platform_include)
+# 
##############################################################################
+# ESP HAL 3rd Party Repository
+# 
##############################################################################
+
+set(ESP_HAL_3RDPARTY_REPO_NAME esp-hal-3rdparty)
+
+if(DEFINED ENV{ESP_HAL_3RDPARTY_VERSION})
+  set(ESP_HAL_3RDPARTY_VERSION
+      $ENV{ESP_HAL_3RDPARTY_VERSION}
+      CACHE STRING "ESP HAL 3rdparty version")
+else()
+  set(ESP_HAL_3RDPARTY_VERSION
+      cf95a27f2aa263d77c7a8d7f56007abfc899fc47
+      CACHE STRING "ESP HAL 3rdparty version")
+endif()
+
+if(DEFINED ENV{ESP_HAL_3RDPARTY_URL})
+  set(ESP_HAL_3RDPARTY_URL
+      $ENV{ESP_HAL_3RDPARTY_URL}
+      CACHE STRING "ESP HAL 3rdparty URL")
+else()
+  set(ESP_HAL_3RDPARTY_URL
+      https://github.com/espressif/esp-hal-3rdparty.git
+      CACHE STRING "ESP HAL 3rdparty URL")
+endif()
+
+option(
+  NXTMPDIR
+  "Enable and use a persistent ESP third-party HAL cache directory under 
nuttx/../nxtmpdir"
+  OFF)
+
+get_filename_component(
+  ESP_HAL_3RDPARTY_CHIP_DIR
+  
"${NUTTX_BINARY_DIR}/arch/xtensa/src/common/espressif/${ESP_HAL_3RDPARTY_REPO_NAME}"
+  REALPATH)
+
+set(EXECUTE_CLONE_ESP_HAL_3RDPARTY_REPO TRUE)
+set(ESP_HAL_3RDPARTY_REPO "${ESP_HAL_3RDPARTY_CHIP_DIR}")
+string(REPLACE "\"" "" CHIP_SERIES "${CONFIG_ESPRESSIF_CHIP_SERIES}")
+
+# The Wi-Fi and Bluetooth libraries of each chip (submodules of the HAL)
+if(CONFIG_ARCH_CHIP_ESP32)
+  set(ESP_HAL_WIRELESS_SUBMODULES
+      components/esp_phy/lib components/esp_wifi/lib
+      components/bt/controller/lib_esp32 components/esp_coex/lib)
+elseif(CONFIG_ARCH_CHIP_ESP32S2)
+  set(ESP_HAL_WIRELESS_SUBMODULES components/esp_phy/lib
+                                  components/esp_wifi/lib)
+else()
+  set(ESP_HAL_WIRELESS_SUBMODULES
+      components/esp_phy/lib components/esp_wifi/lib
+      components/bt/controller/lib_esp32c3_family components/esp_coex/lib)
+endif()
+
+# Clone the esp-hal-3rdparty repository and set up its submodules, once, when
+# CMake is configured.
+if(NOT IS_DIRECTORY "${ESP_HAL_3RDPARTY_REPO}")
+  # NXTMPDIR holds a cached copy of the repository in nuttx/../nxtmpdir
+  if(NXTMPDIR)
+    set(ESP_HAL_NXTMPDIR_CACHE 
"${NXTMPDIR_PATH}/${ESP_HAL_3RDPARTY_REPO_NAME}")
+    get_filename_component(ESP_HAL_NXTMPDIR_CACHE "${ESP_HAL_NXTMPDIR_CACHE}"
+                           REALPATH)
+    nuttx_check_git_hash(
+      "${ESP_HAL_NXTMPDIR_CACHE}" "${ESP_HAL_3RDPARTY_VERSION}"
+      ESP_HAL_3RDPARTY_REVISION_OK)
+    if(NOT ESP_HAL_3RDPARTY_REVISION_OK)
+      if(EXISTS "${ESP_HAL_NXTMPDIR_CACHE}")
+        message(
+          STATUS
+            "Removing esp-hal-3rdparty at ${ESP_HAL_NXTMPDIR_CACHE} (revision 
mismatch)"
+        )
+        file(REMOVE_RECURSE "${ESP_HAL_NXTMPDIR_CACHE}")
+      endif()
+    else()
+      set(EXECUTE_CLONE_ESP_HAL_3RDPARTY_REPO FALSE)
+    endif()
+    set(ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR "${ESP_HAL_NXTMPDIR_CACHE}")
+  else()
+    set(ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR "${ESP_HAL_3RDPARTY_CHIP_DIR}")
+  endif()
+
+  if(EXECUTE_CLONE_ESP_HAL_3RDPARTY_REPO
+     AND NOT EXISTS "${ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR}")
+    message(STATUS "Cloning Espressif HAL for 3rd Party Platforms")
+    FetchContent_Declare(
+      esp_hal_3rdparty
+      GIT_REPOSITORY ${ESP_HAL_3RDPARTY_URL}
+      GIT_TAG ${ESP_HAL_3RDPARTY_VERSION}
+      SOURCE_DIR ${ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR}
+      GIT_SUBMODULES "")
+    FetchContent_MakeAvailable(esp_hal_3rdparty)
+  endif()
+
+  # cmake-format: off
+
+  # Patch mbedtls
+  execute_process(COMMAND git submodule --quiet update --init 
components/mbedtls/mbedtls
+                  WORKING_DIRECTORY ${ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR})
+  execute_process(COMMAND git -C components/mbedtls/mbedtls reset --quiet 
--hard
+                  WORKING_DIRECTORY ${ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR})
+  file(GLOB ESP_HAL_MBEDTLS_PATCHES
+       
${ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR}/nuttx/patches/components/mbedtls/mbedtls/*.patch)
+  execute_process(COMMAND git apply ${ESP_HAL_MBEDTLS_PATCHES}
+                  WORKING_DIRECTORY 
${ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR}/components/mbedtls/mbedtls)
+
+  if(CONFIG_ESPRESSIF_WIRELESS)
+    message(
+      STATUS "Espressif HAL for 3rd Party Platforms: initializing 
submodules...")
+    execute_process(
+      COMMAND git submodule --quiet update --init --depth=1 
${ESP_HAL_WIRELESS_SUBMODULES}
+      WORKING_DIRECTORY ${ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR}
+      RESULT_VARIABLE GIT_SUBMODULE_RESULT)
+    if(NOT GIT_SUBMODULE_RESULT EQUAL 0)
+      message(FATAL_ERROR "Failed to initialize the Wi-Fi submodules of 
${ESP_HAL_3RDPARTY_FETCH_SOURCE_DIR}")
+    endif()
+  endif()
+
+  # cmake-format: on
+
+  if(NXTMPDIR AND NOT EXISTS "${ESP_HAL_3RDPARTY_CHIP_DIR}")
+    message(
+      STATUS
+        "Copying from ${ESP_HAL_NXTMPDIR_CACHE} to 
${ESP_HAL_3RDPARTY_CHIP_DIR}"
+    )
+    file(COPY "${ESP_HAL_NXTMPDIR_CACHE}"
+         DESTINATION "${ESP_HAL_3RDPARTY_CHIP_DIR}/..")
+  endif()
+endif()
+
+# A repository cloned for a configuration without wireless lacks the wireless
+# submodules: initialize them when wireless was enabled afterwards.
+if(CONFIG_ESPRESSIF_WIRELESS
+   AND NOT EXISTS
+       
"${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/lib/${CHIP_SERIES}/libphy.a"
+)
+  message(
+    STATUS "Espressif HAL for 3rd Party Platforms: initializing submodules...")
+  execute_process(
+    COMMAND git submodule --quiet update --init --depth=1
+            ${ESP_HAL_WIRELESS_SUBMODULES}
+    WORKING_DIRECTORY ${ESP_HAL_3RDPARTY_REPO}
+    RESULT_VARIABLE GIT_SUBMODULE_RESULT)
+  if(NOT GIT_SUBMODULE_RESULT EQUAL 0)
+    message(
+      FATAL_ERROR
+        "Failed to initialize the wireless submodules of 
${ESP_HAL_3RDPARTY_REPO}"
+    )
+  endif()
+endif()
+
+# 
##############################################################################
+# HAL sources and include paths (before the Espressif include paths)
+# 
##############################################################################
+
+include(${NUTTX_CHIP_ABS_DIR}/hal_${CHIP_SERIES}.cmake)
+
+if(CONFIG_ESPRESSIF_WIRELESS)
+  include(${CMAKE_CURRENT_SOURCE_DIR}/Wireless.cmake)
+endif()
+
+target_include_directories(
+  arch PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+               ${CMAKE_CURRENT_SOURCE_DIR}/platform_include)
 target_sources(arch PRIVATE ${SRCS})
+
+# 
##############################################################################
+# ESP binary image and flashing
+# 
##############################################################################
+
+if(NOT TARGET nuttx_post_build)
+  add_custom_target(nuttx_post_build)
+endif()
+
+add_custom_command(
+  TARGET nuttx_post_build
+  POST_BUILD
+  COMMAND
+    ${CMAKE_COMMAND} -DBINARY_DIR=${NUTTX_BINARY_DIR} -DSOURCE_DIR=${NUTTX_DIR}
+    -P ${NUTTX_DIR}/tools/espressif/espressif_mkimage.cmake
+  WORKING_DIRECTORY ${NUTTX_BINARY_DIR}
+  COMMENT "Generating ESP-compatible binary"
+  VERBATIM)
+
+# Usage: ESPTOOL_PORT=/dev/ttyUSBx cmake --build <build_dir> --target flash
+
+add_custom_target(
+  flash
+  DEPENDS nuttx_post_build
+  COMMAND
+    ${CMAKE_COMMAND} -DBINARY_DIR=${NUTTX_BINARY_DIR} -DSOURCE_DIR=${NUTTX_DIR}
+    -DNUTTX_DIR=${NUTTX_DIR} -P
+    ${NUTTX_DIR}/tools/espressif/espressif_flash.cmake
+  WORKING_DIRECTORY ${NUTTX_BINARY_DIR}
+  COMMENT "Flashing firmware via esptool to $ENV{ESPTOOL_PORT}"
+  VERBATIM)
diff --git a/arch/xtensa/src/common/espressif/Wireless.cmake 
b/arch/xtensa/src/common/espressif/Wireless.cmake
new file mode 100644
index 00000000000..6ef3bf81be6
--- /dev/null
+++ b/arch/xtensa/src/common/espressif/Wireless.cmake
@@ -0,0 +1,342 @@
+# 
##############################################################################
+# arch/xtensa/src/common/espressif/Wireless.cmake
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# 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.
+#
+# 
##############################################################################
+
+# Wi-Fi and Bluetooth, as Wireless.mk (and the chips' Make.defs for the
+# Bluetooth controller libraries)
+
+# arch/xtensa/src/common/espressif/Wireless.mk SPDX-License-Identifier:
+# Apache-2.0 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.
+if(CONFIG_ARCH_CHIP_ESP32)
+  target_include_directories(
+    arch
+    PRIVATE
+      ${ESP_HAL_3RDPARTY_REPO}/components/bt/include/${CHIP_SERIES}/include)
+endif()
+if(CONFIG_ARCH_CHIP_ESP32S3)
+  target_include_directories(
+    arch PRIVATE 
${ESP_HAL_3RDPARTY_REPO}/components/bt/include/esp32c3/include)
+endif()
+target_include_directories(
+  arch
+  PRIVATE
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_coex/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/wifi_apps/roaming_app/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/include/esp_wifi)
+# Prebuilt libraries
+
+set(ESP_WIFI_LIB_DIR
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES})
+set(ESP_PHY_LIB_DIR
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/lib/${CHIP_SERIES})
+set(ESP_COEX_LIB_DIR
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_coex/lib/${CHIP_SERIES})
+
+if(CONFIG_ARCH_CHIP_ESP32)
+  nuttx_add_extra_library(${ESP_PHY_LIB_DIR}/librtc.a)
+endif()
+
+if(NOT CONFIG_ARCH_CHIP_ESP32S2)
+  nuttx_add_extra_library(${ESP_COEX_LIB_DIR}/libcoexist.a)
+endif()
+
+nuttx_add_extra_library(${ESP_PHY_LIB_DIR}/libphy.a)
+
+if(CONFIG_ESPRESSIF_WIFI)
+  nuttx_add_extra_library(
+    ${ESP_WIFI_LIB_DIR}/libcore.a ${ESP_WIFI_LIB_DIR}/libnet80211.a
+    ${ESP_WIFI_LIB_DIR}/libpp.a ${ESP_WIFI_LIB_DIR}/libespnow.a)
+endif()
+
+if(CONFIG_WPA_WAPI_PSK)
+  nuttx_add_extra_library(${ESP_WIFI_LIB_DIR}/libwapi.a)
+endif()
+
+if(CONFIG_ESPRESSIF_BLE)
+  if(CONFIG_ARCH_CHIP_ESP32)
+    nuttx_add_extra_library(
+      
${ESP_HAL_3RDPARTY_REPO}/components/bt/controller/lib_esp32/${CHIP_SERIES}/libbtdm_app.a
+    )
+  elseif(CONFIG_ARCH_CHIP_ESP32S3)
+    nuttx_add_extra_library(
+      ${ESP_PHY_LIB_DIR}/libbtbb.a
+      
${ESP_HAL_3RDPARTY_REPO}/components/bt/controller/lib_esp32c3_family/${CHIP_SERIES}/libbtdm_app.a
+    )
+  endif()
+endif()
+target_include_directories(
+  arch
+  PRIVATE
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/include)
+list(APPEND SRCS ${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/src/wifi_init.c)
+if(CONFIG_ESPRESSIF_WIFI)
+  target_include_directories(
+    arch
+    PRIVATE
+      ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/library
+      ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/include
+      ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/include/aes
+      ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/psa_driver/include
+      
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/include
+      
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src
+      ${ESP_HAL_3RDPARTY_REPO}/nuttx/include/mbedtls)
+  target_compile_definitions(
+    arch PRIVATE "MBEDTLS_CONFIG_FILE=<mbedtls/esp_config.h>")
+  list(
+    APPEND
+    SRCS
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/aes.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/aria.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_core.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/ccm.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher_wrap.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/cmac.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/constant_time.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/ctr_drbg.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp_curves.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/gcm.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/md.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/pkcs5.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/platform_util.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/platform.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/sha1.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/sha3.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/sha256.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/sha512.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/pk.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/pk_wrap.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/pkparse.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/ecdsa.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/asn1parse.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/asn1write.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/md5.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/oid.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/pem.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/hmac_drbg.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_alt_helpers.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/ecdh.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/pk_ecc.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/pk_rsa.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_util.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ffdh.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_rsa.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_cipher.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_mac.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_hash.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core/psa_crypto_client.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core/psa_crypto_driver_wrappers_no_static.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core/psa_crypto_slot_management.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core/psa_crypto_storage.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core/psa_crypto.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core/psa_its_file.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core/tf_psa_crypto_version.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/esp_psa_crypto_init.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/esp_hardware.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/esp_mem.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/esp_timing.c)
+  # Ensure PSA crypto initialization is included in the build
+  target_link_options(nuttx PRIVATE
+                      "SHELL:-u mbedtls_psa_crypto_init_include_impl")
+  if(NOT CONFIG_ARCH_CHIP_ESP32)
+    list(
+      APPEND
+      SRCS
+      
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/psa_driver/esp_mac/psa_crypto_driver_esp_hmac_opaque.c
+    )
+  endif()
+  list(
+    APPEND
+    SRCS
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/psa_driver/esp_md/psa_crypto_driver_esp_md5.c
+  )
+  target_compile_definitions(
+    arch
+    PRIVATE __ets__
+            CONFIG_CRYPTO_MBEDTLS
+            CONFIG_ECC
+            CONFIG_IEEE80211W
+            CONFIG_WPA3_SAE
+            EAP_PEER_METHOD
+            ESP_PLATFORM=1
+            "TF_PSA_CRYPTO_USER_CONFIG_FILE=\"mbedtls/esp_config.h\""
+            ESP_SUPPLICANT
+            ESPRESSIF_USE
+            IEEE8021X_EAPOL
+            USE_WPA2_TASK
+            CONFIG_SHA256
+            USE_WPS_TASK)
+  if(CONFIG_ESPRESSIF_WIFI_SOFTAP_SAE_SUPPORT)
+    target_compile_definitions(arch PRIVATE CONFIG_SAE)
+  endif()
+  if(CONFIG_ESPRESSIF_WIFI_ENABLE_SAE_PK)
+    target_compile_definitions(arch PRIVATE CONFIG_SAE_PK)
+  endif()
+  if(CONFIG_ESPRESSIF_WIFI_ENABLE_SAE_H2E)
+    target_compile_definitions(arch PRIVATE CONFIG_SAE_H2E)
+  endif()
+  if(CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA)
+    target_compile_definitions(arch PRIVATE CONFIG_OWE_STA)
+  endif()
+  if(CONFIG_ESPRESSIF_WIFI_GCMP_SUPPORT)
+    target_compile_definitions(arch PRIVATE CONFIG_GCMP)
+  endif()
+  if(CONFIG_ESPRESSIF_WIFI_GMAC_SUPPORT)
+    target_compile_definitions(arch PRIVATE CONFIG_GMAC)
+  endif()
+  target_include_directories(
+    arch PRIVATE ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/ap)
+  list(
+    APPEND
+    SRCS
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/ap/ap_config.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/ap/ieee802_11.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/ap/comeback_token.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/ap/pmksa_cache_auth.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/ap/sta_info.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/ap/wpa_auth_ie.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/ap/wpa_auth.c)
+  target_include_directories(
+    arch PRIVATE ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/common)
+  list(
+    APPEND
+    SRCS
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/common/dragonfly.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/common/sae.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/common/wpa_common.c)
+  if(CONFIG_ESPRESSIF_WIFI_ENABLE_SAE_PK)
+    list(APPEND SRCS
+         
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/common/sae_pk.c)
+  endif()
+  list(
+    APPEND
+    SRCS
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/common/bss.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/common/scan.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/common/ieee802_11_common.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/aes-ccm.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/aes-gcm.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/aes-unwrap.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/aes-wrap.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/ccmp.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/crypto_ops.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/des-internal.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/dh_groups.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/rc4.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/sha1-prf.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/sha256-kdf.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/sha256-prf.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/chap.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/eap_common.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/eap_mschapv2.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/eap_peap_common.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/eap_peap.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/eap_tls_common.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/eap_tls.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/eap_ttls.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/eap.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/eap_peer/mschapv2.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/rsn_supp/wpa_ie.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/rsn_supp/wpa.c)
+  target_include_directories(
+    arch PRIVATE ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/utils)
+  list(
+    APPEND
+    SRCS
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/src/base64.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/utils/bitfield.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/utils/common.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/utils/ext_password.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/utils/json.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/utils/uuid.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/utils/wpa_debug.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/utils/wpabuf.c)
+  target_include_directories(
+    arch
+    PRIVATE ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/port/include)
+  list(APPEND SRCS
+       ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/port/eloop.c
+       ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/port/os_xtensa.c)
+  target_include_directories(
+    arch
+    PRIVATE
+      ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src)
+  list(
+    APPEND
+    SRCS
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/esp_common.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/esp_hostap.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/esp_wpas_glue.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/esp_owe.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/esp_scan.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/esp_wps.c
+  )
+  target_include_directories(
+    arch PRIVATE ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto)
+  list(
+    APPEND
+    SRCS
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-bignum.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-ec.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-rsa.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/esp_supplicant/src/crypto/tls_mbedtls.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/wpa_supplicant/src/crypto/aes-siv.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/src/lib_printf.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/regulatory/esp_wifi_regulatory.c
+  )
+  if(CONFIG_ESPRESSIF_WIFI_BT_COEXIST)
+    list(APPEND SRCS
+         ${ESP_HAL_3RDPARTY_REPO}/components/esp_coex/src/lib_printf.c)
+  endif()
+endif()
+# Linker scripts
+if(CONFIG_ARCH_CHIP_ESP32S3)
+  set_property(
+    GLOBAL APPEND
+    PROPERTY
+      LD_SCRIPT
+      
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.bt_funcs.ld
+  )
+endif()
diff --git a/arch/xtensa/src/esp32/CMakeLists.txt 
b/arch/xtensa/src/esp32/CMakeLists.txt
index 98d28fb1f2e..2c3818ee262 100644
--- a/arch/xtensa/src/esp32/CMakeLists.txt
+++ b/arch/xtensa/src/esp32/CMakeLists.txt
@@ -4,41 +4,136 @@
 # SPDX-License-Identifier: Apache-2.0
 # 
##############################################################################
 
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common/espressif espressif)
-
-set(SRCS
-    esp32_start.c
-    esp32_wdt.c
-    esp32_allocateheap.c
-    esp32_systemreset.c
-    esp32_resetcause.c
-    esp32_region.c
-    esp32_rtc_gpio.c
-    esp32_user.c
-    esp32_libc_stubs.c
-    esp32_dma.c)
-
+set(SRCS esp32_start.c esp32_wdt.c)
+if(CONFIG_XTENSA_HAVE_WINDOW_EXCEPTION_HOOKS)
+  list(APPEND SRCS esp32_window_hooks.S)
+endif()
+list(APPEND SRCS esp32_allocateheap.c)
+list(APPEND SRCS esp32_systemreset.c esp32_resetcause.c)
+list(APPEND SRCS esp32_region.c esp32_rtc_gpio.c)
+list(APPEND SRCS esp32_user.c esp32_libc_stubs.c)
+list(APPEND SRCS esp32_dma.c)
 if(NOT CONFIG_ARCH_IDLE_CUSTOM)
   list(APPEND SRCS esp32_idle.c)
 endif()
-
+if(CONFIG_BUILD_PROTECTED)
+  list(APPEND SRCS esp32_userspace.c)
+  if(CONFIG_ESP32_PID)
+    list(APPEND SRCS esp32_userspace_pid.c)
+  endif()
+endif()
 if(CONFIG_SCHED_TICKLESS)
   list(APPEND SRCS esp32_tickless.c)
 else()
   list(APPEND SRCS esp32_timerisr.c)
 endif()
-
+if(CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP)
+  list(APPEND SRCS esp32_imm.c)
+endif()
+if(CONFIG_DAC)
+  list(APPEND SRCS esp32_dac.c)
+endif()
+if(CONFIG_ESP32_LEDC)
+  list(APPEND SRCS esp32_ledc.c)
+endif()
+if(CONFIG_ESP32_I2C)
+  if(CONFIG_ESPRESSIF_I2C_PERIPH_MASTER_MODE)
+    list(APPEND SRCS esp32_i2c.c)
+  endif()
+endif()
+if(CONFIG_ESP32_TWAI)
+  list(APPEND SRCS esp32_twai.c)
+endif()
+if(CONFIG_ESP32_PCNT_AS_QE)
+  list(APPEND SRCS esp32_qencoder.c)
+endif()
+if(CONFIG_ESP32_SPI)
+  list(APPEND SRCS esp32_spi.c)
+  if(CONFIG_SPI_SLAVE)
+    list(APPEND SRCS esp32_spi_slave.c)
+  endif()
+endif()
+if(CONFIG_ESP32_SPIRAM)
+  list(APPEND SRCS esp32_spiram.c)
+  list(APPEND SRCS esp32_psram.c)
+  list(APPEND SRCS esp32_himem.c)
+  list(APPEND SRCS esp32_himem_chardev.c)
+endif()
+if(CONFIG_ESP32_EMAC)
+  list(APPEND SRCS esp32_emac.c)
+endif()
+if(CONFIG_SMP)
+  list(APPEND SRCS esp32_cpuidlestack.c esp32_cpustart.c
+       esp32_intercpu_interrupt.c)
+endif()
+if(CONFIG_ESP32_UART)
+  list(APPEND SRCS esp32_serial.c)
+endif()
+if(CONFIG_ESP32_RNG)
+  list(APPEND SRCS esp32_rng.c)
+endif()
+if(CONFIG_ESP32_TIMER)
+  list(APPEND SRCS esp32_tim.c)
+  if(CONFIG_TIMER)
+    list(APPEND SRCS esp32_tim_lowerhalf.c)
+  endif()
+endif()
+if(CONFIG_ESP32_ONESHOT)
+  list(APPEND SRCS esp32_oneshot.c)
+  if(CONFIG_ONESHOT)
+    list(APPEND SRCS esp32_oneshot_lowerhalf.c)
+  endif()
+endif()
+if(CONFIG_ESP32_FREERUN)
+  list(APPEND SRCS esp32_freerun.c)
+endif()
+if(CONFIG_ESP32_PARTITION_TABLE)
+  list(APPEND SRCS esp32_spiflash.c)
+  list(APPEND SRCS esp32_partition.c)
+endif()
+if(CONFIG_WATCHDOG)
+  list(APPEND SRCS esp32_wdt_lowerhalf.c)
+endif()
+if(CONFIG_ARCH_HAVE_EXTRA_HEAPS)
+  list(APPEND SRCS esp32_extraheaps.c)
+endif()
+if(CONFIG_ESP32_RTC_HEAP)
+  list(APPEND SRCS esp32_rtcheap.c)
+endif()
+if(CONFIG_ESP32_IRAM_HEAP)
+  list(APPEND SRCS esp32_iramheap.c)
+endif()
+if(CONFIG_ARCH_USE_TEXT_HEAP)
+  list(APPEND SRCS esp32_textheap.c)
+endif()
+if(CONFIG_ESP32_TOUCH)
+  list(APPEND SRCS esp32_touch.c)
+endif()
+if(CONFIG_ESP32_AES_ACCELERATOR)
+  list(APPEND SRCS esp32_aes.c)
+endif()
+if(CONFIG_ESP32_SHA_ACCELERATOR)
+  list(APPEND SRCS esp32_sha.c)
+endif()
+if(CONFIG_CRYPTO_CRYPTODEV_HARDWARE)
+  list(APPEND SRCS esp32_crypto.c)
+endif()
+if(CONFIG_ESP32_OPENETH)
+  list(APPEND SRCS esp_openeth.c)
+endif()
 if(CONFIG_ESPRESSIF_WIFI)
   list(APPEND SRCS esp32_wifi_adapter.c)
 endif()
-
 if(CONFIG_ESPRESSIF_BLE)
   list(APPEND SRCS esp32_ble_adapter.c esp32_ble.c)
 endif()
 
-if(CONFIG_XTENSA_HAVE_WINDOW_EXCEPTION_HOOKS)
-  list(APPEND SRCS esp32_window_hooks.S)
-endif()
+target_compile_options(
+  arch
+  PRIVATE -Wno-undef -Wno-unused-variable -fno-jump-tables
+          -fno-tree-switch-conversion -Wno-deprecated-declarations
+          -fstrict-volatile-bitfields)
 
-target_compile_definitions(arch PRIVATE ESP_PLATFORM=1)
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common/espressif espressif)
diff --git a/arch/xtensa/src/esp32/hal_esp32.cmake 
b/arch/xtensa/src/esp32/hal_esp32.cmake
index 5b4e8fe4023..919fbb17a49 100644
--- a/arch/xtensa/src/esp32/hal_esp32.cmake
+++ b/arch/xtensa/src/esp32/hal_esp32.cmake
@@ -2,7 +2,409 @@
 # arch/xtensa/src/esp32/hal_esp32.cmake
 #
 # SPDX-License-Identifier: Apache-2.0
+#
+# 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.
+#
 # 
##############################################################################
 
-set(CHIP_SERIES esp32)
-include(${NUTTX_ARCH_ABS_DIR}/src/common/espressif/hal_xtensa_espressif.cmake)
+# The same files as hal.mk.
+
+if(NOT EXISTS ${ESP_HAL_3RDPARTY_REPO})
+  message(
+    FATAL_ERROR
+      "ESP_HAL_3RDPARTY_REPO does not exist: ${ESP_HAL_3RDPARTY_REPO}. Please 
ensure the HAL 3rd party repository is cloned correctly."
+  )
+endif()
+
+set(HAL_SRCS)
+
+target_include_directories(
+  arch
+  PRIVATE
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support//include
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/interface
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_blockdev/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_common/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_event/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_parlio/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_parlio/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_twai/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_twai/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_usb/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_usb/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/etm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/esp_private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/soc
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/soc/${CHIP_SERIES}
+    ${ESP_HAL_3RDPARTY_REPO}/components/heap/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/deprecated_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/ldo/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_intr/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/tuning_scheme_impl/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/port/${CHIP_SERIES}
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/power_supply/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpspi/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpspi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rtc_timer/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rtc_timer/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include/esp_private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/include/${CHIP_SERIES}
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/include/${CHIP_SERIES}/rom
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/include/esp32/rom
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/include/private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/public_compat
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/platform_port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/log
+    ${ESP_HAL_3RDPARTY_REPO}/components/log/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/include/aes
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/psa_driver/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_libc/priv_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/register
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/baremetal
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/deprecated_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/private_include
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include/esp_flash_chips
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_app_format/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/include/mbedtls)
+target_include_directories(
+  arch
+  PRIVATE
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/esp_libc/platform_include)
+# Linker scripts
+set_property(
+  GLOBAL APPEND
+  PROPERTY
+    LD_SCRIPT
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.api.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.libc-funcs.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.libgcc.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.newlib-data.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.syscalls.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/ld/${CHIP_SERIES}.peripherals.ld
+)
+if(NOT CONFIG_ESP32_DONT_USE_ROM_LIBC)
+  set_property(
+    GLOBAL APPEND
+    PROPERTY
+      LD_SCRIPT
+      
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.newlib-reent-funcs.ld
+  )
+endif()
+# Source files
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_api.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_utility.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_startup.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_fields.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_fields.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_table.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_utility.c)
+# Please note that the following source file depends on
+# `CONFIG_SOC_EFUSE_KEY_PURPOSE_FIELD` and
+# `CONFIG_SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK`
+list(
+  APPEND
+  HAL_SRCS
+  
${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c
+)
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/adc_cali.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/${CHIP_SERIES}/adc_cali_line_fitting.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_app_format/esp_app_desc.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_common/src/esp_err_to_name.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/touch_sens_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/adc_share_hw_ctrl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/clk_ctrl_os.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/clk_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/cpu.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_clk.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_gpio_reserve.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_memory_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/hw_random.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mac_addr.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/mspi_timing_tuning.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/periph_ctrl.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/sar_periph_ctrl.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/cpu_region_protect.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/esp_clk_tree.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_clk.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_sleep.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_init.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_time.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/esp_clk_tree_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/regi2c_ctrl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/rtc_module.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_event.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_gpio.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_modem.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_modes.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_uart.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/power_supply/brownout.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_libc/src/port/esp_time_impl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_mmu_map.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/port/${CHIP_SERIES}/ext_mem_layout.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_cache_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_cache_msync.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/cache_esp32.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/phy_init_data.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_locks.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_impl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_sys.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_print.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_crc.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_serial_output.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_spiflash.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_efuse.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_gpio.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/esp_err.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/esp_system.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/startup.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/startup_funcs.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/system_time.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/cpu_start.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/soc/${CHIP_SERIES}/clk.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/soc/${CHIP_SERIES}/system_internal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_impl_lac.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/system_time.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_impl_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/adc_hal_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/adc_oneshot_hal.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/${CHIP_SERIES}/clk_tree_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/${CHIP_SERIES}/efuse_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/brownout_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/efuse_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/gpio_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/ledc_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/ledc_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/pcnt_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/rmt_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/sdm_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/i2s_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/mcpwm_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/timer_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/uart_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/uart_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/mmu_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/i2c_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/sha_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/hal_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_encrypt_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/wdt_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/${CHIP_SERIES}/cache_hal_esp32.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/mpu_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/dport_access_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_wrap.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_noos.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_app.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_generic.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_gd.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_winbond.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_issi.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_mxic_opi.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_mxic.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_api.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_ops.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_drivers.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/memspi_host_driver.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_spi_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_mmap.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_brownout_hook.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/cache_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/log_level.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level/tag_log_level.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level/linked_list/log_linked_list.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/noos/log_lock.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/noos/log_timestamp.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/os/log_write.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/os/util.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/adc_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/gpio_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/${CHIP_SERIES}/ledc_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/${CHIP_SERIES}/pcnt_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/${CHIP_SERIES}/rmt_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/sdm_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/rtc_io_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/${CHIP_SERIES}/i2c_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/${CHIP_SERIES}/i2s_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/${CHIP_SERIES}/mcpwm_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_bytes.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_copy.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_simple.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_rx.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/gpio.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/rtc_io.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/src/uart_wakeup.c
+  ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/platform/os.c
+  ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
+  ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/newlib/newlib/libc/misc/init.c)
+if(CONFIG_ESPRESSIF_WIFI)
+  list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/esp_event.c)
+endif()
+# Security components (for WiFi/crypto support) Note: ESP32 doesn't support
+# HMAC, so esp_security sources are excluded Interrupt allocator NOTE: 
ESP-IDF's
+# xtensa_intr_asm.S cannot be used because it conflicts with NuttX's Xtensa 
core
+# macro definitions. Instead, esp_xtensa_intr.c provides NuttX-native
+# implementations of xt_ints_on, xt_ints_off, and related functions.
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/intr_alloc.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/esp_cpu_intr.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/xtensa_intr.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/interrupts.c)
+# IPC (Inter-Processor Communication) for SMP
+if(CONFIG_SMP)
+  list(APPEND HAL_SRCS
+       ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/esp_system/esp_ipc.c)
+endif()
+# Bootloader files
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/bootloader_flash.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_${CHIP_SERIES}.c
+)
+if(CONFIG_ESPRESSIF_SIMPLE_BOOT)
+  list(
+    APPEND
+    HAL_SRCS
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/bootloader_banner_wrap.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_console.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_console_loader.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/${CHIP_SERIES}/bootloader_${CHIP_SERIES}.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_init.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_common.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_common_loader.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/flash_qio_mode.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_clock_init.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_efuse.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_mem.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_random.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_random_${CHIP_SERIES}.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/esp_image_format.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/${CHIP_SERIES}/bootloader_soc.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_sha.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_clk_init.c
+  )
+  target_link_options(nuttx PRIVATE -Wl,--wrap=bootloader_print_banner)
+endif()
+target_link_options(nuttx PRIVATE "SHELL:-u esp_timer_init_include_func")
+target_compile_definitions(arch PRIVATE ESP_PLATFORM=1)
+
+target_sources(arch PRIVATE ${HAL_SRCS})
diff --git a/arch/xtensa/src/esp32s2/CMakeLists.txt 
b/arch/xtensa/src/esp32s2/CMakeLists.txt
index d05d1e962f0..35b1db9b5c7 100644
--- a/arch/xtensa/src/esp32s2/CMakeLists.txt
+++ b/arch/xtensa/src/esp32s2/CMakeLists.txt
@@ -4,31 +4,84 @@
 # SPDX-License-Identifier: Apache-2.0
 # 
##############################################################################
 
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common/espressif espressif)
-
-set(SRCS
-    esp32s2_start.c
-    esp32s2_wdt.c
-    esp32s2_allocateheap.c
-    esp32s2_rtc_gpio.c
-    esp32s2_region.c
-    esp32s2_user.c
-    esp32s2_lowputc.c
-    esp32s2_systemreset.c
-    esp32s2_dma.c
-    esp32s2_libc_stubs.c)
-
+set(SRCS esp32s2_start.c esp32s2_wdt.c)
+list(APPEND SRCS esp32s2_allocateheap.c)
+list(APPEND SRCS esp32s2_rtc_gpio.c esp32s2_region.c esp32s2_user.c)
+list(APPEND SRCS esp32s2_lowputc.c esp32s2_systemreset.c)
+list(APPEND SRCS esp32s2_dma.c esp32s2_libc_stubs.c)
+if(NOT CONFIG_SCHED_TICKLESS)
+  list(APPEND SRCS esp32s2_timerisr.c)
+endif()
 if(NOT CONFIG_ARCH_IDLE_CUSTOM)
   list(APPEND SRCS esp32s2_idle.c)
 endif()
-
-if(NOT CONFIG_SCHED_TICKLESS)
-  list(APPEND SRCS esp32s2_timerisr.c)
+if(CONFIG_ESP32S2_UART)
+  list(APPEND SRCS esp32s2_serial.c)
+endif()
+if(CONFIG_ESP32S2_RNG)
+  list(APPEND SRCS esp32s2_rng.c)
+endif()
+if(CONFIG_ESP32S2_I2C)
+  if(CONFIG_ESPRESSIF_I2C_PERIPH_MASTER_MODE)
+    list(APPEND SRCS esp32s2_i2c.c)
+  endif()
+endif()
+if(CONFIG_ESP32S2_TWAI)
+  list(APPEND SRCS esp32s2_twai.c)
+endif()
+if(CONFIG_ESP32S2_SPI)
+  list(APPEND SRCS esp32s2_spi.c)
+  if(CONFIG_SPI_SLAVE)
+    list(APPEND SRCS esp32s2_spi_slave.c)
+  endif()
+endif()
+if(CONFIG_ESP32S2_PARTITION_TABLE)
+  list(APPEND SRCS esp32_partition.c)
+endif()
+if(CONFIG_ESP32S2_TIMER)
+  list(APPEND SRCS esp32s2_tim.c)
+  if(CONFIG_TIMER)
+    list(APPEND SRCS esp32s2_tim_lowerhalf.c)
+  endif()
+endif()
+if(CONFIG_WATCHDOG)
+  list(APPEND SRCS esp32s2_wdt_lowerhalf.c)
+endif()
+if(CONFIG_ARCH_HAVE_EXTRA_HEAPS)
+  list(APPEND SRCS esp32s2_extraheaps.c)
+endif()
+if(CONFIG_ESP32S2_RTC_HEAP)
+  list(APPEND SRCS esp32s2_rtcheap.c)
+endif()
+if(CONFIG_ARCH_USE_TEXT_HEAP)
+  list(APPEND SRCS esp32s2_textheap.c)
+endif()
+if(CONFIG_ESP32S2_FREERUN)
+  list(APPEND SRCS esp32s2_freerun.c)
+endif()
+if(CONFIG_ESP32S2_TOUCH)
+  list(APPEND SRCS esp32s2_touch.c)
+endif()
+if(CONFIG_ESP32S2_ONESHOT)
+  list(APPEND SRCS esp32s2_oneshot.c)
+  if(CONFIG_ONESHOT)
+    list(APPEND SRCS esp32s2_oneshot_lowerhalf.c)
+  endif()
+endif()
+if(CONFIG_ESP32S2_SPIRAM)
+  list(APPEND SRCS esp32s2_spiram.c)
+  list(APPEND SRCS esp32s2_psram.c)
 endif()
-
 if(CONFIG_ESPRESSIF_WIFI)
   list(APPEND SRCS esp32s2_wifi_adapter.c)
 endif()
 
-target_compile_definitions(arch PRIVATE ESP_PLATFORM=1)
+target_compile_options(
+  arch
+  PRIVATE -Wno-undef -Wno-unused-variable -fno-jump-tables
+          -fno-tree-switch-conversion -Wno-deprecated-declarations
+          -fstrict-volatile-bitfields)
+
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common/espressif espressif)
diff --git a/arch/xtensa/src/esp32s2/hal_esp32s2.cmake 
b/arch/xtensa/src/esp32s2/hal_esp32s2.cmake
index acc03f247e5..fc5ca0b3be8 100644
--- a/arch/xtensa/src/esp32s2/hal_esp32s2.cmake
+++ b/arch/xtensa/src/esp32s2/hal_esp32s2.cmake
@@ -2,7 +2,408 @@
 # arch/xtensa/src/esp32s2/hal_esp32s2.cmake
 #
 # SPDX-License-Identifier: Apache-2.0
+#
+# 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.
+#
 # 
##############################################################################
 
-set(CHIP_SERIES esp32s2)
-include(${NUTTX_ARCH_ABS_DIR}/src/common/espressif/hal_xtensa_espressif.cmake)
+# The same files as hal.mk.
+
+if(NOT EXISTS ${ESP_HAL_3RDPARTY_REPO})
+  message(
+    FATAL_ERROR
+      "ESP_HAL_3RDPARTY_REPO does not exist: ${ESP_HAL_3RDPARTY_REPO}. Please 
ensure the HAL 3rd party repository is cloned correctly."
+  )
+endif()
+
+set(HAL_SRCS)
+
+target_include_directories(
+  arch
+  PRIVATE
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support//include
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/private_include
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/interface
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_blockdev/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_common/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_event/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpspi/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpspi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_parlio/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_parlio/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rtc_timer/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rtc_timer/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_twai/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_twai/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_usb/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_usb/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/etm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/esp_private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/soc
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/soc/${CHIP_SERIES}
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/ldo/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_intr/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/tuning_scheme_impl/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/port/${CHIP_SERIES}
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/power_supply/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/heap/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/include/${CHIP_SERIES}
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/include/${CHIP_SERIES}/rom
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/include/private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/public_compat
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/platform_port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/log
+    ${ESP_HAL_3RDPARTY_REPO}/components/log/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level
+    
${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level/linked_list
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/include/aes
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/psa_driver/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_libc/priv_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/register
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/deprecated_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/register
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include/esp_flash_chips
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include/esp_private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_app_format/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_common
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_common/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/shared
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/shared/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/include/mbedtls
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/esp_libc/platform_include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src)
+# Linker scripts
+set_property(
+  GLOBAL APPEND
+  PROPERTY
+    LD_SCRIPT
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.api.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.libc-funcs.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.libgcc.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.newlib-data.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.newlib-reent-funcs.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.spiflash_legacy.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/ld/${CHIP_SERIES}.peripherals.ld
+)
+if(CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE)
+  set_property(
+    GLOBAL APPEND PROPERTY LD_SCRIPT
+                           ${NUTTX_BOARD_DIR}/../common/scripts/ulp_aliases.ld)
+endif()
+# Source files
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/adc_cali.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/${CHIP_SERIES}/adc_cali_line_fitting.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_fields.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_utility.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_api.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_startup.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_rtc_table.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_fields.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_table.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_utility.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_app_format/esp_app_desc.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_common/src/esp_err_to_name.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/mspi_timing_tuning.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_modes.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_uart.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/power_supply/brownout.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_mmu_map.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/port/${CHIP_SERIES}/ext_mem_layout.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_cache_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_cache_msync.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/phy_init_data.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_locks.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_impl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/hal_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_encrypt_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_hal_gpspi.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/log_level.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level/tag_log_level.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level/linked_list/log_linked_list.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/noos/log_lock.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/noos/log_timestamp.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/os/log_write.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/os/util.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/gpio.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/rtc_io.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/adc_share_hw_ctrl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/clk_ctrl_os.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_gpio_reserve.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/clk_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/cpu.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_clk.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_memory_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/hw_random.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mac_addr.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/periph_ctrl.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/sar_periph_ctrl.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/cpu_region_protect.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/esp_clk_tree.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_clk.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_clk_init.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_init.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_sleep.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_time.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/systimer.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/esp_clk_tree_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/regi2c_ctrl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/rtc_module.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_event.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_gpio.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_modem.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_libc/src/port/esp_time_impl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_sys.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_print.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_crc.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_serial_output.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_spiflash.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_efuse.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_gpio.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_regi2c_${CHIP_SERIES}.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/esp_err.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/esp_system.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/startup.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/startup_funcs.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/system_time.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/soc/${CHIP_SERIES}/clk.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/soc/${CHIP_SERIES}/system_internal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_impl_systimer.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/system_time.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_impl_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/adc_hal_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/adc_oneshot_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/aes_hal.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/${CHIP_SERIES}/clk_tree_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/${CHIP_SERIES}/efuse_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/wdt_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/cache_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/mpu_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/mmu_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/i2c_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/brownout_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/efuse_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/gpio_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/ledc_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/ledc_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/pcnt_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/rmt_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/rtc_io_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/sdm_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/i2s_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/sha_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/timer_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/touch_sens_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/systimer_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/uart_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/uart_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/dport_access_common.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/adc_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/dedic_gpio_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/gpio_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/${CHIP_SERIES}/ledc_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/${CHIP_SERIES}/pcnt_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/${CHIP_SERIES}/rmt_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/rtc_io_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/sdm_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/${CHIP_SERIES}/i2c_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/${CHIP_SERIES}/i2s_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/temperature_sensor_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_wrap.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_noos.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_app.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_generic.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_boya.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_gd.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_winbond.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_issi.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_mxic_opi.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_mxic.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_th.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_api.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_ops.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_drivers.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/memspi_host_driver.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_spi_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_mmap.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_brownout_hook.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/cache_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_common/ulp_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_common/ulp_adc.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/ulp_riscv.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/ulp_riscv_lock.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/ulp_riscv_i2c.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/io_mux.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_bytes.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_copy.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_simple.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_rx.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c)
+list(
+  APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/platform/os.c
+  ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
+  ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/newlib/newlib/libc/misc/init.c)
+if(CONFIG_ESPRESSIF_WIFI)
+  list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/esp_event.c)
+endif()
+# Interrupt allocator NOTE: ESP-IDF's xtensa_intr_asm.S cannot be used because
+# it conflicts with NuttX's Xtensa core macro definitions. Instead,
+# esp_xtensa_intr.c provides NuttX-native implementations of xt_ints_on,
+# xt_ints_off, and related functions.
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/intr_alloc.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/esp_cpu_intr.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/xtensa_intr.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/interrupts.c)
+# Security components (for WiFi/crypto support)
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/src/esp_hmac.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/src/esp_crypto_periph_clk.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/src/esp_crypto_lock.c)
+# Bootloader files
+list(
+  APPEND
+  HAL_SRCS
+  
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/${CHIP_SERIES}/bootloader_soc.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_random_${CHIP_SERIES}.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/bootloader_flash.c
+)
+if(CONFIG_ESPRESSIF_SIMPLE_BOOT)
+  list(
+    APPEND
+    HAL_SRCS
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/bootloader_banner_wrap.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_console.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_console_loader.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/${CHIP_SERIES}/bootloader_${CHIP_SERIES}.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_init.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_common.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_common_loader.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_${CHIP_SERIES}.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/flash_qio_mode.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_clock_init.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_efuse.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_mem.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_random.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/esp_image_format.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_sha.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/${CHIP_SERIES}/uart_periph.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_cache_esp32s2_esp32s3.c
+  )
+  target_link_options(nuttx PRIVATE -Wl,--wrap=bootloader_print_banner)
+endif()
+target_compile_definitions(arch PRIVATE ESP_PLATFORM=1)
+
+target_sources(arch PRIVATE ${HAL_SRCS})
diff --git a/arch/xtensa/src/esp32s3/CMakeLists.txt 
b/arch/xtensa/src/esp32s3/CMakeLists.txt
index 6f1a3d75666..c8d54bd4960 100644
--- a/arch/xtensa/src/esp32s3/CMakeLists.txt
+++ b/arch/xtensa/src/esp32s3/CMakeLists.txt
@@ -4,8 +4,6 @@
 # SPDX-License-Identifier: Apache-2.0
 # 
##############################################################################
 
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common/espressif espressif)
-
 set(SRCS
     esp32s3_start.c
     esp32s3_cache.c
@@ -25,12 +23,161 @@ if(NOT CONFIG_ARCH_IDLE_CUSTOM)
   list(APPEND SRCS esp32s3_idle.c)
 endif()
 
+if(CONFIG_BUILD_PROTECTED)
+  list(APPEND SRCS esp32s3_userspace.c)
+endif()
+
+if(NOT CONFIG_BUILD_FLAT)
+  list(APPEND SRCS esp32s3_isolation.c)
+endif()
+
+if(CONFIG_ESP32S3_USERFAULT_ABORT)
+  list(APPEND SRCS esp32s3_userfault.c)
+endif()
+
+if(CONFIG_BUILD_KERNEL)
+  list(APPEND SRCS esp32s3_world1_vectors.S)
+endif()
+
+if(CONFIG_BUILD_PROTECTED OR CONFIG_ARCH_ADDRENV)
+  list(APPEND SRCS esp32s3_mmu.c esp32s3_pms.c esp32s3_wcl.c)
+endif()
+
+if(CONFIG_ESP32S3_PAGEFAULT)
+  list(APPEND SRCS esp32s3_pagefault.c)
+endif()
+
+if(CONFIG_ARCH_ADDRENV)
+  list(APPEND SRCS esp32s3_addrenv.c esp32s3_addrenv_utils.c)
+endif()
+
+if(CONFIG_MM_PGALLOC)
+  list(APPEND SRCS esp32s3_pgalloc.c)
+endif()
+
+if(CONFIG_SMP)
+  list(APPEND SRCS esp32s3_cpuidlestack.c esp32s3_cpustart.c
+       esp32s3_intercpu_interrupt.c)
+endif()
+
+if(CONFIG_ESP32S3_RNG)
+  list(APPEND SRCS esp32s3_rng.c)
+endif()
+
+if(CONFIG_ESP32S3_TWAI)
+  list(APPEND SRCS esp32s3_twai.c)
+endif()
+
+if(CONFIG_ESP32S3_USBSERIAL)
+  list(APPEND SRCS esp32s3_usbserial.c)
+endif()
+
 if(CONFIG_SCHED_TICKLESS)
   list(APPEND SRCS esp32s3_tickless.c)
 else()
   list(APPEND SRCS esp32s3_timerisr.c)
 endif()
 
+if(CONFIG_ESP32S3_TIMER)
+  list(APPEND SRCS esp32s3_tim.c)
+  if(CONFIG_TIMER)
+    list(APPEND SRCS esp32s3_tim_lowerhalf.c)
+  endif()
+endif()
+
+if(CONFIG_WATCHDOG)
+  list(APPEND SRCS esp32s3_wdt_lowerhalf.c)
+endif()
+
+if(CONFIG_ESP32S3_ONESHOT)
+  list(APPEND SRCS esp32s3_oneshot.c)
+  if(CONFIG_ONESHOT)
+    list(APPEND SRCS esp32s3_oneshot_lowerhalf.c)
+  endif()
+endif()
+
+if(CONFIG_ESP32S3_FREERUN)
+  list(APPEND SRCS esp32s3_freerun.c)
+endif()
+
+if(CONFIG_ESP32S3_DMA)
+  list(APPEND SRCS esp32s3_dma.c)
+endif()
+
+if(CONFIG_ESP32S3_I2C AND CONFIG_ESPRESSIF_I2C_PERIPH_MASTER_MODE)
+  list(APPEND SRCS esp32s3_i2c.c)
+endif()
+
+if(CONFIG_ESP32S3_SPI)
+  if(CONFIG_ESP32S3_SPI_IO_SPI)
+    list(APPEND SRCS esp32s3_spi.c)
+  else()
+    list(APPEND SRCS esp32s3_qspi.c)
+  endif()
+  if(CONFIG_SPI_SLAVE)
+    list(APPEND SRCS esp32s3_spi_slave.c)
+  endif()
+endif()
+
+if(CONFIG_ESP32S3_SPIFLASH AND (CONFIG_ESP32S3_PARTITION_TABLE
+                                OR CONFIG_ESP32S3_SPIRAM))
+  list(APPEND SRCS esp32s3_spiflash.c esp32s3_spiflash_mtd.c)
+endif()
+
+if(CONFIG_ESP32S3_PARTITION_TABLE)
+  list(APPEND SRCS esp32s3_partition.c)
+endif()
+
+if(CONFIG_ESP32S3_SPIRAM)
+  list(APPEND SRCS esp32s3_spiram.c esp32s3_himem.c)
+  if(CONFIG_ESP32S3_SPIRAM_MODE_QUAD)
+    list(APPEND SRCS esp32s3_psram_quad.c)
+  endif()
+  if(CONFIG_ESP32S3_SPIRAM_MODE_OCT)
+    list(APPEND SRCS esp32s3_psram_octal.c)
+  endif()
+endif()
+
+if(CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP)
+  list(APPEND SRCS esp32s3_imm.c)
+endif()
+
+if(CONFIG_ARCH_HAVE_EXTRA_HEAPS)
+  list(APPEND SRCS esp32s3_extraheaps.c)
+endif()
+
+if(CONFIG_ESP32S3_RTC_HEAP)
+  list(APPEND SRCS esp32s3_rtcheap.c)
+endif()
+
+if(CONFIG_ARCH_USE_TEXT_HEAP)
+  list(APPEND SRCS esp32s3_textheap.c)
+endif()
+
+if(CONFIG_ESP32S3_TOUCH)
+  list(APPEND SRCS esp32s3_touch.c)
+endif()
+
+if(CONFIG_ESP32S3_OTG_DEVICE)
+  list(APPEND SRCS esp32s3_otg_device.c)
+endif()
+
+if(CONFIG_ESP32S3_LCD)
+  list(APPEND SRCS esp32s3_lcd.c)
+endif()
+
+if(CONFIG_ESP32S3_CAM)
+  list(APPEND SRCS esp32s3_cam.c)
+endif()
+
+if(CONFIG_ESP32S3_SDMMC)
+  list(APPEND SRCS esp32s3_sdmmc.c)
+endif()
+
+if(CONFIG_ESP32S3_OPENETH)
+  list(APPEND SRCS esp_openeth.c)
+endif()
+
 if(CONFIG_ESPRESSIF_WIFI)
   list(APPEND SRCS esp32s3_wifi_adapter.c)
 endif()
@@ -39,5 +186,13 @@ if(CONFIG_ESPRESSIF_BLE)
   list(APPEND SRCS esp32s3_ble_adapter.c esp32s3_ble.c)
 endif()
 
-target_compile_definitions(arch PRIVATE _RETARGETABLE_LOCKING ESP_PLATFORM=1)
+target_compile_options(
+  arch
+  PRIVATE -Wno-undef -Wno-unused-variable -fno-jump-tables
+          -fno-tree-switch-conversion -Wno-deprecated-declarations
+          -fstrict-volatile-bitfields)
+target_compile_definitions(arch PRIVATE _RETARGETABLE_LOCKING)
+
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common/espressif espressif)
diff --git a/arch/xtensa/src/esp32s3/hal_esp32s3.cmake 
b/arch/xtensa/src/esp32s3/hal_esp32s3.cmake
index 85cf461841d..190f3dc8ca6 100644
--- a/arch/xtensa/src/esp32s3/hal_esp32s3.cmake
+++ b/arch/xtensa/src/esp32s3/hal_esp32s3.cmake
@@ -2,7 +2,445 @@
 # arch/xtensa/src/esp32s3/hal_esp32s3.cmake
 #
 # SPDX-License-Identifier: Apache-2.0
+#
+# 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.
+#
 # 
##############################################################################
 
-set(CHIP_SERIES esp32s3)
-include(${NUTTX_ARCH_ABS_DIR}/src/common/espressif/hal_xtensa_espressif.cmake)
+# The same files as hal.mk.
+
+if(NOT EXISTS ${ESP_HAL_3RDPARTY_REPO})
+  message(
+    FATAL_ERROR
+      "ESP_HAL_3RDPARTY_REPO does not exist: ${ESP_HAL_3RDPARTY_REPO}. Please 
ensure the HAL 3rd party repository is cloned correctly."
+  )
+endif()
+
+set(HAL_SRCS)
+
+nuttx_add_extra_library(
+  ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/${CHIP_SERIES}/libxt_hal.a)
+# Include header paths
+target_include_directories(
+  arch
+  PRIVATE
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/interface
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_blockdev/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_common/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_coex/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_event/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_cam/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_cam/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpspi/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpspi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_parlio/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_parlio/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rtc_timer/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rtc_timer/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_twai/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_twai/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_usb/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_usb/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_dma/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_dma/src
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/etm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/esp_private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/soc
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/include/soc/${CHIP_SERIES}
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/ldo/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_intr/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/tuning_scheme_impl/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/port/${CHIP_SERIES}
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/power_supply/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/include/${CHIP_SERIES}
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/include/private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/private_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/public_compat
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/hal/platform_port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/heap/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/log
+    ${ESP_HAL_3RDPARTY_REPO}/components/log/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/include/aes
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/port/psa_driver/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/include
+    
${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/mbedtls/mbedtls/tf-psa-crypto/core
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_libc/priv_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/register
+    ${ESP_HAL_3RDPARTY_REPO}/components/soc/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/${CHIP_SERIES}/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/deprecated_include
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/private_include
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include/esp_flash_chips
+    ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/include/esp_private
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_app_format/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_common
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_common/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/shared
+    ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/shared/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/include
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src
+    ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/include
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/include/mbedtls
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/esp_libc/platform_include)
+# Linker scripts
+set_property(
+  GLOBAL APPEND
+  PROPERTY
+    LD_SCRIPT
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.api.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.libc.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.libgcc.ld
+)
+if(CONFIG_ESP32S3_DONT_USE_ROM_LIBC)
+  # Use NuttX libc instead of ROM newlib functions
+else()
+  set_property(
+    GLOBAL APPEND
+    PROPERTY
+      LD_SCRIPT
+      
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.newlib.ld
+  )
+endif()
+set_property(
+  GLOBAL APPEND
+  PROPERTY
+    LD_SCRIPT
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/ld/${CHIP_SERIES}.rom.version.ld
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_wdt/${CHIP_SERIES}/rom.wdt.ld
+    
${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/ld/${CHIP_SERIES}.peripherals.ld
+)
+if(CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE)
+  set_property(
+    GLOBAL APPEND PROPERTY LD_SCRIPT
+                           ${NUTTX_BOARD_DIR}/../common/scripts/ulp_aliases.ld)
+endif()
+# Source files
+list(
+  APPEND
+  HAL_SRCS
+  
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_${CHIP_SERIES}.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/bootloader_flash.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/adc_cali_curve_fitting.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/adc_cali.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_adc/${CHIP_SERIES}/curve_fitting_coefficients.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_api.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_startup.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_utility.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_fields.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_rtc_calib.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_table.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/efuse/${CHIP_SERIES}/esp_efuse_utility.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_app_format/esp_app_desc.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_common/src/esp_err_to_name.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/adc_share_hw_ctrl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/clk_ctrl_os.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/clk_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/cpu.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_dma/src/esp_dma_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_dma/src/gdma.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_dma/src/gdma_link.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_clk.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_gpio_reserve.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/esp_memory_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/hw_random.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mac_addr.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/periph_ctrl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_console.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_event.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_gpio.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_modem.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/lowpower/port/${CHIP_SERIES}/sleep_cpu.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/sar_periph_ctrl.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/cpu_region_protect.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/esp_clk_tree.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/io_mux.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_clk.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_init.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_clk_init.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_sleep.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/rtc_time.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/systimer.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/mspi_timing_tuning.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/mspi/mspi_timing_tuning/port/${CHIP_SERIES}/mspi_timing_config.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/esp_clk_tree_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/regi2c_ctrl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/rtc_module.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_modes.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/sleep_uart.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/power_supply/brownout.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_libc/src/port/esp_time_impl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_mmu_map.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/port/${CHIP_SERIES}/ext_mem_layout.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_cache_msync.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_cache_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/phy_init_data.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_locks.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_impl.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_sys.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_print.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_crc.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_serial_output.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_spiflash.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_efuse.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_gpio.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_cache_esp32s2_esp32s3.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/esp_err.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/esp_system.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/startup.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/startup_funcs.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/system_time.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/soc/${CHIP_SERIES}/clk.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_system/port/soc/${CHIP_SERIES}/system_internal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_impl_systimer.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/system_time.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_timer/src/esp_timer_impl_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/adc_hal_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/adc_oneshot_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/aes_hal.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_clock/${CHIP_SERIES}/clk_tree_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/${CHIP_SERIES}/efuse_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/${CHIP_SERIES}/rtc_cntl_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pmu/brownout_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/efuse_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/gpio_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/ledc_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/ledc_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/pcnt_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/rmt_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/rtc_io_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/sdm_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/i2s_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/sha_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/mcpwm_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/systimer_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_timg/timer_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_touch_sens/touch_sens_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/cache_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/mpu_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/mmu_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/i2c_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/uart_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/uart_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/hal/hal_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_hal.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_hal_gpspi.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mspi/spi_flash_encrypt_hal_iram.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/gdma_hal_ahb_v1.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/gdma_hal_top.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/log_level.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level/tag_log_level.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/log/src/log_level/tag_log_level/linked_list/log_linked_list.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/log.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/noos/log_lock.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/noos/log_timestamp.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/os/log_write.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/log/src/os/util.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/dport_access_common.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/dedic_gpio_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_dma/${CHIP_SERIES}/gdma_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/adc_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/gpio_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ledc/${CHIP_SERIES}/ledc_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_pcnt/${CHIP_SERIES}/pcnt_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/${CHIP_SERIES}/rmt_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/rtc_io_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_gpio/${CHIP_SERIES}/sdm_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2c/${CHIP_SERIES}/i2c_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_i2s/${CHIP_SERIES}/i2s_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_mcpwm/${CHIP_SERIES}/mcpwm_periph.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_ana_conv/${CHIP_SERIES}/temperature_sensor_periph.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_wrap.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_hpm_enable.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/${CHIP_SERIES}/spi_flash_oct_flash_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_noos.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_app.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_generic.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_boya.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_gd.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_winbond.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_issi.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_mxic_opi.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_mxic.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_th.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_api.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_ops.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_drivers.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/memspi_host_driver.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_spi_init.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_mmap.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_brownout_hook.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/cache_utils.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_common/ulp_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_common/ulp_adc.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/ulp_riscv.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/ulp_riscv_lock.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/ulp/ulp_riscv/ulp_riscv_i2c.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_common.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_bytes.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_copy.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_simple.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_rx.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/gpio.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/rtc_io.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/src/uart_wakeup.c)
+list(
+  APPEND
+  HAL_SRCS
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_cache_writeback_esp32s3.S
+)
+list(
+  APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/platform/os.c
+  ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/heap_caps.c
+  ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/newlib/newlib/libc/misc/init.c)
+if(CONFIG_ESPRESSIF_WIFI)
+  list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/esp_event.c)
+endif()
+if(CONFIG_SMP)
+  list(APPEND HAL_SRCS
+       ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/components/esp_system/esp_ipc.c)
+endif()
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/intr_alloc.c
+  
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/esp_cpu_intr.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/xtensa/xtensa_intr.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/soc/${CHIP_SERIES}/interrupts.c)
+# Security components (for WiFi/crypto support)
+list(
+  APPEND
+  HAL_SRCS
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/src/esp_hmac.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/src/esp_crypto_periph_clk.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_security/src/esp_crypto_lock.c
+  ${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/hmac_hal.c)
+# Bootloader files
+list(APPEND HAL_SRCS
+     
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/flash_encrypt.c)
+if(CONFIG_ESPRESSIF_SIMPLE_BOOT)
+  list(
+    APPEND
+    HAL_SRCS
+    ${ESP_HAL_3RDPARTY_REPO}/nuttx/src/bootloader_banner_wrap.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_console.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_console_loader.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/${CHIP_SERIES}/bootloader_${CHIP_SERIES}.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_init.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_common.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_common_loader.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/bootloader_flash/src/flash_qio_mode.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_clock_init.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_efuse.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_mem.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_random.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_random_${CHIP_SERIES}.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/esp_image_format.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/${CHIP_SERIES}/bootloader_soc.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/bootloader_support/src/bootloader_sha.c
+    
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_uart/${CHIP_SERIES}/uart_periph.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/patches/esp_rom_systimer.c
+    ${ESP_HAL_3RDPARTY_REPO}/components/efuse/src/esp_efuse_fields.c)
+  target_link_options(nuttx PRIVATE -Wl,--wrap=bootloader_print_banner)
+endif()
+target_compile_definitions(arch PRIVATE ESP_PLATFORM=1)
+
+target_sources(arch PRIVATE ${HAL_SRCS})

Reply via email to