Skip to content

Added support for wareshare ESP32-P4-Pico-wifi.#18570

Open
Otpvondoiats wants to merge 4 commits intoapache:masterfrom
Otpvondoiats:lk_p4
Open

Added support for wareshare ESP32-P4-Pico-wifi.#18570
Otpvondoiats wants to merge 4 commits intoapache:masterfrom
Otpvondoiats:lk_p4

Conversation

@Otpvondoiats
Copy link
Copy Markdown
Contributor

@Otpvondoiats Otpvondoiats commented Mar 21, 2026

Summary

https://docs.waveshare.net/ESP32-P4-WIFI6

image

The ESP32-P4-Pico is a multimedia development board based on the ESP32-P4 microcontroller. It offers a rich set of human-machine interfaces, including MIPI-CSI (integrated image signal processor ISP), MIPI-DSI, SPI, I2S, I2C, LED PWM, MCPWM, RMT, ADC, UART, and TWAI. Furthermore, it supports USB OTG 2.0 HS and features an onboard 40-pin GPIO expansion interface, making it compatible with some Raspberry Pi Pico expansion boards for broader application adaptation. The ESP32-P4 uses a 360MHz dual-core RISC-V processor, supports up to 32MB of PSRAM, and features peripherals such as USB 2.0, MIPI-CSI/MIPI-DSI, and H.264 encoding, meeting the needs of low-cost, high-performance, and low-power multimedia development. In addition, the ESP32-P4 integrates digital signature peripherals and a dedicated key management unit to ensure data and operational security. The ESP32-P4-Pico is designed for high-performance and high-security applications, meeting the needs of embedded systems in areas such as human-machine interaction, edge computing, and I/O expansion.

Product Features:
Processor: Features a RISC-V 32-bit dual-core processor (HP system), equipped with DSP and instruction set extensions, a floating-point unit (FPU), and a clock speed up to 360MHz.

  • Features a RISC-V 32-bit single-core processor (LP system), with a clock speed up to 40MHz.
    Memory:
    128 KB of high-performance (HP) system read-only memory (ROM).
  • 16 KB of low-power (LP) system read-only memory (ROM).
  • 768 KB of high-performance (HP) L2 memory (L2MEM).
  • 32 KB of low-power (LP) SRAM.
  • 8 KB of tightly coupled system memory (TCM).

The package includes 32 MB of internal PSRAM and 32 MB of onboard Nor Flash. Peripheral Interfaces: The board has 2 × 20 header pins and 27 remaining programmable GPIOs. Onboard speaker and microphone interfaces allow for ideal audio functionality using codec and amplifier chips. An onboard MIPI-CSI high-definition camera interface supports full HD 1080P video capture and encoding, integrating an image signal processor (ISP) and H.264 video encoder, supporting H.264 & JPEG video encoding (1080P @30fps), facilitating applications in computer vision, machine vision, and other fields. An onboard MIPI-DSI high-definition display interface integrates a pixel processing accelerator (PPA) and a 2D graphics acceleration controller (2D DMA), supporting JPEG image decoding (1080P @30fps), providing strong support for high-definition display and a smooth HMI experience, facilitating applications in smart home control screens, industrial control screens, vending machines, and other scenarios.

image

Impact

Hardware: Adds board support for the Waveshare ESP32-P4-PICO-WIFI development board (ESP32-P4 rev v1.0, 768KB HP L2MEM,). On rev < v3.0, the non-contiguous sram_high (384KB) is now added as a second heap region, increasing available heap from ~500KB to ~620KB.
Build: New Kconfig option ESPRESSIF_FLASH_32M for 32MB flash support. New board target esp32p4-pico-wifi-wareshare with nsh, spiflash, and nsh2 configurations. Requires CONFIG_MM_REGIONS=2 for dual heap and CONFIG_ESP32P4_SELECTS_REV_LESS_V3 to bypass chip revision PANIC on rev < v3.0
Compatibility: No impact on existing boards or configurations. PSRAM driver is not yet available upstream. Boards targeting rev < v3.0 must explicitly opt-in via Kconfig to boot.

Testing

  1. ./tools/configure.sh esp32p4-pico-wifi-wareshare:nsh
  2. make CROSSDEV=riscv32-esp-elf- -j$(nproc)
  3. esptool.py -c esp32p4 -p /dev/ttyACM3 -b 460800 --before default_reset --after hard_reset --no-stub write_flash 0x2000 nuttx.bin

NSH test

lk@03-20 18:42:18: ~$sudo minicom -b 115200 -D /dev/ttyACM3
[sudo] lk 的密码:


欢迎使用 minicom 2.8

选项: I18n
通信端口 /dev/ttyACM3, 13:29:01

按 CTRL-A Z 说明特殊键


nsh>
nsh>
nsh>
nsh> free
      total       used       free    maxused    maxfree  nused  nfree name
     606636      11188     595448      11568     393200     41      2 Umem
nsh> uname
NuttX
nsh> ps
  TID   PID  PPID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK            STACK COMMAND
    0     0     0   0 FIFO     Kthread   - Ready              0000000000000000 0002016 Idle_Task
    1     1     0 100 RR       Task      - Running            0000000000000000 0001976 nsh_main
nsh> ls
/:
 data/
 dev/
 proc/
nsh> cd data
nsh> ls
/data:
 test.txt
nsh> touch 111.log
nsh: touch: command not found
nsh>
nsh>
nsh> df
  Block    Number
  Size     Blocks       Used   Available Mounted on
  1024        960         11         949 /data
     0          0          0           0 /proc
nsh> ls
/data:
 test.txt
nsh> cat test.txt
hello-flash
nsh>

32M flash test


nsh> 
nsh> 
nsh> 
nsh> 
nsh> 
nsh> 
nsh> 
nsh> mount -t smartfs /dev/smart0 /tmp
nsh: mount: mount failed: Not a directory
nsh> reboot
reboot status=0
ESP-ROM:esp32p4-eco2-20240710
Build:Jul 10 2024
rst:0x10 (CHIP_LP_WDT_RESET),boot:0x30f (SPI_FAST_FLASH_BOOT)
SPI mode:DIO, clock div:1
load:0x30100000,len:0xc
load:0x3010000c,len:0x38
load:0x4ff00000,len:0x82a0
load:0x4ff08300,len:0xbe4
SHA-256 comparison failed:
Calculated: d39ab140e197d0d83b6b737cd65eaa8d21b949bb6dd57f69c194c7698b095082
Expected: 0000000000510000000000000000000000000000000000000000000000000000
Attempting to boot anyway...
entry 0x4ff07fa0
*** Booting NuttX ***
tcm: lma 0x00002020 vma 0x30100000 len 0xc      (12)
tcm: lma 0x00002034 vma 0x3010000c len 0x38     (56)
dram: lma 0x00002074 vma 0x4ff00000 len 0x82a0   (33440)
dram: lma 0x0000a31c vma 0x4ff08300 len 0xbe4    (3044)
padd: lma 0x0000af18 vma 0x00000000 len 0x5100   (20736)
imap: lma 0x00010020 vma 0x40030020 len 0xbd6c   (48492)
padd: lma 0x0001bd94 vma 0x00000000 len 0x4264   (16996)
imap: lma 0x00020000 vma 0x40000000 len 0x26238  (156216)2 | 脱机 | ttyACM4                                       
total segments stored 8
WARNING: NuttX supports ESP32-P4 chip revision > v3.0 (chip revision is v1.0).
Ignoring this error and continuing because `CONFIG_ESP32P4_SELECTS_REV_LESS_V3` is set...
THIS MAY NOT WORK! DON'T USE THIS CHIP IN PRODUCTION!

NuttShell (NSH) NuttX-12.12.0
nsh> 
nsh> 
nsh> mount -t smartfs /dev/smart0 /tmp
nsh> 
nsh> df -h
  Filesystem      Size      Used  Available Mounted on
  smartfs          30M       12K        30M /data
  procfs            0B        0B         0B /proc
  smartfs          30M       12K        30M /tmp
nsh> dd if=/data/testfile of=/dev/null bs=4096 count=16
dd: failed to open '/data/testfile': No such file or directory
nsh> dd if=/tmp/testfile of=/dev/null bs=4096 count=256
dd: failed to open '/tmp/testfile': No such file or directory
nsh> 
nsh> 
nsh> 
nsh> 
nsh> ls
/:
 data/
 dev/
 proc/
 tmp/
nsh> cd tmp
nsh> mkdir 111
nsh> ll
nsh: ll: command not found
nsh> ls
/tmp:
 111/
nsh> wpd
nsh: wpd: command not found
nsh> pwd
/tmp
nsh> mksmartfs /dev/smart0
nsh> ls /dev
/dev:
 console
 null
 random
 smart0
 ttyS0
 zero
nsh> umount
nsh: umount: missing required argument(s)
nsh> umount /tmp
nsh> umount /data
nsh> df -h
  Filesystem      Size      Used  Available Mounted on
  procfs            0B        0B         0B /proc
nsh> mksmartfs /dev/smart0
nsh>  mount -t smartfs /dev/smart0p0 /tmp
nsh: mount: mount failed: Block device required
nsh>  mount -t smartfs /dev/smart0 /tmp
nsh> 
nsh> 
nsh> 
nsh> df -h
  Filesystem      Size      Used  Available Mounted on
  procfs            0B        0B         0B /proc
  smartfs          30M       13K        30M /tmp
