Skip to content

esp32p4: Implements PSRAM support for ESP32-P4#18754

Merged
acassis merged 3 commits intoapache:masterfrom
tmedicci:feature/esp32p4_psram
Apr 18, 2026
Merged

esp32p4: Implements PSRAM support for ESP32-P4#18754
acassis merged 3 commits intoapache:masterfrom
tmedicci:feature/esp32p4_psram

Conversation

@tmedicci
Copy link
Copy Markdown
Contributor

Summary

Implements the in-package PSRAM support for ESP32-P4.

Impact

Impact on user: Yes. Enable the use of the in-chip PSRAM on ESP32-P4.

Impact on build: No.

Impact on hardware: Yes. ESP32-P4.

Impact on documentation: Yes. esp32p4-function-ev-board:psram_usrheap defconfig properly documented.

Impact on security: No.

Impact on compatibility: No.

Testing

Build esp32p4-function-ev-board:psram_usrheap defconfig, flash the firmware and run the testing commands below.

Building

make -j distclean
./tools/configure.sh -S esp32p4-function-ev-board:psram_usrheap
make flash ESPTOOL_PORT=/dev/ttyUSB0
picocom -b 115200 /dev/ttyUSB0

Running

Run the free and heap commands on NSH.

Results

free

Shows both Kernel and User Heap:

nsh> free
      total       used       free    maxused    maxfree  nused  nfree name
     602004       6492     595512       6872     595512     36      1 Kmem
   33554428       4276   33550152       4656   33550152      8      1 Umem

heap

Expect the test to complete successfully:

nsh> heap
     mallinfo:
       Total space allocated from system = 33554428
       Number of non-inuse chunks        = 1
       Largest non-inuse chunk           = 33548096
       Total allocated space             = 6332
       Total non-inuse space             = 33548096
(0)Allocating 5024 bytes
(0)Memory allocated at 0x480018c0
     mallinfo:
       Total space allocated from system = 33554428
       Number of non-inuse chunks        = 1
       Largest non-inuse chunk           = 33543080
       Total allocated space             = 11348
       Total non-inuse space             = 33543080
...
(31)Releasing memory at 0x48001900 (size=24 bytes)
     mallinfo:
       Total space allocated from system = 33554428
       Number of non-inuse chunks        = 1
       Largest non-inuse chunk           = 33548096
       Total allocated space             = 6332
       Total non-inuse space             = 33548096
TEST COMPLETE

@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: M The size of the change in this PR is medium Board: risc-v labels Apr 17, 2026
fdcavalcanti
fdcavalcanti previously approved these changes Apr 17, 2026
simbit18
simbit18 previously approved these changes Apr 17, 2026
@simbit18
Copy link
Copy Markdown
Contributor

Hi @tmedicci please fix

====================================================================================
Configuration/Tool: esp32c3-devkit/mcuboot_update_agent
2026-04-17 12:32:18
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Building NuttX...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

 61 1807k   61 1110k    0     0  2098k      0 --:--:-- --:--:-- --:--:-- 2098k
 91  340k   91  309k    0     0   811k      0 --:--:-- --:--:-- --:--:--  811k
100  340k  100  340k    0     0   856k      0 --:--:-- --:--:-- --:--:-- 2034k

100 1807k  100 1807k    0     0  3096k      0 --:--:-- --:--:-- --:--:-- 12.6M
riscv-none-elf-ld: /github/workspace/sources/nuttx/staging/libarch.a(esp_start.o): in function `__esp_start':
esp_start.c:(.text.__esp_start+0x194): undefined reference to `bootloader_init_mem'
make[1]: *** [Makefile:191: nuttx] Error 1
make: *** [tools/Unix.mk:568: nuttx] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 386: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize esp32c3-devkit/mcuboot_update_agent
Removing libs/libbuiltin/bin/
Removing libs/libbuiltin/kbin/
Removing libs/libc/kbin/
Removing libs/libnx/bin/
Removing libs/libnx/kbin/
Removing mm/kbin/
/github/workspace/sources/nuttx /github/workspace/sources/nuttx
HEAD detached at pull/18754/merge
nothing to commit, working tree clean
/github/workspace/sources/nuttx
/github/workspace/sources/apps /github/workspace/sources/nuttx
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
/github/workspace/sources/nuttx
Wait 83 seconds (120 backoff)
Build Attempt 3 of 4
====================================================================================

@tmedicci tmedicci dismissed stale reviews from simbit18 and fdcavalcanti via 06c82f8 April 17, 2026 13:55
@tmedicci tmedicci force-pushed the feature/esp32p4_psram branch 2 times, most recently from 06c82f8 to 4c3292c Compare April 17, 2026 13:56
@tmedicci
Copy link
Copy Markdown
Contributor Author

Hi @tmedicci please fix

====================================================================================
Configuration/Tool: esp32c3-devkit/mcuboot_update_agent
2026-04-17 12:32:18
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Building NuttX...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

 61 1807k   61 1110k    0     0  2098k      0 --:--:-- --:--:-- --:--:-- 2098k
 91  340k   91  309k    0     0   811k      0 --:--:-- --:--:-- --:--:--  811k
100  340k  100  340k    0     0   856k      0 --:--:-- --:--:-- --:--:-- 2034k

100 1807k  100 1807k    0     0  3096k      0 --:--:-- --:--:-- --:--:-- 12.6M
riscv-none-elf-ld: /github/workspace/sources/nuttx/staging/libarch.a(esp_start.o): in function `__esp_start':
esp_start.c:(.text.__esp_start+0x194): undefined reference to `bootloader_init_mem'
make[1]: *** [Makefile:191: nuttx] Error 1
make: *** [tools/Unix.mk:568: nuttx] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 386: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize esp32c3-devkit/mcuboot_update_agent
Removing libs/libbuiltin/bin/
Removing libs/libbuiltin/kbin/
Removing libs/libc/kbin/
Removing libs/libnx/bin/
Removing libs/libnx/kbin/
Removing mm/kbin/
/github/workspace/sources/nuttx /github/workspace/sources/nuttx
HEAD detached at pull/18754/merge
nothing to commit, working tree clean
/github/workspace/sources/nuttx
/github/workspace/sources/apps /github/workspace/sources/nuttx
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
/github/workspace/sources/nuttx
Wait 83 seconds (120 backoff)
Build Attempt 3 of 4
====================================================================================

Updated! Thanks @simbit18

simbit18
simbit18 previously approved these changes Apr 17, 2026
fdcavalcanti
fdcavalcanti previously approved these changes Apr 17, 2026
This commit implements the in-package PSRAM support for ESP32-P4.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
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 <tiago.medicci@espressif.com>
This commit adds an entry for the ESP32-P4-Function-EV-Board's
`psram_usrheap` defconfig on docs.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
@tmedicci tmedicci dismissed stale reviews from fdcavalcanti and simbit18 via 29d9daf April 17, 2026 16:57
@tmedicci tmedicci force-pushed the feature/esp32p4_psram branch from 4c3292c to 29d9daf Compare April 17, 2026 16:57
@acassis acassis merged commit 08a1953 into apache:master Apr 18, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Area: Documentation Improvements or additions to documentation Board: risc-v Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants