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

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

commit 016bc47a63f916298a31e896512a4f06d276a48e
Author: Tiago Medicci Serrano <tiago.medi...@espressif.com>
AuthorDate: Fri Jul 5 16:19:09 2024 -0300

    esp32s3/elf: Enable ELF loader for ESP32-S3
    
    Provide `up_copy_section` function that enables copying data using
    the data bus. If the memory destination address is accessible
    through the instruction bus, the data is copied using the
    correspondent address accessible through the data bus.
---
 .../xtensa/esp32s3/boards/esp32s3-devkit/index.rst |  7 ++-
 arch/xtensa/Kconfig                                |  1 +
 arch/xtensa/src/esp32s3/esp32s3_textheap.c         | 20 +++++++
 .../esp32s3/esp32s3-devkit/configs/elf/defconfig   | 62 ++++++++++++++++++++++
 4 files changed, 89 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst 
b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
index 092fb36f59..3e50e6853d 100644
--- a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
+++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
@@ -174,7 +174,6 @@ disables the NuttShell to get the best possible score.
 
 cxx
 ---
-
 Development environment ready for C++ applications. You can check if the setup
 was successful by running ``cxxtest``::
 
@@ -197,6 +196,12 @@ was successful by running ``cxxtest``::
     Invalid file! /invalid
     File /proc/version exists!
 
+elf
+---
+
+This configuration uses apps/examples/elf in order to test the ELF loader.
+It can be tested by executing the ``elf`` application.
+
 gpio
 ----
 
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 120f766465..6f68d99b90 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -79,6 +79,7 @@ config ARCH_CHIP_ESP32S3
        select ARCH_FAMILY_LX7
        select XTENSA_HAVE_INTERRUPTS
        select ARCH_HAVE_BOOTLOADER if !ESPRESSIF_SIMPLE_BOOT
+       select ARCH_HAVE_COPY_SECTION
        select ARCH_HAVE_FPU
        select ARCH_HAVE_MPU
        select ARCH_HAVE_MULTICPU
diff --git a/arch/xtensa/src/esp32s3/esp32s3_textheap.c 
b/arch/xtensa/src/esp32s3/esp32s3_textheap.c
index 500d67071d..8eaa1ed42d 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_textheap.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_textheap.c
@@ -231,3 +231,23 @@ IRAM_ATTR void up_textheap_data_sync(void)
 
   leave_critical_section(flags);
 }
+
+/****************************************************************************
+ * Name: up_copy_section
+ *
+ * Description:
+ *   Copy section from general temporary buffer(src) to special addr(dest).
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_ARCH_USE_COPY_SECTION)
+int up_copy_section(FAR void *dest, FAR const void *src, size_t n)
+{
+  memcpy(up_textheap_data_address(dest), src, n);
+
+  return OK;
+}
+#endif
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/elf/defconfig 
b/boards/xtensa/esp32s3/esp32s3-devkit/configs/elf/defconfig
new file mode 100644
index 0000000000..ed92c2a68d
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/elf/defconfig
@@ -0,0 +1,62 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_ARCH_LEDS is not set
+# CONFIG_NDEBUG is not set
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="xtensa"
+CONFIG_ARCH_BOARD="esp32s3-devkit"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=y
+CONFIG_ARCH_CHIP="esp32s3"
+CONFIG_ARCH_CHIP_ESP32S3=y
+CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_USE_COPY_SECTION=y
+CONFIG_ARCH_XTENSA=y
+CONFIG_BINFMT_CONSTRUCTORS=y
+CONFIG_BOARDCTL_ROMDISK=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_BUILTIN=y
+CONFIG_ELF=y
+CONFIG_ESP32S3_UART0=y
+CONFIG_EXAMPLES_ELF=y
+CONFIG_EXECFUNCS_HAVE_SYMTAB=y
+CONFIG_EXECFUNCS_SYSTEM_SYMTAB=y
+CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_IDLETHREAD_STACKSIZE=3072
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_LIBC_STRERROR_ERRNUM=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=114688
+CONFIG_RAM_START=0x20000000
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_HPWORK=y
+CONFIG_SCHED_LPWORK=y
+CONFIG_SCHED_STARTHOOK=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=6
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2011
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+CONFIG_SYSLOG_BUFFER=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TLS_NELEM=4
+CONFIG_UART0_SERIAL_CONSOLE=y

Reply via email to