nsh> dd if=/tmp/testfile of=/dev/null bs=4096 count=256
dd: failed to open '/tmp/testfile': No such file or directory
nsh> dd if=/dev/zero of=/tmp/testfile bs=4096 count=256
1048576 bytes (256 blocks) copied, 6960000 usec, 147 KB/s
nsh>  dd if=/tmp/testfile of=/dev/null bs=4096 count=256
1048576 bytes (256 blocks) copied, 240000 usec, 4266 KB/s
nsh> help
help usage:  help [-v] [<cmd>]

    .            cp           expr         mksmartfs    rmdir        true         
    [            cmp          false        mount        set          truncate     
    ?            dirname      fdinfo       mv           kill         uname        
    alias        df           free         pidof        pkill        umount       
    unalias      dmesg        help         printf       sleep        unset        
    basename     echo         hexdump      ps           usleep       uptime       
    break        env          ls           pwd          source       watch        
    cat          exec         mkdir        reboot       test         xd           
    cd           exit         mkrd         rm           time         wait         

Builtin Apps:
    dd                flash_eraseall    getprime          ostest            
    dumpstack         fstest            nsh               sh                
nsh> df -h
nsh: �df: command not found
nsh> df -h
  Filesystem      Size      Used  Available Mounted on
  procfs            0B        0B         0B /proc
  smartfs          30M     1048K        29M /tmp
nsh> ls /tmp
/tmp:
 111/
 testfile
nsh> mkdir 1234
nsh> cd 1234
nsh> 
nsh> pwd
/tmp/1234
nsh> 



@github-actions github-actions bot added Area: Build system Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: risc-v labels Mar 21, 2026
@Otpvondoiats Otpvondoiats reopened this Mar 21, 2026
@Otpvondoiats Otpvondoiats marked this pull request as draft March 21, 2026 05:44
@tmedicci
Copy link
Copy Markdown
Contributor

Hi @Otpvondoiats , why did you close this PR? Doesn't it make sense anymore for some reason?

@Otpvondoiats
Copy link
Copy Markdown
Contributor Author

Hi @Otpvondoiats , why did you close this PR? Doesn't it make sense anymore for some reason?

Still under testing, will reopen later.

@acassis
Copy link
Copy Markdown
Contributor

acassis commented Mar 26, 2026

@Otpvondoiats another thing: you missed the board Documentation, although you almost created one in the Summary :-D

@Otpvondoiats Otpvondoiats reopened this Mar 28, 2026
@Otpvondoiats Otpvondoiats marked this pull request as ready for review March 28, 2026 15:30
@Otpvondoiats Otpvondoiats force-pushed the lk_p4 branch 3 times, most recently from 03c1da4 to 15c5753 Compare March 28, 2026 15:36
@github-actions github-actions bot added Area: Tooling Size: S The size of the change in this PR is small and removed Area: Build system Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: risc-v labels Mar 28, 2026
@Otpvondoiats Otpvondoiats marked this pull request as draft March 28, 2026 15:37
@github-actions github-actions bot added Area: Build system Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: risc-v and removed Size: S The size of the change in this PR is small labels Mar 28, 2026
@Otpvondoiats Otpvondoiats marked this pull request as ready for review March 28, 2026 15:38
@Otpvondoiats
Copy link
Copy Markdown
Contributor Author

@Otpvondoiats another thing: you missed the board Documentation, although you almost created one in the Summary :-D

GET

@Otpvondoiats Otpvondoiats marked this pull request as draft March 28, 2026 15:56
Add ESPRESSIF_FLASH_32M Kconfig option and the corresponding
esptool flash size mapping in Config.mk to support boards with
32MB NOR flash.

Signed-off-by: likun17 <likun17@xiaomi.com>
The chip revision check was disabled with #if 0 for v1.0 bringup.
Restore the original #ifndef ESP32P4_IGNORE_CHIP_REVISION_CHECK
guard so boards can selectively bypass the PANIC by defining
this macro, while keeping the warning message in the #else branch.

Signed-off-by: likun17 <likun17@xiaomi.com>
On ESP32-P4 rev < v3, the 768KB HP L2MEM is split into two
non-contiguous regions: sram_low and sram_high. Previously only
sram_low was used for the heap, wasting 384KB of sram_high.

Export _sram_high_heap_start and _sram_high_heap_end symbols from
the linker script and add sram_high to the heap via kumm_addregion()
in riscv_addregion() when MM_REGIONS > 1.

Signed-off-by: likun17 <likun17@xiaomi.com>
Add board support for the Waveshare ESP32-P4-PICO-WIFI development
board. This board features:
- ESP32-P4 dual-core RISC-V MCU (rev v1.0)
- 768KB HP L2MEM (MM_REGIONS=2 for sram_low + sram_high)
- 32MB external NOR Flash (GD25Q256EYIGR, Quad SPI)
- 32MB SiP PSRAM (driver not yet available upstream)

Configurations:
- nsh: basic NuttX shell
- spiflash: NSH with SPI Flash (SmartFS) support

Signed-off-by: likun17 <likun17@xiaomi.com>
@Otpvondoiats Otpvondoiats marked this pull request as ready for review March 29, 2026 03:08
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: Build system Board: risc-v Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants