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
commit 35f93f4c57bcf4b377dc71337559cab320848977 Author: Alan Carvalho de Assis <[email protected]> AuthorDate: Sun Aug 16 12:10:00 2026 -0300 boards/esp32s3: Add support to Waveshare esp32s3-touch-lcd-7 This commit adds basic support to Waveshare ESP32-S3-Touch-LCD-7 board. No AI used here. Signed-off-by: Alan C. Assis <[email protected]> --- boards/Kconfig | 14 +++ boards/xtensa/esp32s3/esp32s3-touch-lcd7/Kconfig | 8 ++ .../esp32s3-touch-lcd7/configs/usbnsh/defconfig | 53 +++++++++ .../esp32s3/esp32s3-touch-lcd7/include/board.h | 54 ++++++++++ .../esp32s3-touch-lcd7/include/board_memorymap.h | 118 +++++++++++++++++++++ .../esp32s3/esp32s3-touch-lcd7/scripts/Make.defs | 71 +++++++++++++ .../esp32s3/esp32s3-touch-lcd7/src/Make.defs | 32 ++++++ .../esp32s3-touch-lcd7/src/esp32s3-touch-lcd7.h | 66 ++++++++++++ .../esp32s3/esp32s3-touch-lcd7/src/esp32s3_boot.c | 85 +++++++++++++++ .../esp32s3-touch-lcd7/src/esp32s3_bringup.c | 107 +++++++++++++++++++ .../esp32s3/esp32s3-touch-lcd7/src/esp32s3_reset.c | 87 +++++++++++++++ 11 files changed, 695 insertions(+) diff --git a/boards/Kconfig b/boards/Kconfig index 784b2c06286..b53f5edac94 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -625,6 +625,16 @@ config ARCH_BOARD_ESP32S3_LCKFB_SZPI select ARCH_HAVE_BUTTONS select ARCH_HAVE_IRQBUTTONS if ESPRESSIF_GPIO_IRQ +config ARCH_BOARD_ESP32S3_TOUCH_LCD_7 + bool "Waveshare ESP32-S3-Touch-LCD-7" + depends on ARCH_CHIP_ESP32S3WROOM1N16R8 + select ARCH_HAVE_BUTTONS + select ARCH_HAVE_IRQBUTTONS if ESPRESSIF_GPIO_IRQ + ---help--- + The Waveshare ESP32-S3-Touch-LCD-7 board features the ESP32-S3 + CPU with dual Xtensa LX7 cores, 7" LCD with Touchscreen, CAN, + RS485, USB, etc. + config ARCH_BOARD_ESP32S3_WS_LCD128 bool "WaveShare ESP32-S3-(Touch)-LCD-1.28" depends on ARCH_CHIP_ESP32S3CUSTOM @@ -3795,6 +3805,7 @@ config ARCH_BOARD default "esp32s3-box" if ARCH_BOARD_ESP32S3_BOX default "esp32s3-korvo-2" if ARCH_BOARD_ESP32S3_KORVO_2 default "lckfb-szpi-esp32s3" if ARCH_BOARD_ESP32S3_LCKFB_SZPI + default "esp32s3-touch-lcd7" if ARCH_BOARD_ESP32S3_TOUCH_LCD_7 default "esp32s3-ws-lcd128" if ARCH_BOARD_ESP32S3_WS_LCD128 default "esp32c6-devkitc" if ARCH_BOARD_ESP32C6_DEVKITC default "esp32c6-devkitm" if ARCH_BOARD_ESP32C6_DEVKITM @@ -5134,6 +5145,9 @@ endif if ARCH_BOARD_ESP32S3_LHCBIT source "boards/xtensa/esp32s3/esp32s3-lhcbit/Kconfig" endif +if ARCH_BOARD_ESP32S3_TOUCH_LCD_7 +source "boards/xtensa/esp32s3/esp32s3-touch-lcd7/Kconfig" +endif if ARCH_BOARD_ESP32S3_WS_LCD128 source "boards/xtensa/esp32s3/esp32s3-ws-lcd128/Kconfig" endif diff --git a/boards/xtensa/esp32s3/esp32s3-touch-lcd7/Kconfig b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/Kconfig new file mode 100644 index 00000000000..e763d2ebc50 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/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_ESP32S3_TOUCH_LCD_7 + +endif # ARCH_BOARD_ESP32S3_TOUCH_LCD_7 diff --git a/boards/xtensa/esp32s3/esp32s3-touch-lcd7/configs/usbnsh/defconfig b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/configs/usbnsh/defconfig new file mode 100644 index 00000000000..601f322f89f --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/configs/usbnsh/defconfig @@ -0,0 +1,53 @@ +# +# 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_DEV_CONSOLE is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="esp32s3-touch-lcd7" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S3_TOUCH_LCD_7=y +CONFIG_ARCH_CHIP="esp32s3" +CONFIG_ARCH_CHIP_ESP32S3=y +CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_IRQ_TO_NDX=y +CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y +CONFIG_ARCH_NUSER_INTERRUPTS=2 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_XTENSA=y +CONFIG_BOARDCTL_USBDEVCTRL=y +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_CDCACM=y +CONFIG_CDCACM_CONSOLE=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_ESP32S3_OTG=y +CONFIG_ESP32S3_UART0=y +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=3072 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=4096 +CONFIG_INTELHEX_BINARY=y +CONFIG_LINE_MAX=64 +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +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_SYSLOG_BUFFER=y +CONFIG_SYSTEM_NSH=y diff --git a/boards/xtensa/esp32s3/esp32s3-touch-lcd7/include/board.h b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/include/board.h new file mode 100644 index 00000000000..d9987e651e6 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/include/board.h @@ -0,0 +1,54 @@ +/**************************************************************************** + * boards/xtensa/esp32s3/esp32s3-touch-lcd7/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_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_INCLUDE_BOARD_H +#define __BOARDS_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_INCLUDE_BOARD_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +/* The ESP32-S3 DevKit 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 0 + +/* GPIO pins used by the GPIO Subsystem */ + +#define BOARD_NGPIOOUT 1 /* Amount of GPIO Output pins */ +#define BOARD_NGPIOIN 1 /* Amount of GPIO Input without Interruption */ +#define BOARD_NGPIOINT 1 /* Amount of GPIO Input w/ Interruption pins */ + +#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_INCLUDE_BOARD_H */ diff --git a/boards/xtensa/esp32s3/esp32s3-touch-lcd7/include/board_memorymap.h b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/include/board_memorymap.h new file mode 100644 index 00000000000..467355805dc --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/include/board_memorymap.h @@ -0,0 +1,118 @@ +/**************************************************************************** + * boards/xtensa/esp32s3/esp32s3-touch-lcd7/include/board_memorymap.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_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_INCLUDE_BOARD_MEMORYMAP_H +#define __BOARDS_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_INCLUDE_BOARD_MEMORYMAP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <stdint.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Kernel ROM */ + +#define KIROM_START (uintptr_t)__kirom_start +#define KIROM_SIZE (uintptr_t)__kirom_size +#define KDROM_START (uintptr_t)__kdrom_start +#define KDROM_SIZE (uintptr_t)__kdrom_size + +/* Kernel RAM */ + +#define KIRAM_START (uintptr_t)__kiram_start +#define KIRAM_SIZE (uintptr_t)__kiram_size +#define KIRAM_END (uintptr_t)__kiram_end +#define KDRAM_START (uintptr_t)__kdram_start +#define KDRAM_SIZE (uintptr_t)__kdram_size +#define KDRAM_END (uintptr_t)__kdram_end + +/* Exception vectors */ + +#define VECTORS_START (uintptr_t)__vectors_start +#define VECTORS_END (uintptr_t)__vectors_end + +/* User ROM */ + +#define UIROM_START (uintptr_t)__uirom_start +#define UIROM_SIZE (uintptr_t)__uirom_size +#define UIROM_END (uintptr_t)__uirom_end +#define UDROM_START (uintptr_t)__udrom_start +#define UDROM_SIZE (uintptr_t)__udrom_size +#define UDROM_END (uintptr_t)__udrom_end + +/* User RAM */ + +#define UIRAM_START (uintptr_t)__uiram_start +#define UIRAM_SIZE (uintptr_t)__uiram_size +#define UIRAM_END (uintptr_t)__uiram_end +#define UDRAM_START (uintptr_t)__udram_start +#define UDRAM_SIZE (uintptr_t)__udram_size +#define UDRAM_END (uintptr_t)__udram_end + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* Kernel ROM (RX) */ + +extern uint8_t __kirom_start[]; +extern uint8_t __kirom_size[]; +extern uint8_t __kdrom_start[]; +extern uint8_t __kdrom_size[]; + +/* Kernel RAM (RW) */ + +extern uint8_t __kiram_start[]; +extern uint8_t __kiram_size[]; +extern uint8_t __kiram_end[]; +extern uint8_t __kdram_start[]; +extern uint8_t __kdram_size[]; +extern uint8_t __kdram_end[]; + +/* Exception vectors */ + +extern uint8_t __vectors_start[]; +extern uint8_t __vectors_end[]; + +/* User ROM (RX) */ + +extern uint8_t __uirom_start[]; +extern uint8_t __uirom_size[]; +extern uint8_t __uirom_end[]; +extern uint8_t __udrom_start[]; +extern uint8_t __udrom_size[]; +extern uint8_t __udrom_end[]; + +/* User RAM (RW) */ + +extern uint8_t __uiram_start[]; +extern uint8_t __uiram_size[]; +extern uint8_t __uiram_end[]; +extern uint8_t __udram_start[]; +extern uint8_t __udram_size[]; +extern uint8_t __udram_end[]; + +#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_INCLUDE_BOARD_MEMORYMAP_H */ diff --git a/boards/xtensa/esp32s3/esp32s3-touch-lcd7/scripts/Make.defs b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/scripts/Make.defs new file mode 100644 index 00000000000..3ee8f4a3852 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/scripts/Make.defs @@ -0,0 +1,71 @@ +############################################################################ +# boards/xtensa/esp32s3/esp32s3-touch-lcd7/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/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_aliases.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) + ifneq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y) + ARCHSCRIPT += $(call FINDSCRIPT,esp32s3_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif +endif + +ifneq ($(CONFIG_DEBUG_NOOPT),y) + ARCHOPTIMIZATION += -fno-strength-reduce +endif + + +CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +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/elf/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/elf/gnu-elf.ld) diff --git a/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/Make.defs b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/Make.defs new file mode 100644 index 00000000000..152d8d79276 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/Make.defs @@ -0,0 +1,32 @@ +############################################################################ +# boards/xtensa/esp32s3/esp32s3-touch-lcd7/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. +# +############################################################################ + +CSRCS = esp32s3_boot.c esp32s3_bringup.c + +ifeq ($(CONFIG_BOARDCTL_RESET),y) +CSRCS += esp32s3_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/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3-touch-lcd7.h b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3-touch-lcd7.h new file mode 100644 index 00000000000..7f63afbf247 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3-touch-lcd7.h @@ -0,0 +1,66 @@ +/**************************************************************************** + * boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3-touch-lcd7.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_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_SRC_ESP32S3_TOUCH_LCD7_H +#define __BOARDS_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_SRC_ESP32S3_TOUCH_LCD7_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(). + * + ****************************************************************************/ + +int esp32s3_bringup(void); + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_TOUCH_LCD7_SRC_ESP32S3_TOUCH_LCD7_H */ diff --git a/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_boot.c b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_boot.c new file mode 100644 index 00000000000..1ff2ef71bf5 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_boot.c @@ -0,0 +1,85 @@ +/**************************************************************************** + * boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_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 <nuttx/debug.h> + +#include <nuttx/board.h> +#include <nuttx/mm/mm.h> +#include <arch/board/board.h> + +#include "esp32s3-touch-lcd7.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-touch-lcd7/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_bringup.c new file mode 100644 index 00000000000..63caf1f6a7f --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_bringup.c @@ -0,0 +1,107 @@ +/**************************************************************************** + * boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_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 <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <syslog.h> +#include <sys/stat.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <nuttx/debug.h> + +#include <errno.h> +#include <nuttx/fs/fs.h> +#include <nuttx/himem/himem.h> +#include <arch/board/board.h> + +#include "espressif/esp_gpio.h" +#include "esp32s3_start.h" + +#ifdef CONFIG_ESPRESSIF_HR_TIMER +# include "espressif/esp_hr_timer.h" +#endif + +#include "esp32s3-touch-lcd7.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: esp32s3_bringup + * + * Description: + * Perform architecture-specific initialization + * + * CONFIG_BOARD_LATE_INITIALIZE=y : + * Called from board_late_initialize(). + * + ****************************************************************************/ + +int esp32s3_bringup(void) +{ + int ret; + +#ifdef CONFIG_ESPRESSIF_HR_TIMER + ret = esp_hr_timer_init(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: esp_hr_timer_init() failed: %d\n", ret); + } +#endif + +#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 + + /* 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-touch-lcd7/src/esp32s3_reset.c b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_reset.c new file mode 100644 index 00000000000..bbbc7d9fdaf --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_reset.c @@ -0,0 +1,87 @@ +/**************************************************************************** + * boards/xtensa/esp32s3/esp32s3-touch-lcd7/src/esp32s3_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 <stdlib.h> +#include <nuttx/debug.h> +#include <assert.h> +#include <nuttx/arch.h> +#include <nuttx/board.h> + +#include "esp32s3_systemreset.h" + +#ifdef CONFIG_BOARDCTL_RESET + +#if CONFIG_BOARD_ASSERT_RESET_VALUE == EXIT_SUCCESS +# error "CONFIG_BOARD_ASSERT_RESET_VALUE must not be equal to EXIT_SUCCESS" +#endif + +/**************************************************************************** + * 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: + break; + default: + break; + } + + up_systemreset(); + + return 0; +} + +#endif /* CONFIG_BOARDCTL_RESET */
