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

pkarashchenko 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 498a24cc54 esp32s3: Add esp32s3-meadow board
498a24cc54 is described below

commit 498a24cc54f1debf015f69f9fb55b63a1e607e81
Author: Alan Carvalho de Assis <acas...@gmail.com>
AuthorDate: Wed Mar 29 16:08:46 2023 -0300

    esp32s3: Add esp32s3-meadow board
---
 boards/Kconfig                                     |  14 ++
 boards/xtensa/esp32s3/esp32s3-meadow/Kconfig       |  51 +++++++
 .../esp32s3/esp32s3-meadow/configs/nsh/defconfig   |  44 ++++++
 .../xtensa/esp32s3/esp32s3-meadow/include/board.h  |  46 ++++++
 .../esp32s3/esp32s3-meadow/scripts/Make.defs       |  66 +++++++++
 boards/xtensa/esp32s3/esp32s3-meadow/src/Make.defs |  35 +++++
 .../esp32s3/esp32s3-meadow/src/esp32s3-meadow.h    |  67 +++++++++
 .../esp32s3/esp32s3-meadow/src/esp32s3_appinit.c   |  80 +++++++++++
 .../esp32s3/esp32s3-meadow/src/esp32s3_boot.c      |  83 +++++++++++
 .../esp32s3/esp32s3-meadow/src/esp32s3_bringup.c   | 155 +++++++++++++++++++++
 .../esp32s3/esp32s3-meadow/src/esp32s3_reset.c     |  63 +++++++++
 11 files changed, 704 insertions(+)

diff --git a/boards/Kconfig b/boards/Kconfig
index 3321ee0419..cb14dac00d 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -423,6 +423,16 @@ config ARCH_BOARD_ESP32S3_EYE
                featuring the ESP32-S3 CPU with a 2-Megapixel camera, an LCD 
display,
                a microphone, an 8 MB Octal PSRAM and an 8 MB flash.
 
+config ARCH_BOARD_ESP32S3_MEADOW
+       bool "WildernessLabs ESP32S3-Meadow Board"
+       depends on ARCH_CHIP_ESP32S3WROOM1
+       select ARCH_HAVE_LEDS
+       select ARCH_HAVE_BUTTONS
+       select ARCH_HAVE_IRQBUTTONS if ESP32S3_GPIO_IRQ
+       ---help---
+               The ESP32-S3-Meadow is a small-sized board produced by 
WildernessLabs
+               featuring the ESP32-S3 CPU with 32MiB Octal SPI PSRAM and 64 
MiB flash.
+
 config ARCH_BOARD_ESP32C6_GENERIC
        bool "Espressif ESP32-C6 Generic DevKit"
        depends on ESPRESSIF_ESP32C6
@@ -2819,6 +2829,7 @@ config ARCH_BOARD
        default "franzininho-wifi"          if ARCH_BOARD_FRANZININHO_WIFI
        default "esp32s3-devkit"            if ARCH_BOARD_ESP32S3_DEVKIT
        default "esp32s3-eye"               if ARCH_BOARD_ESP32S3_EYE
+       default "esp32s3-meadow"            if ARCH_BOARD_ESP32S3_MEADOW
        default "esp32c6-devkit"            if ARCH_BOARD_ESP32C6_DEVKIT
        default "esp32c6-generic"           if ARCH_BOARD_ESP32C6_GENERIC
        default "esp32h2-generic"           if ARCH_BOARD_ESP32H2_GENERIC
@@ -3815,6 +3826,9 @@ endif
 if ARCH_BOARD_ESP32S3_EYE
 source "boards/xtensa/esp32s3/esp32s3-eye/Kconfig"
 endif
