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

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

commit 9f89c1c2a698c560182a331dc86019c6af690f05
Author: Marcio Ribeiro <[email protected]>
AuthorDate: Thu Sep 3 15:25:23 2026 -0300

    boards/risc-v/esp32c2/esp8684-devkitm: add ESP8684-DevKitM board
    
    Add NSH bringup for the Espressif ESP8684-DevKitM. The nsh defconfig
    uses a 26 MHz XTAL, 4 MB flash, and debug features for the MINI-1 module.
    
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Marcio Ribeiro <[email protected]>
---
 boards/Kconfig                                     | 12 +++
 .../risc-v/esp32c2/esp8684-devkitm/CMakeLists.txt  | 23 ++++++
 boards/risc-v/esp32c2/esp8684-devkitm/Kconfig      |  8 ++
 .../esp32c2/esp8684-devkitm/configs/nsh/defconfig  | 49 ++++++++++++
 .../risc-v/esp32c2/esp8684-devkitm/include/board.h | 47 +++++++++++
 .../esp32c2/esp8684-devkitm/scripts/Make.defs      | 62 +++++++++++++++
 .../esp32c2/esp8684-devkitm/src/CMakeLists.txt     | 52 +++++++++++++
 .../risc-v/esp32c2/esp8684-devkitm/src/Make.defs   | 33 ++++++++
 .../esp32c2/esp8684-devkitm/src/esp32c2_boot.c     | 91 ++++++++++++++++++++++
 .../esp32c2/esp8684-devkitm/src/esp32c2_bringup.c  | 89 +++++++++++++++++++++
 .../esp32c2/esp8684-devkitm/src/esp32c2_reset.c    | 83 ++++++++++++++++++++
 .../esp32c2/esp8684-devkitm/src/esp8684-devkitm.h  | 63 +++++++++++++++
 12 files changed, 612 insertions(+)

diff --git a/boards/Kconfig b/boards/Kconfig
index fd3b7353602..3acfc7757b6 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -708,6 +708,14 @@ config ARCH_BOARD_ESP32C6_XIAO
                The XIAO-ESP32C6 from Seeed Studio features the ESP32-C6 CPU 
with two RISC-V cores,
                supporting IEEE 802.11 b/g/n/ax WiFi, and Bluetooth 5 (BLE) 
protocols.
 
+config ARCH_BOARD_ESP8684_DEVKITM
+       bool "Espressif ESP8684-DevKitM"
+       depends on ARCH_CHIP_ESP32C2
+       select ARCH_HAVE_BUTTONS
+       select ARCH_HAVE_IRQBUTTONS
+       ---help---
+               The ESP8684-DevKitM features the ESP32-C2 (ESP8684) CPU with a 
RISC-V core.
+
 config ARCH_BOARD_ESP32H2_DEVKIT
        bool "Espressif ESP32-H2 Generic DevKit"
        depends on ARCH_CHIP_ESP32H2
@@ -3982,6 +3990,7 @@ config ARCH_BOARD
        default "esp32c6-devkitc"              if ARCH_BOARD_ESP32C6_DEVKITC
        default "esp32c6-devkitm"              if ARCH_BOARD_ESP32C6_DEVKITM
        default "esp32c6-xiao"                 if ARCH_BOARD_ESP32C6_XIAO
+       default "esp8684-devkitm"              if ARCH_BOARD_ESP8684_DEVKITM
        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
@@ -5403,6 +5412,9 @@ endif
 #if ARCH_BOARD_ESP32C6_XIAO
 #source "boards/risc-v/esp32c6/esp32c6-xiao/Kconfig"
 #endif
+if ARCH_BOARD_ESP8684_DEVKITM
+source "boards/risc-v/esp32c2/esp8684-devkitm/Kconfig"
+endif
 if ARCH_BOARD_ESP32H2_DEVKIT
 source "boards/risc-v/esp32h2/esp32h2-devkit/Kconfig"
 endif
