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


The following commit(s) were added to refs/heads/master by this push:
     new f5e3bb24595 boards/esp32p4: add support to M5Stack Tab5 board
f5e3bb24595 is described below

commit f5e3bb24595b78c5e329d13b1ad559a294ed3ef9
Author: Jorge Guzman <[email protected]>
AuthorDate: Thu Jun 25 22:34:09 2026 -0300

    boards/esp32p4: add support to M5Stack Tab5 board
    
    This initial port supports NSH and the I2C0 bus; all board pins are
    documented for future drivers.
    
    Signed-off-by: Jorge Guzman <[email protected]>
---
 .../boards/esp32p4-tab5/esp32p4-tab5-m5stack-1.png | Bin 0 -> 223094 bytes
 .../boards/esp32p4-tab5/esp32p4-tab5-m5stack-2.png | Bin 0 -> 235880 bytes
 .../risc-v/esp32p4/boards/esp32p4-tab5/index.rst   | 165 +++++++++++++++++++++
 boards/Kconfig                                     |  11 ++
 boards/risc-v/esp32p4/esp32p4-tab5/CMakeLists.txt  |  23 +++
 boards/risc-v/esp32p4/esp32p4-tab5/Kconfig         |   8 +
 .../esp32p4/esp32p4-tab5/configs/nsh/defconfig     |  57 +++++++
 boards/risc-v/esp32p4/esp32p4-tab5/include/board.h | 116 +++++++++++++++
 .../risc-v/esp32p4/esp32p4-tab5/scripts/Make.defs  |  64 ++++++++
 .../risc-v/esp32p4/esp32p4-tab5/src/CMakeLists.txt |  54 +++++++
 boards/risc-v/esp32p4/esp32p4-tab5/src/Make.defs   |  35 +++++
 .../risc-v/esp32p4/esp32p4-tab5/src/esp32p4-tab5.h |  60 ++++++++
 .../risc-v/esp32p4/esp32p4-tab5/src/esp32p4_boot.c |  91 ++++++++++++
 .../esp32p4/esp32p4-tab5/src/esp32p4_bringup.c     |  92 ++++++++++++
 .../esp32p4/esp32p4-tab5/src/esp32p4_reset.c       |  83 +++++++++++
 15 files changed, 859 insertions(+)

diff --git 
a/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/esp32p4-tab5-m5stack-1.png
 
b/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/esp32p4-tab5-m5stack-1.png
new file mode 100644
index 00000000000..afd92daa17d
Binary files /dev/null and 
b/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/esp32p4-tab5-m5stack-1.png
 differ
diff --git 
a/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/esp32p4-tab5-m5stack-2.png
 
b/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/esp32p4-tab5-m5stack-2.png
new file mode 100644
index 00000000000..5705205676d
Binary files /dev/null and 
b/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/esp32p4-tab5-m5stack-2.png
 differ
diff --git 
a/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/index.rst 
b/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/index.rst
new file mode 100644
index 00000000000..488c220cc5c
--- /dev/null
+++ b/Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/index.rst
@@ -0,0 +1,165 @@
+.. _esp32p4-tab5:
+
+==============
+M5Stack Tab5
+==============
+
+.. tags:: chip:esp32p4, arch:risc-v, vendor:espressif
+
+.. figure:: esp32p4-tab5-m5stack-1.png
+   :align: center
+   :alt: M5Stack Tab5
+
+   M5Stack Tab5 (front)
+
+The `M5Stack Tab5 <https://docs.m5stack.com/en/products/sku/k145>`_ is a
+portable HMI tablet built around the ESP32-P4 (dual RISC-V) application
+processor, paired with an ESP32-C6 companion module for Wi-Fi 6 / BLE /
+Thread connectivity over SDIO.
+
+This NuttX port brings up the parts of the board that work with the upstream
+ESP32-P4 drivers only — no out-of-tree driver patches are required.  The
+display and the other peripherals are **not** implemented yet; their pin
+assignments are documented below so they can be added later.
+
+.. figure:: esp32p4-tab5-m5stack-2.png
+   :align: center
+   :alt: M5Stack Tab5 rear view
+
+   M5Stack Tab5 (rear): PCB, NP-F550 battery bay and M5-Bus connector
+
+Features
+========
+
+* ESP32-P4 (dual RISC-V @ 360 MHz), 16 MB flash, 32 MB Octal PSRAM
+* ESP32-C6-MINI-1U companion (Wi-Fi 6 / BLE / Thread) over SDIO2
+* 5" MIPI-DSI IPS display, 1280x720 (ILI9881C), GT911 capacitive touch
+* ES8388 audio codec + NS4150B speaker amp, ES7210 microphone array
+* SC2356 2 MP MIPI-CSI camera
+* BMI270 6-axis IMU, RX8130CE RTC, INA226 power monitor
+* Two PI4IOE5V6408 I2C IO expanders
+* NP-F550 battery via IP2326 charger, USB Type-C (OTG) + Type-A host
+* RS485 (SIT3088), microSD, M5-Bus 30-pin + Grove HY2.0-4P
+
+Supported features
+==================
+
++------------------------+--------------------------------------------------+
+| Peripheral             | Status                                           |
++========================+==================================================+
+| UART / USB-Serial-JTAG | Yes (NSH console on the USB-C port, ``ttyACM``)  |
++------------------------+--------------------------------------------------+
+| I2C0                   | Yes (``/dev/i2c0``, SDA=GPIO31, SCL=GPIO32)      |
++------------------------+--------------------------------------------------+
+| PSRAM                  | Yes (32 MB Octal)                                |
++------------------------+--------------------------------------------------+
+| GPIO / BOOT button     | Yes                                              |
++------------------------+--------------------------------------------------+
+
+Not yet implemented (pins and I2C addresses documented below):
+
+* MIPI-DSI display (ILI9881C) and GT911 touch
+* Audio (ES8388 / ES7210), camera (SC2356)
+* INA226 power monitor — battery rail, 5 mOhm shunt (bus voltage = battery
+  voltage; positive current = discharging, negative = charging)
+* RX8130CE RTC, microSD, ESP32-C6 Wi-Fi
+
+Pin mapping
+===========
+
+============ =========================================================
+GPIO         Function
+============ =========================================================
+5            M5-Bus SCK
+6            PC_TX (debug UART)
+7            PC_RX (debug UART)
+8-15         ESP32-C6 SDIO2 bus (D3-D0, IO2, RST, CK, CMD)
+16, 17       M5-Bus general / PB_IN
+18           M5-Bus MOSI
+19           M5-Bus MISO
+20           RS485 TX
+21           RS485 RX
+22           LCD backlight enable (LEDA, via ME2212 boost)
+23           Touch interrupt (TP_INT, GT911)
+26           I2S DSDIN (audio data to ES8388)
+27           I2S SCLK (audio bit clock)
+29           I2S LRCK (audio word clock)
+30           I2S / camera MCLK
+31           I2C0 SDA (touch, audio, IMU, RTC, power-mon, IO exp)
+32           I2C0 SCL
+34           RS485 direction (DE/RE)
+35           BOOT button
+36           Camera MCLK
+37           M5-Bus TXD0
+38           M5-Bus RXD0
+39           SD DAT0 (SPI MISO)
+40           SD DAT1 (SPI CS in microSD NAND mode)
+41           SD DAT2 (SPI SCK)
+42           SD DAT3 (SPI MOSI)
+43           SD CLK
+44           SD CMD
+52           M5-Bus PB_OUT
+53           Grove SDA
+54           Grove SCL
+============ =========================================================
+
+.. note::
+   The MIPI-DSI data/clock lanes are dedicated MIPI pins (powered by
+   ``VDD_MIPI_DPHY``) and are not part of the GPIO matrix.  The panel has no
+   GPIO reset line (``BSP_LCD_RST = NC``); it is reset by the board power-on
+   reset.  ``LCD_EN`` and ``TOUCH_EN`` are driven by IO expander 0x43
+   (P4 = LCD_EN, P5 = TOUCH_EN).
+
+I2C device address map
+======================
+
+======= ====================================================
+Address Device
+======= ====================================================
+0x10    ES8388 audio codec
+0x14    GT911 touch controller
+0x32    RX8130CE RTC
+0x40    ES7210 microphone array
+0x41    INA226 power monitor
+0x43    PI4IOE5V6408-1 IO expander (LCD_EN / TOUCH_EN)
+0x44    PI4IOE5V6408-2 IO expander (USB / Wi-Fi enables)
+0x68    BMI270 IMU
+======= ====================================================
+
+Chip revision
+=============
+
+The Tab5 ships with ESP32-P4 **revision v1.0**.  The ``nsh`` defconfig sets
+``CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y`` accordingly.  A harmless boot warning
+is printed because the upstream default targets rev >= 3.0.
+
+Configurations
+==============
+
+nsh
+---
+
+Basic NuttShell configuration (console enabled over the USB Serial/JTAG port,
+exposed as ``/dev/ttyACM0`` on the host).  Brings up the I2C0 bus.
+
+Building and flashing
+=====================
+
+.. code-block:: console
+
+   $ ./tools/configure.sh esp32p4-tab5:nsh
+   $ make -j
+
+The NuttX image must be flashed at offset ``0x2000`` (the SIMPLE_BOOT
+application offset for the ESP32-P4):
+
+.. code-block:: console
+
+   $ esptool.py -c esp32p4 -p /dev/ttyACM0 -b 921600 write_flash 0x2000 
nuttx.bin
+
+Then open the console:
+
+.. code-block:: console
+
+   $ picocom -b 115200 /dev/ttyACM0
+   nsh>
diff --git a/boards/Kconfig b/boards/Kconfig
index e39d5b834c6..fee8d033474 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -673,6 +673,13 @@ config ARCH_BOARD_ESP32P4_PICO_WIFI_WARESHARE
        ---help---
                The Waveshare ESP32-P4-PICO-WIFI features the ESP32-P4 CPU with 
two RISC-V cores.
 
+config ARCH_BOARD_ESP32P4_TAB5
+       bool "M5Stack Tab5 (ESP32-P4)"
+       depends on ARCH_CHIP_ESP32P4
+       ---help---
+               The M5Stack Tab5 features the ESP32-P4 (dual RISC-V) plus an 
ESP32-C6
+               wireless companion.  This port brings up NSH and the I2C0 bus.
+
 config ARCH_BOARD_ET_STM32_STAMP
        bool "Futurlec: ET-STM32 Stamp"
        depends on ARCH_CHIP_STM32F103RE
@@ -3708,6 +3715,7 @@ config ARCH_BOARD
        default "esp32h2-devkit"               if ARCH_BOARD_ESP32H2_DEVKIT
        default "esp32p4-function-ev-board"    if 
ARCH_BOARD_ESP32P4_FUNCTION_EV_BOARD
        default "esp32p4-pico-wifi-wareshare"  if 
ARCH_BOARD_ESP32P4_PICO_WIFI_WARESHARE
+       default "esp32p4-tab5"                 if ARCH_BOARD_ESP32P4_TAB5
        default "et-stm32-stamp"               if ARCH_BOARD_ET_STM32_STAMP
        default "tlsr8278adk80d"               if ARCH_BOARD_TLSR8278ADK80D
        default "ez80f910200kitg"              if ARCH_BOARD_EZ80F910200KITG
@@ -5044,6 +5052,9 @@ endif
 if ARCH_BOARD_ESP32P4_PICO_WIFI_WARESHARE
 source "boards/risc-v/esp32p4/esp32p4-pico-wifi-wareshare/Kconfig"
 endif
+if ARCH_BOARD_ESP32P4_TAB5
+source "boards/risc-v/esp32p4/esp32p4-tab5/Kconfig"
+endif
 if ARCH_BOARD_SIM
 source "boards/sim/sim/sim/Kconfig"
 endif
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/CMakeLists.txt 
b/boards/risc-v/esp32p4/esp32p4-tab5/CMakeLists.txt
new file mode 100644
index 00000000000..20fe5395377
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/CMakeLists.txt
@@ -0,0 +1,23 @@
+# 
##############################################################################
+# boards/risc-v/esp32p4/esp32p4-tab5/CMakeLists.txt
+#
+# 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.
+#
+# 
##############################################################################
+
+add_subdirectory(src)
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/Kconfig 
b/boards/risc-v/esp32p4/esp32p4-tab5/Kconfig
new file mode 100644
index 00000000000..e5bcf1d57fb
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/Kconfig
@@ -0,0 +1,8 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+if ARCH_BOARD_ESP32P4_TAB5
+
+endif # ARCH_BOARD_ESP32P4_TAB5
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/configs/nsh/defconfig 
b/boards/risc-v/esp32p4/esp32p4-tab5/configs/nsh/defconfig
new file mode 100644
index 00000000000..6905a5e4f4c
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/configs/nsh/defconfig
@@ -0,0 +1,57 @@
+#
+# 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-tab5"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32P4_TAB5=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_ARCH_STACKDUMP=y
+CONFIG_BOARDCTL_RESET=y
+CONFIG_BOARD_LOOPSPERMSEC=15000
+CONFIG_BUILTIN=y
+CONFIG_ESP32P4_REV_MIN_100=y
+CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y
+CONFIG_ESPRESSIF_FLASH_16M=y
+CONFIG_ESPRESSIF_FLASH_MODE_QIO=y
+CONFIG_ESPRESSIF_GPIO_IRQ=y
+CONFIG_ESPRESSIF_I2C0=y
+CONFIG_ESPRESSIF_I2C0_SCLPIN=32
+CONFIG_ESPRESSIF_I2C0_SDAPIN=31
+CONFIG_ESPRESSIF_SPIRAM=y
+CONFIG_ESPRESSIF_USBSERIAL=y
+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_REGIONS=3
+CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
+CONFIG_NSH_BUILTIN_APPS=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_START_DAY=29
+CONFIG_START_MONTH=11
+CONFIG_START_YEAR=2019
+CONFIG_SYSTEM_DUMPSTACK=y
+CONFIG_SYSTEM_I2CTOOL=y
+CONFIG_SYSTEM_NSH=y
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/include/board.h 
b/boards/risc-v/esp32p4/esp32p4-tab5/include/board.h
new file mode 100644
index 00000000000..9f2fa626c0a
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/include/board.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+ * boards/risc-v/esp32p4/esp32p4-tab5/include/board.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_RISCV_ESP32P4_ESP32P4_TAB5_INCLUDE_BOARD_H
+#define __BOARDS_RISCV_ESP32P4_ESP32P4_TAB5_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* M5Stack Tab5 (ESP32-P4 + ESP32-C6) full pin map
+ *
+ * Only the I2C bus and the BOOT button are wired up by the current board
+ * logic.  All remaining pins are documented here (and in the board's
+ * Documentation/.rst) so that future drivers can be added without having to
+ * re-derive the wiring.  See the board documentation for the I2C device
+ * address map and the peripheral status (supported vs. pins-only).
+ */
+
+/* Console / debug UART (PC_TX/PC_RX header) */
+
+#define TAB5_GPIO_PC_TX        6   /* UART debug TX */
+#define TAB5_GPIO_PC_RX        7   /* UART debug RX */
+
+/* I2C0 - shared system bus (touch, audio, IMU, RTC, power-mon, IO exp) */
+
+#define TAB5_GPIO_I2C0_SDA     31
+#define TAB5_GPIO_I2C0_SCL     32
+
+/* Grove HY2.0-4P port (secondary I2C / GPIO) */
+
+#define TAB5_GPIO_GROVE_SDA    53
+#define TAB5_GPIO_GROVE_SCL    54
+
+/* BOOT button (active low) */
+
+#define BUTTON_BOOT            35
+
+/* Display - MIPI-DSI ILI9881C (NOT implemented; pins documented only)
+ *
+ * The DSI data/clock lanes are dedicated MIPI pins (not GPIO-muxed) powered
+ * by VDD_MIPI_DPHY; only the backlight enable is a GPIO.  Panel reset is the
+ * board power-on reset (BSP_LCD_RST = NC) driven by IO expander 0x43 P4.
+ */
+
+#define TAB5_GPIO_LCD_BL_EN    22  /* Backlight enable -> ME2212 boost EN */
+
+/* Touch - GT911 (NOT implemented; pins documented only) */
+
+#define TAB5_GPIO_TP_INT       23  /* GT911 touch interrupt */
+
+/* Audio - ES8388 codec (out) + ES7210 mic array (in), I2S (pins only) */
+
+#define TAB5_GPIO_I2S_DSDIN    26  /* I2S data to ES8388 */
+#define TAB5_GPIO_I2S_SCLK     27  /* I2S bit clock */
+#define TAB5_GPIO_I2S_LRCK     29  /* I2S word/LR clock */
+#define TAB5_GPIO_I2S_MCLK     30  /* I2S / camera master clock */
+
+/* Camera - SC2356 MIPI-CSI (pins only) */
+
+#define TAB5_GPIO_CAM_MCLK     36  /* Camera master clock */
+
+/* RS485 - SIT3088 half-duplex (pins only) */
+
+#define TAB5_GPIO_RS485_TX     20
+#define TAB5_GPIO_RS485_RX     21
+#define TAB5_GPIO_RS485_DE     34  /* Direction (DE/RE) */
+
+/* microSD - SDMMC 4-bit per M5Stack BSP (pins only; no SDMMC driver yet)
+ *
+ * SPI-mode mapping for the same slot would be:
+ *   SCK=CLK(43), MOSI=CMD(44), MISO=DAT0(39), CS=DAT3(42).
+ */
+
+#define TAB5_GPIO_SD_D0        39  /* DAT0 (also SPI MISO) */
+#define TAB5_GPIO_SD_D1        40  /* DAT1 (also SPI CS in NAND mode) */
+#define TAB5_GPIO_SD_D2        41  /* DAT2 (also SPI SCK) */
+#define TAB5_GPIO_SD_D3        42  /* DAT3 (also SPI MOSI) */
+#define TAB5_GPIO_SD_CLK       43  /* SD clock */
+#define TAB5_GPIO_SD_CMD       44  /* SD command */
+
+/* M5-Bus expansion (pins only) */
+
+#define TAB5_GPIO_M5_SCK       5
+#define TAB5_GPIO_M5_PB_IN     16
+#define TAB5_GPIO_M5_MOSI      18
+#define TAB5_GPIO_M5_MISO      19
+#define TAB5_GPIO_M5_TXD0      37
+#define TAB5_GPIO_M5_RXD0      38
+#define TAB5_GPIO_M5_PB_OUT    52
+
+/* ESP32-C6 (Wi-Fi/BT companion) - SDIO2 bus GPIO8..15 (pins only)
+ *
+ * GPIO8-15 carry D3..D0, IO2, RST, CK, CMD of the SDIO2 link to the C6.
+ */
+
+#endif /* __BOARDS_RISCV_ESP32P4_ESP32P4_TAB5_INCLUDE_BOARD_H */
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/scripts/Make.defs 
b/boards/risc-v/esp32p4/esp32p4-tab5/scripts/Make.defs
new file mode 100644
index 00000000000..2579d1ce72e
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/scripts/Make.defs
@@ -0,0 +1,64 @@
+############################################################################
+# boards/risc-v/esp32p4/esp32p4-tab5/scripts/Make.defs
+#
+# 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.
+#
+###########################################################################
+
+include $(TOPDIR)/.config
+include $(TOPDIR)/tools/Config.mk
+include $(TOPDIR)/tools/espressif/Config.mk
+include $(TOPDIR)/arch/risc-v/src/common/Toolchain.defs
+
+# Remove quotes from CONFIG_ESPRESSIF_CHIP_SERIES configuration
+
+CHIP_SERIES = $(patsubst "%",%,$(CONFIG_ESPRESSIF_CHIP_SERIES))
+
+# Pick the linker scripts from the board level if they exist, if not
+# pick the common linker scripts.
+
+ARCHSCRIPT += $(BOARD_COMMON_DIR)/scripts/$(CHIP_SERIES)_aliases.ld
+
+ARCHSCRIPT += $(call FINDSCRIPT,$(CHIP_SERIES)_flat_memory.ld)
+
+ifneq ($(CONFIG_ESP32P4_SELECTS_REV_LESS_V3),y)
+  BOARD_REV = .rev3
+endif
+
+ifeq ($(CONFIG_ESPRESSIF_BOOTLOADER_MCUBOOT),y)
+  ARCHSCRIPT += $(call FINDSCRIPT,$(CHIP_SERIES)_sections$(BOARD_REV).ld)
+else ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
+  ARCHSCRIPT += $(call FINDSCRIPT,$(CHIP_SERIES)_sections$(BOARD_REV).ld)
+endif
+
+ARCHPICFLAGS = -fpic
+
+CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) 
$(ARCHDEFINES) $(EXTRAFLAGS) -Werror=return-type
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) 
$(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
+AFLAGS := $(CFLAGS) -D__ASSEMBLY__
+
+# Loadable module definitions
+
+LDMODULEFLAGS += -melf32lriscv
+
+# ELF module definitions
+
+LDELFFLAGS += -melf32lriscv
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/src/CMakeLists.txt 
b/boards/risc-v/esp32p4/esp32p4-tab5/src/CMakeLists.txt
new file mode 100644
index 00000000000..30d104ba394
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/src/CMakeLists.txt
@@ -0,0 +1,54 @@
+# 
##############################################################################
+# boards/risc-v/esp32p4/esp32p4-tab5/src/CMakeLists.txt
+#
+# 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(SRCS esp32p4_boot.c esp32p4_bringup.c)
+
+if(CONFIG_BOARDCTL)
+  if(CONFIG_BOARDCTL_RESET)
+    list(APPEND SRCS esp32p4_reset.c)
+  endif()
+endif()
+
+target_sources(board PRIVATE ${SRCS})
+
+# 
##############################################################################
+# Linker scripts (P4: sections or sections.rev3 when REV_MIN_300)
+# 
##############################################################################
+
+string(REPLACE "\"" "" CHIP_SERIES "${CONFIG_ESPRESSIF_CHIP_SERIES}")
+
+set(BOARD_COMMON_DIR "${NUTTX_BOARD_DIR}/../common")
+
+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(NOT "${CONFIG_ESP32P4_SELECTS_REV_LESS_V3}" STREQUAL "y")
+    list(APPEND LDSCRIPTS
+         "${BOARD_COMMON_DIR}/scripts/${CHIP_SERIES}_sections.rev3.ld")
+  else()
+    list(APPEND LDSCRIPTS
+         "${BOARD_COMMON_DIR}/scripts/${CHIP_SERIES}_sections.ld")
+  endif()
+endif()
+
+set_property(GLOBAL APPEND PROPERTY LD_SCRIPT ${LDSCRIPTS})
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/src/Make.defs 
b/boards/risc-v/esp32p4/esp32p4-tab5/src/Make.defs
new file mode 100644
index 00000000000..257ea5bef7f
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/src/Make.defs
@@ -0,0 +1,35 @@
+#############################################################################
+# boards/risc-v/esp32p4/esp32p4-tab5/src/Make.defs
+#
+# 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.
+#
+#############################################################################
+
+include $(TOPDIR)/Make.defs
+
+CSRCS = esp32p4_boot.c esp32p4_bringup.c
+
+ifeq ($(CONFIG_BOARDCTL),y)
+  ifeq ($(CONFIG_BOARDCTL_RESET),y)
+    CSRCS += esp32p4_reset.c
+  endif
+endif
+
+DEPPATH += --dep-path board
+VPATH += :board
+CFLAGS += 
${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4-tab5.h 
b/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4-tab5.h
new file mode 100644
index 00000000000..db80c3db30a
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4-tab5.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+ * boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4-tab5.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_RISCV_ESP32P4_ESP32P4_TAB5_SRC_ESP32P4_TAB5_H
+#define __BOARDS_RISCV_ESP32P4_ESP32P4_TAB5_SRC_ESP32P4_TAB5_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization.
+ *
+ * Input Parameters:
+ *   None.
+ *
+ * Returned Value:
+ *   Zero (OK) is returned on success; A negated errno value is returned on
+ *   any failure.
+ *
+ ****************************************************************************/
+
+int esp_bringup(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __BOARDS_RISCV_ESP32P4_ESP32P4_TAB5_SRC_ESP32P4_TAB5_H */
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_boot.c 
b/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_boot.c
new file mode 100644
index 00000000000..9b293b74b93
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_boot.c
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_boot.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "esp32p4-tab5.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp_board_initialize
+ *
+ * Description:
+ *   All Espressif boards must provide the following entry point.
+ *   This entry point is called early in the initialization -- after all
+ *   memory has been configured and mapped but before any devices have been
+ *   initialized.
+ *
+ * Input Parameters:
+ *   None.
+ *
+ * Returned Value:
+ *   None.
+ *
+ ****************************************************************************/
+
+void esp_board_initialize(void)
+{
+}
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize().  board_late_initialize() will
+ *   be called immediately after up_initialize() is called and just before
+ *   the initial application is started.  This additional initialization
+ *   phase may be used, for example, to initialize board-specific device
+ *   drivers.
+ *
+ * Input Parameters:
+ *   None.
+ *
+ * Returned Value:
+ *   None.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+  /* Perform board-specific initialization */
+
+  esp_bringup();
+}
+#endif
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_bringup.c 
b/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_bringup.c
new file mode 100644
index 00000000000..8c6dcab282e
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_bringup.c
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_bringup.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/debug.h>
+#include <syslog.h>
+#include <sys/types.h>
+
+#include <nuttx/fs/fs.h>
+
+#include "espressif/esp_start.h"
+
+#ifdef CONFIG_I2C_DRIVER
+#  include "esp_board_i2c.h"
+#endif
+
+#include "esp32p4-tab5.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization.
+ *
+ * Input Parameters:
+ *   None.
+ *
+ * Returned Value:
+ *   Zero (OK) is returned on success; A negated errno value is returned on
+ *   any failure.
+ *
+ ****************************************************************************/
+
+int esp_bringup(void)
+{
+  int ret = OK;
+
+#ifdef CONFIG_FS_PROCFS
+  /* Mount the procfs file system */
+
+  ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
+  if (ret < 0)
+    {
+      _err("Failed to mount procfs at /proc: %d\n", ret);
+    }
+#endif
+
+#ifdef CONFIG_I2C_DRIVER
+  /* Configure I2C peripheral interfaces */
+
+  ret = board_i2c_init();
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret);
+    }
+#endif
+
+  /* If we got here then perhaps not all initialization was successful, but
+   * at least enough succeeded to bring-up NSH with perhaps reduced
+   * capabilities.
+   */
+
+  return ret;
+}
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_reset.c 
b/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_reset.c
new file mode 100644
index 00000000000..fb6de0502c2
--- /dev/null
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_reset.c
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_reset.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <assert.h>
+#include <nuttx/debug.h>
+#include <stdlib.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+
+#include "espressif/esp_systemreset.h"
+
+#ifdef CONFIG_BOARDCTL_RESET
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_reset
+ *
+ * Description:
+ *   Reset board.  Support for this function is required by board-level
+ *   logic if CONFIG_BOARDCTL_RESET is selected.
+ *
+ * Input Parameters:
+ *   status - Status information provided with the reset event.  This
+ *            meaning of this status information is board-specific.  If not
+ *            used by a board, the value zero may be provided in calls to
+ *            board_reset().
+ *
+ * Returned Value:
+ *   If this function returns, then it was not possible to power-off the
+ *   board due to some constraints.  The return value in this case is a
+ *   board-specific reason for the failure to shutdown.
+ *
+ ****************************************************************************/
+
+int board_reset(int status)
+{
+  syslog(LOG_INFO, "reboot status=%d\n", status);
+
+  switch (status)
+    {
+      case EXIT_SUCCESS:
+        up_shutdown_handler();
+        break;
+      case CONFIG_BOARD_ASSERT_RESET_VALUE:
+      default:
+        break;
+    }
+
+  up_systemreset();
+
+  return 0;
+}
+
+#endif /* CONFIG_BOARDCTL_RESET */


Reply via email to