+if ARCH_BOARD_ESP32S3_MEADOW
+source "boards/xtensa/esp32s3/esp32s3-meadow/Kconfig"
+endif
 if ARCH_BOARD_ESP32C6_DEVKIT
 source "boards/risc-v/esp32c6/esp32c6-devkit/Kconfig"
 endif
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/Kconfig 
b/boards/xtensa/esp32s3/esp32s3-meadow/Kconfig
new file mode 100644
index 0000000000..3d5cc808aa
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/Kconfig
@@ -0,0 +1,51 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+if ARCH_BOARD_ESP32S3_MEADOW
+
+config ESP32S3_STORAGE_MTD_OFFSET
+       hex "Storage MTD base address in SPI Flash"
+       default 0x180000
+       depends on ESP32S3_MTD
+       ---help---
+               MTD base address in SPI Flash.
+
+config ESP32S3_STORAGE_MTD_SIZE
+       hex "Storage MTD size in SPI Flash"
+       default 0x100000
+       depends on ESP32S3_MTD
+       ---help---
+               MTD size in SPI Flash.
+
+choice ESP32S3_SPIFLASH_FS
+       prompt "Mount SPI Flash MTD on bring-up"
+       default ESP32S3_SPIFLASH_SMARTFS
+       depends on ESP32S3_MTD
+       optional
+       ---help---
+               Mount the SPI Flash MTD with the selected File System format on 
board
+               bring-up.
+               If not selected, the MTD will be registered as a device node on 
/dev.
+
+config ESP32S3_SPIFLASH_SMARTFS
+       bool "SmartFS"
+       select FS_SMARTFS
+       select MTD_SMART
+
+config ESP32S3_SPIFLASH_NXFFS
+       bool "NXFFS"
+       select FS_NXFFS
+
+config ESP32S3_SPIFLASH_SPIFFS
+       bool "SPIFFS"
+       select FS_SPIFFS
+
+config ESP32S3_SPIFLASH_LITTLEFS
+       bool "LittleFS"
+       select FS_LITTLEFS
+
+endchoice
+
+endif # ARCH_BOARD_ESP32S3_MEADOW
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/configs/nsh/defconfig 
b/boards/xtensa/esp32s3/esp32s3-meadow/configs/nsh/defconfig
new file mode 100644
index 0000000000..0a7ae3008e
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/configs/nsh/defconfig
@@ -0,0 +1,44 @@
+#
+# 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_ARCH_LEDS is not set
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="xtensa"
+CONFIG_ARCH_BOARD="esp32s3-meadow"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32S3_MEADOW=y
+CONFIG_ARCH_CHIP="esp32s3"
+CONFIG_ARCH_CHIP_ESP32S3=y
+CONFIG_ARCH_CHIP_ESP32S3WROOM1=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_XTENSA=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_FULLOPT=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEV_ZERO=y
+CONFIG_ESP32S3_GPIO_IRQ=y
+CONFIG_ESP32S3_USBSERIAL=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=3072
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=114688
+CONFIG_RAM_START=0x20000000
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=6
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2011
+CONFIG_SYSTEM_NSH=y
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/include/board.h 
b/boards/xtensa/esp32s3/esp32s3-meadow/include/board.h
new file mode 100644
index 0000000000..d515a17364
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/include/board.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/esp32s3-meadow/include/board.h
+ *
+ * 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_XTENSA_ESP32S3_ESP32S3_MEADOW_INCLUDE_BOARD_H
+#define __BOARDS_XTENSA_ESP32S3_ESP32S3_MEADOW_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Clocking *****************************************************************/
+
+/* The ESP32-S3-MEADOW board is fitted with a 40MHz crystal */
+
+#define BOARD_XTAL_FREQUENCY    40000000
+
+#ifdef CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ
+#  define BOARD_CLOCK_FREQUENCY (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000)
+#else
+#  define BOARD_CLOCK_FREQUENCY 80000000
+#endif
+
+/* LED definitions **********************************************************/
+
+/* Define how many LEDs this board has (needed by userleds) */
+
+#define BOARD_NLEDS             1
+
+#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_MEADOW_INCLUDE_BOARD_H */
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/scripts/Make.defs 
b/boards/xtensa/esp32s3/esp32s3-meadow/scripts/Make.defs
new file mode 100644
index 0000000000..3c937212f3
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/scripts/Make.defs
@@ -0,0 +1,66 @@
+############################################################################
+# boards/xtensa/esp32s3/esp32s3-meadow/scripts/Make.defs
+#
+# 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/esp32s3/Config.mk
+include $(TOPDIR)/arch/xtensa/src/lx7/Toolchain.defs
+
+ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_peripherals.ld
+ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_rom.ld
+
+# Pick the linker scripts from the board level if they exist, if not
+# pick the common linker scripts.
+
+ifeq ($(CONFIG_BUILD_PROTECTED),y)
+  ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld)
+  ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld)
+else
+  ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld)
+  ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
+endif
+
+ifneq ($(CONFIG_DEBUG_NOOPT),y)
+  ARCHOPTIMIZATION += -fno-strength-reduce
+endif
+
+ARCHPICFLAGS = -fpic
+
+CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) 
$(ARCHDEFINES) $(EXTRAFLAGS) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) 
$(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
+AFLAGS := $(CFLAGS) -D__ASSEMBLY__
+
+# Loadable module definitions
+
+CMODULEFLAGS = $(CFLAGS) -mtext-section-literals
+
+LDMODULEFLAGS = -r -e module_initialize
+LDMODULEFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/modlib/gnu-elf.ld)
+
+# ELF module definitions
+
+CELFFLAGS = $(CFLAGS) -mtext-section-literals
+CXXELFFLAGS = $(CXXFLAGS) -mtext-section-literals
+
+LDELFFLAGS = -r -e main
+LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/binfmt/libelf/gnu-elf.ld)
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/src/Make.defs 
b/boards/xtensa/esp32s3/esp32s3-meadow/src/Make.defs
new file mode 100644
index 0000000000..eb58641c8e
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/src/Make.defs
@@ -0,0 +1,35 @@
+############################################################################
+# boards/xtensa/esp32s3/esp32s3-meadow/src/Make.defs
+#
+# 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 = esp32s3_boot.c esp32s3_bringup.c
+
+ifeq ($(CONFIG_BOARDCTL),y)
+CSRCS += esp32s3_appinit.c
+ifeq ($(CONFIG_BOARDCTL_RESET),y)
+CSRCS += esp32s3_reset.c
+endif
+endif
+
+DEPPATH += --dep-path board
+VPATH += :board
+CFLAGS += $(shell $(INCDIR) "$(CC)" 
$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)
+
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3-meadow.h 
b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3-meadow.h
new file mode 100644
index 0000000000..3af7ea469b
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3-meadow.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3-meadow.h
+ *
+ * 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_XTENSA_ESP32S3_ESP32S3_MEADOW_SRC_ESP32S3_MEADOW_H
+#define __BOARDS_XTENSA_ESP32S3_ESP32S3_MEADOW_SRC_ESP32S3_MEADOW_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32s3_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y :
+ *     Called from the NSH library via board_app_initialize()
+ *
+ ****************************************************************************/
+
+int esp32s3_bringup(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_MEADOW_SRC_ESP32S3_MEADOW_H */
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_appinit.c 
b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_appinit.c
new file mode 100644
index 0000000000..bc47ca89c6
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_appinit.c
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_appinit.c
+ *
+ * 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 <sys/types.h>
+#include <nuttx/board.h>
+
+#include "esp32s3-meadow.h"
+
+#ifdef CONFIG_BOARDCTL
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_app_initialize
+ *
+ * Description:
+ *   Perform application specific initialization.  This function is never
+ *   called directly from application code, but only indirectly via the
+ *   (non-standard) boardctl() interface using the command BOARDIOC_INIT.
+ *
+ * Input Parameters:
+ *   arg - The boardctl() argument is passed to the board_app_initialize()
+ *         implementation without modification.  The argument has no
+ *         meaning to NuttX; the meaning of the argument is a contract
+ *         between the board-specific initialization logic and the
+ *         matching application logic.  The value could be such things as a
+ *         mode enumeration value, a set of DIP switch settings, a
+ *         pointer to configuration data read from a file or serial FLASH,
+ *         or whatever you would like to do with it.  Every implementation
+ *         should accept zero/NULL as a default configuration.
+ *
+ * Returned Value:
+ *   Zero (OK) is returned on success; a negated errno value is returned on
+ *   any failure to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int board_app_initialize(uintptr_t arg)
+{
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+  /* Board initialization already performed by board_late_initialize() */
+
+  return OK;
+#else
+  /* Perform board-specific initialization */
+
+  return esp32s3_bringup();
+#endif
+}
+
+#endif /* CONFIG_BOARDCTL */
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_boot.c 
b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_boot.c
new file mode 100644
index 0000000000..566521a9b5
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_boot.c
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_boot.c
+ *
+ * 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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/mm/mm.h>
+#include <arch/board/board.h>
+
+#include "esp32s3-meadow.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32s3_board_initialize
+ *
+ * Description:
+ *   All ESP32-S3 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.
+ *
+ ****************************************************************************/
+
+void esp32s3_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.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+  /* Perform board-specific initialization */
+
+  esp32s3_bringup();
+}
+#endif
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_bringup.c 
b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_bringup.c
new file mode 100644
index 0000000000..0306c9901f
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_bringup.c
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_bringup.c
+ *
+ * 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 <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <syslog.h>
+#include <debug.h>
+#include <stdio.h>
+
+#include <errno.h>
+#include <nuttx/fs/fs.h>
+
+#ifdef CONFIG_ESP32S3_TIMER
+#  include "esp32s3_board_tim.h"
+#endif
+
+#ifdef CONFIG_ESP32S3_RT_TIMER
+#  include "esp32s3_rt_timer.h"
+#endif
+
+#ifdef CONFIG_WATCHDOG
+#  include "esp32s3_board_wdt.h"
+#endif
+
+#ifdef CONFIG_INPUT_BUTTONS
+#  include <nuttx/input/buttons.h>
+#endif
+
+#include "esp32s3-meadow.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32s3_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y :
+ *     Called from the NSH library
+ *
+ ****************************************************************************/
+
+int esp32s3_bringup(void)
+{
+  int ret;
+
+#ifdef CONFIG_FS_PROCFS
+  /* Mount the procfs file system */
+
+  ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: 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)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to mount tmpfs at %s: %d\n",
+             CONFIG_LIBC_TMPDIR, ret);
+    }
+#endif
+
+#ifdef CONFIG_ESP32S3_TIMER
+  /* Configure general purpose timers */
+
+  ret = board_tim_init();
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "Failed to initialize timers: %d\n", ret);
+    }
+#endif
+
+#ifdef CONFIG_ESP32S3_RT_TIMER
+  ret = esp32s3_rt_timer_init();
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "Failed to initialize RT timer: %d\n", ret);
+    }
+#endif
+
+#ifdef CONFIG_WATCHDOG
+  /* Configure watchdog timer */
+
+  ret = board_wdt_init();
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "Failed to initialize watchdog timer: %d\n", ret);
+    }
+#endif
+
+#ifdef CONFIG_INPUT_BUTTONS
+  /* Register the BUTTON driver */
+
+  ret = btn_lower_initialize("/dev/buttons");
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "Failed to initialize button driver: %d\n", ret);
+    }
+#endif
+
+#ifdef CONFIG_ESP32S3_SPIFLASH
+  ret = board_spiflash_init();
+  if (ret)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to initialize SPI Flash\n");
+    }
+#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.
+   */
+
+  UNUSED(ret);
+  return OK;
+}
diff --git a/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_reset.c 
b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_reset.c
new file mode 100644
index 0000000000..b3e45bd3e5
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_reset.c
@@ -0,0 +1,63 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/esp32s3-meadow/src/esp32s3_reset.c
+ *
+ * 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/arch.h>
+#include <nuttx/board.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)
+{
+  up_systemreset();
+
+  return 0;
+}
+
+#endif /* CONFIG_BOARDCTL_RESET */

Reply via email to