diff --git a/boards/risc-v/esp32c2/esp8684-devkitm/CMakeLists.txt 
b/boards/risc-v/esp32c2/esp8684-devkitm/CMakeLists.txt
new file mode 100644
index 00000000000..b4d1f247df9
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/CMakeLists.txt
@@ -0,0 +1,23 @@
+# 
##############################################################################
+# boards/risc-v/esp32c2/esp8684-devkitm/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/esp32c2/esp8684-devkitm/Kconfig 
b/boards/risc-v/esp32c2/esp8684-devkitm/Kconfig
new file mode 100644
index 00000000000..c1ab420543e
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/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_ESP8684_DEVKITM
+
+endif # ARCH_BOARD_ESP8684_DEVKITM
diff --git a/boards/risc-v/esp32c2/esp8684-devkitm/configs/nsh/defconfig 
b/boards/risc-v/esp32c2/esp8684-devkitm/configs/nsh/defconfig
new file mode 100644
index 00000000000..7e101c5582f
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/configs/nsh/defconfig
@@ -0,0 +1,49 @@
+#
+# 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="esp8684-devkitm"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP8684_DEVKITM=y
+CONFIG_ARCH_CHIP="esp32c2"
+CONFIG_ARCH_CHIP_ESP32C2=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=12000
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_ESPRESSIF_FLASH_4M=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_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_NSH=y
+CONFIG_TESTING_GETPRIME=y
+CONFIG_TESTING_OSTEST=y
+CONFIG_UART0_SERIAL_CONSOLE=y
diff --git a/boards/risc-v/esp32c2/esp8684-devkitm/include/board.h 
b/boards/risc-v/esp32c2/esp8684-devkitm/include/board.h
new file mode 100644
index 00000000000..5de3cf7fa37
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/include/board.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+ * boards/risc-v/esp32c2/esp8684-devkitm/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_ESP32C2_ESP8684_DEVKITM_INCLUDE_BOARD_H
+#define __BOARDS_RISCV_ESP32C2_ESP8684_DEVKITM_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* GPIO pins used by the GPIO Subsystem */
+
+#define BOARD_NGPIOOUT    3 /* Amount of GPIO Output pins (RGB LEDs) */
+#define BOARD_NGPIOINT    1 /* Amount of GPIO Input w/ Interruption pins */
+
+/* ESP8684-DevKitM GPIOs ****************************************************/
+
+/* BOOT Button */
+
+#define BUTTON_BOOT       9
+
+/* On-board RGB LEDs */
+
+#define LED_RED           0
+#define LED_GREEN         1
+#define LED_BLUE          8
+
+#endif /* __BOARDS_RISCV_ESP32C2_ESP8684_DEVKITM_INCLUDE_BOARD_H */
diff --git a/boards/risc-v/esp32c2/esp8684-devkitm/scripts/Make.defs 
b/boards/risc-v/esp32c2/esp8684-devkitm/scripts/Make.defs
new file mode 100644
index 00000000000..7ca38b6d604
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/scripts/Make.defs
@@ -0,0 +1,62 @@
+############################################################################
+# boards/risc-v/esp32c2/esp8684-devkitm/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)
+
+ifeq ($(CONFIG_ESPRESSIF_BOOTLOADER_MCUBOOT),y)
+  ARCHSCRIPT += $(call FINDSCRIPT,$(CHIP_SERIES)_sections.ld)
+else ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
+  ARCHSCRIPT += $(call FINDSCRIPT,$(CHIP_SERIES)_sections.ld)
+else
+  ARCHSCRIPT += $(call FINDSCRIPT,$(CHIP_SERIES)_legacy_sections.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/esp32c2/esp8684-devkitm/src/CMakeLists.txt 
b/boards/risc-v/esp32c2/esp8684-devkitm/src/CMakeLists.txt
new file mode 100644
index 00000000000..383a4600b7d
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/src/CMakeLists.txt
@@ -0,0 +1,52 @@
+# 
##############################################################################
+# boards/risc-v/esp32c2/esp8684-devkitm/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 esp32c2_boot.c esp32c2_bringup.c)
+
+if(CONFIG_BOARDCTL)
+  if(CONFIG_BOARDCTL_RESET)
+    list(APPEND SRCS esp32c2_reset.c)
+  endif()
+endif()
+
+target_sources(board PRIVATE ${SRCS})
+
+# 
##############################################################################
+# Linker scripts (H2: sections or legacy_sections like C6)
+# 
##############################################################################
+
+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)
+  list(APPEND LDSCRIPTS
+       "${BOARD_COMMON_DIR}/scripts/${CHIP_SERIES}_sections.ld")
+else()
+  list(APPEND LDSCRIPTS
+       "${BOARD_COMMON_DIR}/scripts/${CHIP_SERIES}_legacy_sections.ld")
+endif()
+
+set_property(GLOBAL APPEND PROPERTY LD_SCRIPT ${LDSCRIPTS})
diff --git a/boards/risc-v/esp32c2/esp8684-devkitm/src/Make.defs 
b/boards/risc-v/esp32c2/esp8684-devkitm/src/Make.defs
new file mode 100644
index 00000000000..ab8a7d39f1c
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/src/Make.defs
@@ -0,0 +1,33 @@
+#############################################################################
+# boards/risc-v/esp32c2/esp8684-devkitm/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 = esp32c2_boot.c esp32c2_bringup.c
+
+ifeq ($(CONFIG_BOARDCTL_RESET),y)
+  CSRCS += esp32c2_reset.c
+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/esp32c2/esp8684-devkitm/src/esp32c2_boot.c 
b/boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_boot.c
new file mode 100644
index 00000000000..8496076d9b4
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_boot.c
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_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 "esp8684-devkitm.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/esp32c2/esp8684-devkitm/src/esp32c2_bringup.c 
b/boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_bringup.c
new file mode 100644
index 00000000000..ed8ef967dd8
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_bringup.c
@@ -0,0 +1,89 @@
+/****************************************************************************
+ * boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_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 "esp8684-devkitm.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization.
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ * 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_FS_TMPFS
+  /* Mount the tmpfs file system */
+
+  ret = nx_mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL);
+  if (ret < 0)
+    {
+      _err("Failed to mount tmpfs at %s: %d\n", CONFIG_LIBC_TMPDIR, 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/esp32c2/esp8684-devkitm/src/esp32c2_reset.c 
b/boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_reset.c
new file mode 100644
index 00000000000..0ad15d83015
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_reset.c
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * boards/risc-v/esp32c2/esp8684-devkitm/src/esp32c2_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 */
diff --git a/boards/risc-v/esp32c2/esp8684-devkitm/src/esp8684-devkitm.h 
b/boards/risc-v/esp32c2/esp8684-devkitm/src/esp8684-devkitm.h
new file mode 100644
index 00000000000..f8617989bab
--- /dev/null
+++ b/boards/risc-v/esp32c2/esp8684-devkitm/src/esp8684-devkitm.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+ * boards/risc-v/esp32c2/esp8684-devkitm/src/esp8684-devkitm.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_ESP32C2_ESP8684_DEVKITM_SRC_ESP8684_DEVKITM_H
+#define __BOARDS_RISCV_ESP32C2_ESP8684_DEVKITM_SRC_ESP8684_DEVKITM_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization.
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ * 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_ESP32C2_ESP8684_DEVKITM_SRC_ESP8684_DEVKITM_H */

Reply via email to