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

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

commit 92a0b18ca11e37555c84026e0f8e9bf1b9ba82fd
Author: Tiago Medicci Serrano <[email protected]>
AuthorDate: Thu Apr 16 09:14:02 2026 -0300

    boards/risc-v/esp32p4: Enable PSRAM for ESP32-P4-Function-EV-Board
    
    This commit enables using ESP32-P4's PSRAM on Function-EV-Board.
    The in-chip PSRAM memory is added to the user heap and the internal
    memory is dedicated to a kernel heap.
    
    Signed-off-by: Tiago Medicci Serrano <[email protected]>
---
 .../common/scripts/esp32p4_sections.rev3.ld        |  4 ++
 .../configs/psram_usrheap/defconfig                | 60 ++++++++++++++++++++++
 .../esp32p4-function-ev-board/scripts/Make.defs    |  2 +-
 .../esp32p4-function-ev-board/src/CMakeLists.txt   |  2 +-
 .../esp32p4-function-ev-board/src/esp32p4_boot.c   |  2 +
 5 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/boards/risc-v/esp32p4/common/scripts/esp32p4_sections.rev3.ld 
b/boards/risc-v/esp32p4/common/scripts/esp32p4_sections.rev3.ld
index 278a0eb6294..70b244bf5ef 100644
--- a/boards/risc-v/esp32p4/common/scripts/esp32p4_sections.rev3.ld
+++ b/boards/risc-v/esp32p4/common/scripts/esp32p4_sections.rev3.ld
@@ -303,6 +303,8 @@ SECTIONS
     *libarch.a:esp_cache.*(.literal .literal.* .text .text.*)
     *libarch.a:cache_utils.*(.literal .literal.* .text .text.*)
     *libarch.a:memspi_host_driver.*(.literal .literal.* .text .text.*)
+    *libarch.a:esp_psram_impl_ap_hex.*(.literal .literal.* .text .text.*)
+    *libarch.a:esp_psram.*(.literal.esp_psram_get_heap_size_to_protect 
.text.esp_psram_get_heap_size_to_protect)
 
     *libc.a:sq_remlast.*(.literal .text .literal.* .text.*)
 
@@ -470,6 +472,8 @@ SECTIONS
     *libarch.a:esp_cache.*(.rodata .rodata.*)
     *libarch.a:cache_utils.*(.rodata .rodata.*)
     *libarch.a:memspi_host_driver.*(.rodata .rodata.*)
+    *libarch.a:esp_psram_impl_ap_hex.*(.rodata .rodata.*)
+    *libarch.a:cpu_region_protect.*(.rodata .rodata.*)
 
     esp_head.*(.rodata .rodata.*)
     esp_start.*(.rodata .rodata.*)
diff --git 
a/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/psram_usrheap/defconfig
 
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/psram_usrheap/defconfig
new file mode 100644
index 00000000000..c5401e99100
--- /dev/null
+++ 
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/psram_usrheap/defconfig
@@ -0,0 +1,60 @@
+#
+# 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_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="risc-v"
+CONFIG_ARCH_BOARD="esp32p4-function-ev-board"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32P4_FUNCTION_EV_BOARD=y
+CONFIG_ARCH_CHIP="esp32p4"
+CONFIG_ARCH_CHIP_ESP32P4=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_IRQ_TO_NDX=y
+CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
+CONFIG_ARCH_NUSER_INTERRUPTS=17
+CONFIG_ARCH_RISCV=y
+CONFIG_BOARDCTL_RESET=y
+CONFIG_BOARD_LATE_INITIALIZE=y
+CONFIG_BOARD_LOOPSPERMSEC=15000
+CONFIG_BUILTIN=y
+CONFIG_ESPRESSIF_SPIFLASH=y
+CONFIG_ESPRESSIF_SPIFLASH_SMARTFS=y
+CONFIG_ESPRESSIF_SPIRAM=y
+CONFIG_ESPRESSIF_STORAGE_MTD_OFFSET=0x110000
+CONFIG_ESPRESSIF_STORAGE_MTD_SIZE=0xf0000
+CONFIG_EXPERIMENTAL=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_MM_KERNEL_HEAP=y
+CONFIG_MM_REGIONS=2
+CONFIG_NAME_MAX=48
+CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_DISABLE_LOSMART=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_NSH_STRERROR=y
+CONFIG_PREALLOC_TIMERS=0
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_BACKTRACE=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_SMARTFS_MAXNAMLEN=48
+CONFIG_START_DAY=29
+CONFIG_START_MONTH=11
+CONFIG_START_YEAR=2019
+CONFIG_SYSTEM_DUMPSTACK=y
+CONFIG_SYSTEM_FLASH_ERASEALL=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TESTING_FSTEST=y
+CONFIG_TESTING_FSTEST_MOUNTPT="/mnt"
+CONFIG_TESTING_HEAP=y
+CONFIG_UART0_SERIAL_CONSOLE=y
diff --git a/boards/risc-v/esp32p4/esp32p4-function-ev-board/scripts/Make.defs 
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/scripts/Make.defs
index ee4c3a313f3..573d5bbbf4c 100644
--- a/boards/risc-v/esp32p4/esp32p4-function-ev-board/scripts/Make.defs
+++ b/boards/risc-v/esp32p4/esp32p4-function-ev-board/scripts/Make.defs
@@ -36,7 +36,7 @@ ARCHSCRIPT += 
$(BOARD_COMMON_DIR)/scripts/$(CHIP_SERIES)_aliases.ld
 
 ARCHSCRIPT += $(call FINDSCRIPT,$(CHIP_SERIES)_flat_memory.ld)
 
-ifeq ($(CONFIG_ESP32P4_REV_MIN_300),y)
+ifneq ($(CONFIG_ESP32P4_SELECTS_REV_LESS_V3),y)
   BOARD_REV = .rev3
 endif
 
diff --git a/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/CMakeLists.txt 
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/CMakeLists.txt
index da332467cbb..3e523e9a287 100644
--- a/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/CMakeLists.txt
+++ b/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/CMakeLists.txt
@@ -52,7 +52,7 @@ set(LDSCRIPTS 
"${BOARD_COMMON_DIR}/scripts/${CHIP_SERIES}_aliases.ld"
               "${BOARD_COMMON_DIR}/scripts/${CHIP_SERIES}_flat_memory.ld")
 
 if(CONFIG_ESPRESSIF_BOOTLOADER_MCUBOOT OR CONFIG_ESPRESSIF_SIMPLE_BOOT)
-  if(CONFIG_ESP32P4_REV_MIN_300)
+  if(NOT "${CONFIG_ESP32P4_SELECTS_REV_LESS_V3}" STREQUAL "y")
     list(APPEND LDSCRIPTS
          "${BOARD_COMMON_DIR}/scripts/${CHIP_SERIES}_sections.rev3.ld")
   else()
diff --git a/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_boot.c 
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_boot.c
index 11f36926329..8dcfa968e33 100644
--- a/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_boot.c
+++ b/boards/risc-v/esp32p4/esp32p4-function-ev-board/src/esp32p4_boot.c
@@ -26,6 +26,8 @@
 
 #include <nuttx/config.h>
 
+#include "esp32p4-function-ev-board.h"
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/

Reply via email to