boards/esp32s3: Add initial support to the ESP32-S3-Korvo-2 board

The ESP32-S3-Korvo-2 is a multimedia development board based on the
ESP32-S3 chip. It is equipped with a two-microphone array which is
suitable for voice recognition and near/far-field voice wake-up
applications. The board integrates multiple peripherals such as
LCD, camera, and microSD card. It also supports JPEG video stream
processing. With all of its outstanding features, the board is an
ideal choice for the development of low-cost and low-power
network-connected audio and video products.
This commit is contained in:
Tiago Medicci
2024-07-29 12:05:53 -03:00
committed by Xiang Xiao
parent 54b27c3d32
commit 93322a50fe
35 changed files with 2942 additions and 2 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 KiB

File diff suppressed because it is too large Load Diff
+21 -2
View File
@@ -314,7 +314,7 @@ config ARCH_BOARD_ESP32_2432S028
depends on ARCH_CHIP_ESP32WROVER
---help---
ESP32-2432S028 is an ESP32 board with LCD Display, LED RGB and SD Cards.
config ARCH_BOARD_LILYGO_TBEAM_LORA_GPS
bool "LilyGO TBeam V1.1 LoRa/GPS"
depends on ARCH_CHIP_ESP32WROOM32
@@ -477,6 +477,21 @@ config ARCH_BOARD_ESP32S3_BOX
these development boards cater to both prototyping new projects and building complex
IoT systems, providing a perfect balance of form and function.
config ARCH_BOARD_ESP32S3_KORVO_2
bool "Espressif ESP32-S3-Korvo-2 Board"
depends on ARCH_CHIP_ESP32S3WROOM1N16R8 || ARCH_CHIP_ESP32S3WROOM1N8R8
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS if ESP32S3_GPIO_IRQ
---help---
The ESP32-S3-Korvo-2 is a multimedia development board based on the ESP32-S3 chip.
It is equipped with a two-microphone array which is suitable for voice recognition
and near/far-field voice wake-up applications. The board integrates multiple
peripherals such as LCD, camera, and microSD card. It also supports JPEG video
stream processing. With all of its outstanding features, the board is an ideal
choice for the development of low-cost and low-power network-connected audio and
video products.
config ARCH_BOARD_ESP32S3_MEADOW
bool "WildernessLabs ESP32S3-Meadow Board"
depends on ARCH_CHIP_ESP32S3WROOM1N4 || ARCH_CHIP_ESP32S3CUSTOM
@@ -2211,7 +2226,7 @@ config ARCH_BOARD_ZCU111
---help---
This options selects support for NuttX on XilinX ZCU111 board
based on XCZU28DR SoC with ARM Cortex-A53
config ARCH_BOARD_SAMA5D2_XULT
bool "Atmel SAMA5D2 Xplained Ultra development board"
depends on ARCH_CHIP_ATSAMA5D27
@@ -3229,6 +3244,7 @@ config ARCH_BOARD
default "esp32s3-meadow" if ARCH_BOARD_ESP32S3_MEADOW
default "esp32s3-lcd-ev" if ARCH_BOARD_ESP32S3_LCD_EV
default "esp32s3-box" if ARCH_BOARD_ESP32S3_BOX
default "esp32s3-korvo-2" if ARCH_BOARD_ESP32S3_KORVO_2
default "esp32c6-devkitc" if ARCH_BOARD_ESP32C6_DEVKITC
default "esp32c6-devkitm" if ARCH_BOARD_ESP32C6_DEVKITM
default "esp32h2-devkit" if ARCH_BOARD_ESP32H2_DEVKIT
@@ -4375,6 +4391,9 @@ endif
if ARCH_BOARD_ESP32S3_BOX
source "boards/xtensa/esp32s3/esp32s3-box/Kconfig"
endif
if ARCH_BOARD_ESP32S3_KORVO_2
source "boards/xtensa/esp32s3/esp32s3-korvo-2/Kconfig"
endif
#if ARCH_BOARD_ESP32C6_DEVKITC
#source "boards/risc-v/esp32c6/esp32c6-devkitc/Kconfig"
#endif
@@ -52,6 +52,10 @@ ifeq ($(CONFIG_AUDIO_CS4344),y)
CSRCS += esp32s3_cs4344.c
endif
ifeq ($(CONFIG_AUDIO_ES8311),y)
CSRCS += esp32s3_es8311.c
endif
ifeq ($(CONFIG_SENSORS_BMP180),y)
CSRCS += esp32s3_board_bmp180.c
endif
@@ -0,0 +1,214 @@
/****************************************************************************
* boards/xtensa/esp32s3/common/src/esp32s3_es8311.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 <stdbool.h>
#include <stdio.h>
#include <debug.h>
#include <assert.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/audio/i2s.h>
#include <nuttx/audio/pcm.h>
#include <nuttx/audio/es8311.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/kmalloc.h>
#include <arch/board/board.h>
#include "esp32s3_i2c.h"
#include "esp32s3_i2s.h"
#if defined(CONFIG_ESP32S3_I2S) && defined(CONFIG_AUDIO_ES8311)
/****************************************************************************
* Private Data
****************************************************************************/
static struct es8311_lower_s g_es8311_lower[2];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_es8311_initialize
*
* Description:
* This function is called by platform-specific, setup logic to configure
* and register the ES8311 device. This function will register the driver
* as /dev/audio/pcm[x] where x is determined by the I2S port number.
*
* Input Parameters:
* i2c_port - The I2C port used for the device
* i2c_addr - The I2C address used by the device
* i2c_freq - The I2C frequency used for the device
* i2s_port - The I2S port used for the device
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
int esp32s3_es8311_initialize(int i2c_port, uint8_t i2c_addr, int i2c_freq,
int i2s_port)
{
struct audio_lowerhalf_s *es8311;
struct i2s_dev_s *i2s;
struct i2c_master_s *i2c;
static bool initialized = false;
int ret;
audinfo("i2c_port %d, i2c_addr %d, i2c_freq %d\n",
i2c_port, i2c_addr, i2c_freq);
/* Have we already initialized? Since we never uninitialize we must
* prevent multiple initializations. This is necessary, for example,
* when the touchscreen example is used as a built-in application in
* NSH and can be called numerous time. It will attempt to initialize
* each time.
*/
if (!initialized)
{
/* Get an instance of the I2S interface for the ES8311 data channel */
i2s = esp32s3_i2sbus_initialize(i2s_port);
if (i2s == NULL)
{
auderr("ERROR: Failed to initialize I2S\n");
ret = -ENODEV;
goto errout;
}
i2c = esp32s3_i2cbus_initialize(i2c_port);
if (i2c == NULL)
{
auderr("ERROR: Failed to initialize I2C%d\n", i2c_port);
ret = -ENODEV;
goto errout;
}
/* Check wheter to enable a simple character driver that supports I2S
* transfers via a read() and write(). The intent of this driver is to
* support I2S testing. It is not an audio driver but does conform to
* some of the buffer management heuristics of an audio driver. It is
* not suitable for use in any real driver application in its current
* form. The i2schar driver will be initialized at /dev/i2schar0
*/
#ifdef CONFIG_AUDIO_I2SCHAR
ret = i2schar_register(i2s, 0);
if (ret < 0)
{
auderr("ERROR: i2schar_register failed: %d\n", ret);
goto errout;
}
#endif
/* Now we can use this I2S interface to initialize the ES8311 output
* which will return an audio interface.
*/
g_es8311_lower[0].address = i2c_addr;
g_es8311_lower[0].frequency = i2c_freq;
es8311 = es8311_initialize(i2c, i2s, &g_es8311_lower[0]);
if (es8311 == NULL)
{
auderr("ERROR: Failed to initialize the ES8311\n");
ret = -ENODEV;
goto errout;
}
#ifdef CONFIG_SYSTEM_NXLOOPER
/* If nxlooper is selected, the playback buffer is not rendered as
* a WAV file. Therefore, PCM decode will fail while processing such
* output buffer. In such a case, we bypass the PCM decode.
*/
ret = audio_register("pcm0", es8311);
#else
/* Now we can embed the ES8311/I2S conglomerate into a PCM decoder
* instance so that we will have a PCM front end for the the ES8311
* driver.
*/
struct audio_lowerhalf_s *pcm = pcm_decode_initialize(es8311);
if (pcm == NULL)
{
auderr("ERROR: Failed create the PCM decoder\n");
ret = -ENODEV;
goto errout;
}
/* Finally, we can register the PCM/ES8311/I2S audio device. */
ret = audio_register("pcm0", pcm);
#endif
if (ret < 0)
{
auderr("ERROR: Failed to register /dev/pcm0 device: %d\n", ret);
goto errout;
}
/* Now we can use this I2S interface to initialize the ES8311 input
* which will return an audio interface.
*/
g_es8311_lower[1].address = i2c_addr;
g_es8311_lower[1].frequency = i2c_freq;
es8311 = es8311_initialize(i2c, i2s, &g_es8311_lower[1]);
if (es8311 == NULL)
{
auderr("ERROR: Failed to initialize the ES8311\n");
ret = -ENODEV;
goto errout;
}
/* Finally, we can register the PCM/ES8311/I2S audio device. */
ret = audio_register("pcm_in0", es8311);
if (ret < 0)
{
auderr("ERROR: Failed to register /dev/pcm_in0 device: %d\n", ret);
goto errout;
}
/* Now we are initialized */
initialized = true;
}
return OK;
errout:
return ret;
}
#endif /* CONFIG_ESP32S3_I2S && CONFIG_AUDIO_ES8311 */
@@ -0,0 +1,60 @@
#
# 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_KORVO_2
config ESP32S3_STORAGE_MTD_OFFSET
hex "Storage MTD base address in SPI Flash"
default 0x180000 if !ESP32S3_HAVE_OTA_PARTITION
default 0x250000 if ESP32S3_HAVE_OTA_PARTITION
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
range 0x0 0x800000 if ESP32S3_FLASH_8M
range 0x0 0x1000000 if ESP32S3_FLASH_16M
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 # ESP32S3_SPIFLASH_FS
config ESP32S3_BOARD_I2C
bool
default y if ESP32S3_I2C0 || ESP32S3_I2C1
endif # ARCH_BOARD_ESP32S3_KORVO_2
@@ -0,0 +1,115 @@
#
# 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_AUDIO_FORMAT_MP3 is not set
# CONFIG_AUDIO_FORMAT_SBC is not set
# CONFIG_ESP32S3_I2S0_RX is not set
# CONFIG_NDEBUG is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-korvo-2"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_KORVO_2=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_AUDIO=y
CONFIG_AUDIO_ES8311=y
CONFIG_AUDIO_EXCLUDE_BALANCE=y
CONFIG_AUDIO_EXCLUDE_FFORWARD=y
CONFIG_AUDIO_EXCLUDE_TONE=y
CONFIG_AUDIO_I2S=y
CONFIG_AUDIO_I2SCHAR=y
CONFIG_AUDIO_NUM_BUFFERS=8
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEV_FIFO_SIZE=20480
CONFIG_DRIVERS_AUDIO=y
CONFIG_DRIVERS_IEEE80211=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_ESP32S3_I2C0=y
CONFIG_ESP32S3_I2C0_SCLPIN=18
CONFIG_ESP32S3_I2C0_SDAPIN=17
CONFIG_ESP32S3_I2S0=y
CONFIG_ESP32S3_I2S0_BCLKPIN=9
CONFIG_ESP32S3_I2S0_DOUTPIN=8
CONFIG_ESP32S3_I2S0_MCLK=y
CONFIG_ESP32S3_I2S0_MCLKPIN=16
CONFIG_ESP32S3_I2S0_WSPIN=45
CONFIG_ESP32S3_I2S=y
CONFIG_ESP32S3_SPIFLASH=y
CONFIG_ESP32S3_SPIFLASH_SPIFFS=y
CONFIG_ESP32S3_SPIRAM=y
CONFIG_ESP32S3_SPIRAM_MODE_OCT=y
CONFIG_ESP32S3_UART0=y
CONFIG_ESP32S3_WIFI=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_I2S_DMADESC_NUM=4
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=4096
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=124
CONFIG_IOB_THROTTLE=24
CONFIG_MM_REGIONS=2
CONFIG_NAME_MAX=48
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETDEV_PHY_IOCTL=y
CONFIG_NETDEV_WIRELESS_IOCTL=y
CONFIG_NETUTILS_CJSON=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ETH_PKTSIZE=1518
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NET_UDP_WRITE_BUFFERS=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_PROMPT_MAX=32
CONFIG_NSH_READLINE=y
CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y
CONFIG_NXPLAYER_MAINTHREAD_STACKSIZE=4096
CONFIG_PIPES=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SMP=y
CONFIG_SMP_NCPUS=2
CONFIG_SPIFFS_NAME_MAX=128
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NXPLAYER=y
CONFIG_SYSTEM_PING=y
CONFIG_TIMER=y
CONFIG_TLS_TASK_NELEM=4
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_WAPI=y
CONFIG_WIRELESS_WAPI_CMDTOOL=y
CONFIG_WIRELESS_WAPI_INITCONF=y
CONFIG_WIRELESS_WAPI_STACKSIZE=4096
@@ -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_ARCH_LEDS is not set
# CONFIG_NDEBUG is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-korvo-2"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_KORVO_2=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_ESP32S3_SPIRAM=y
CONFIG_ESP32S3_SPIRAM_MODE_OCT=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_INTELHEX_BINARY=y
CONFIG_MM_REGIONS=2
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_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
@@ -0,0 +1,117 @@
#
# 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_AUDIO_FORMAT_MP3 is not set
# CONFIG_AUDIO_FORMAT_SBC is not set
# CONFIG_ESP32S3_I2S0_RX is not set
# CONFIG_NDEBUG is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-korvo-2"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_KORVO_2=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_AUDIO=y
CONFIG_AUDIO_ES8311=y
CONFIG_AUDIO_EXCLUDE_BALANCE=y
CONFIG_AUDIO_EXCLUDE_FFORWARD=y
CONFIG_AUDIO_EXCLUDE_TONE=y
CONFIG_AUDIO_FORMAT_RAW=y
CONFIG_AUDIO_I2S=y
CONFIG_AUDIO_I2SCHAR=y
CONFIG_AUDIO_NUM_BUFFERS=8
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEV_FIFO_SIZE=20480
CONFIG_DRIVERS_AUDIO=y
CONFIG_DRIVERS_IEEE80211=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_ESP32S3_I2C0=y
CONFIG_ESP32S3_I2C0_SCLPIN=18
CONFIG_ESP32S3_I2C0_SDAPIN=17
CONFIG_ESP32S3_I2S0=y
CONFIG_ESP32S3_I2S0_BCLKPIN=9
CONFIG_ESP32S3_I2S0_DOUTPIN=8
CONFIG_ESP32S3_I2S0_MCLK=y
CONFIG_ESP32S3_I2S0_MCLKPIN=16
CONFIG_ESP32S3_I2S0_WSPIN=45
CONFIG_ESP32S3_I2S=y
CONFIG_ESP32S3_SPIFLASH=y
CONFIG_ESP32S3_SPIFLASH_SPIFFS=y
CONFIG_ESP32S3_SPIRAM=y
CONFIG_ESP32S3_SPIRAM_MODE_OCT=y
CONFIG_ESP32S3_UART0=y
CONFIG_ESP32S3_WIFI=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_I2S_DMADESC_NUM=4
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=4096
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=124
CONFIG_IOB_THROTTLE=24
CONFIG_MM_REGIONS=2
CONFIG_NAME_MAX=48
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETDEV_PHY_IOCTL=y
CONFIG_NETDEV_WIRELESS_IOCTL=y
CONFIG_NETUTILS_CJSON=y
CONFIG_NETUTILS_RTPTOOLS=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ETH_PKTSIZE=1518
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NET_UDP_WRITE_BUFFERS=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_PROMPT_MAX=32
CONFIG_NSH_READLINE=y
CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y
CONFIG_NXPLAYER_MAINTHREAD_STACKSIZE=4096
CONFIG_PIPES=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SMP=y
CONFIG_SMP_NCPUS=2
CONFIG_SPIFFS_NAME_MAX=128
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NXPLAYER=y
CONFIG_SYSTEM_PING=y
CONFIG_TIMER=y
CONFIG_TLS_TASK_NELEM=4
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_WAPI=y
CONFIG_WIRELESS_WAPI_CMDTOOL=y
CONFIG_WIRELESS_WAPI_INITCONF=y
CONFIG_WIRELESS_WAPI_STACKSIZE=4096
@@ -0,0 +1,47 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/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_KORVO_2_INCLUDE_BOARD_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_INCLUDE_BOARD_H
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Clocking *****************************************************************/
/* The ESP32-S3-Korvo-2 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
/* Peripherals definitions **************************************************/
#ifdef CONFIG_AUDIO_ES8311
# define ES8311_I2C_FREQ 100000
# define ES8311_I2C_ADDR 0x18
#endif
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_INCLUDE_BOARD_H */
@@ -0,0 +1,116 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/include/board_memorymap.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_KORVO_2_INCLUDE_BOARD_MEMORYMAP_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_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_KORVO_2_INCLUDE_BOARD_MEMORYMAP_H */
@@ -0,0 +1,74 @@
############################################################################
# boards/xtensa/esp32s3/esp32s3-korvo-2/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
ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_rom_api.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)
ifeq ($(CONFIG_ESP32S3_APP_FORMAT_MCUBOOT),y)
ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld)
else ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
ARCHSCRIPT += $(call FINDSCRIPT,simple_boot_sections.ld)
else
ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
endif
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)
@@ -0,0 +1,55 @@
############################################################################
# boards/xtensa/esp32s3/esp32s3-korvo-2/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
ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += esp32s3_buttons.c
endif
ifeq ($(CONFIG_ESP32S3_SPI),y)
CSRCS += esp32s3_board_spi.c
endif
ifeq ($(CONFIG_ESP32S3_TWAI),y)
CSRCS += esp32s3_twai.c
endif
ifeq ($(CONFIG_DEV_GPIO),y)
CSRCS += esp32s3_gpio.c
endif
ifeq ($(CONFIG_PWM),y)
CSRCS += esp32s3_ledc.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
@@ -0,0 +1,118 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3-korvo-2.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_KORVO_2_SRC_ESP32S3_KORVO_2_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_SRC_ESP32S3_KORVO_2_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* ESP32-S3-Korvo-2 GPIOs ***************************************************/
/* BOOT Button */
#define BUTTON_BOOT 0
/* I2C Port */
#define I2C_PORT 0
#ifdef CONFIG_AUDIO_ES8311
# define SPEAKER_ENABLE_GPIO 48
#endif
/****************************************************************************
* 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);
/****************************************************************************
* Name: board_spiflash_init
*
* Description:
* Initialize the SPIFLASH and register the MTD device.
*
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPIFLASH
int board_spiflash_init(void);
#endif
/****************************************************************************
* Name: esp32s3_es8311_initialize
*
* Description:
* This function is called by platform-specific, setup logic to configure
* and register the ES8311 device. This function will register the driver
* as /dev/audio/pcm[x] where x is determined by the I2S port number.
*
* Input Parameters:
* i2c_port - The I2C port used for the device
* i2c_addr - The I2C address used by the device
* i2c_freq - The I2C frequency used for the device
* i2s_port - The I2S port used for the device
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_AUDIO_ES8311
int esp32s3_es8311_initialize(int i2c_port, uint8_t i2c_addr, int i2c_freq,
int i2s_port);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_SRC_ESP32S3_KORVO_2_H */
@@ -0,0 +1,80 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/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-korvo-2.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 */
@@ -0,0 +1,126 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_board_spi.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 <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include "esp32s3_gpio.h"
#include "esp32s3-korvo-2.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_spi2_status
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPI2
uint8_t esp32s3_spi2_status(struct spi_dev_s *dev, uint32_t devid)
{
uint8_t status = 0;
return status;
}
#endif
/****************************************************************************
* Name: esp32s3_spi2_cmddata
****************************************************************************/
#if defined(CONFIG_ESP32S3_SPI2) && defined(CONFIG_SPI_CMDDATA)
int esp32s3_spi2_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*/
esp32s3_gpiowrite(GPIO_LCD_DC, !cmd);
return OK;
}
spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
"data");
return -ENODEV;
}
#endif
/****************************************************************************
* Name: esp32s3_spi3_status
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPI3
uint8_t esp32s3_spi3_status(struct spi_dev_s *dev, uint32_t devid)
{
uint8_t status = 0;
return status;
}
#endif
/****************************************************************************
* Name: esp32s3_spi3_cmddata
****************************************************************************/
#if defined(CONFIG_ESP32S3_SPI3) && defined(CONFIG_SPI_CMDDATA)
int esp32s3_spi3_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*/
esp32s3_gpiowrite(CONFIG_ESP32S3_SPI3_MISOPIN, !cmd);
return OK;
}
spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
"data");
return -ENODEV;
}
#endif
@@ -0,0 +1,83 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/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-korvo-2.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
@@ -0,0 +1,452 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/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>
#include <arch/board/board.h>
#include "esp32s3_gpio.h"
#ifdef CONFIG_ESP32S3_TIMER
# include "esp32s3_board_tim.h"
#endif
#ifdef CONFIG_ESP32S3_WIFI
# include "esp32s3_board_wlan.h"
#endif
#ifdef CONFIG_ESP32S3_BLE
# include "esp32s3_ble.h"
#endif
#ifdef CONFIG_ESP32S3_WIFI_BT_COEXIST
# include "esp32s3_wifi_adapter.h"
#endif
#ifdef CONFIG_ESP32S3_RT_TIMER
# include "esp32s3_rt_timer.h"
#endif
#ifdef CONFIG_ESP32S3_I2C
# include "esp32s3_i2c.h"
#endif
#ifdef CONFIG_ESP32S3_I2S
# include "esp32s3_i2s.h"
#endif
#ifdef CONFIG_WATCHDOG
# include "esp32s3_board_wdt.h"
#endif
#ifdef CONFIG_INPUT_BUTTONS
# include <nuttx/input/buttons.h>
#endif
#ifdef CONFIG_RTC_DRIVER
# include "esp32s3_rtc_lowerhalf.h"
#endif
#ifdef CONFIG_ESP32S3_EFUSE
# include "esp32s3_efuse.h"
#endif
#ifdef CONFIG_ESP32S3_LEDC
# include "esp32s3_ledc.h"
#endif
#ifdef CONFIG_ESP32S3_PARTITION_TABLE
# include "esp32s3_partition.h"
#endif
#ifdef CONFIG_ESP_RMT
# include "esp32s3_board_rmt.h"
#endif
#ifdef CONFIG_ESP_MCPWM
# include "esp32s3_board_mcpwm.h"
#endif
#ifdef CONFIG_ESP32S3_SPI
#include "esp32s3_spi.h"
#include "esp32s3_board_spidev.h"
#endif
#ifdef CONFIG_ESP32S3_AES_ACCELERATOR
# include "esp32s3_aes.h"
#endif
#ifdef CONFIG_ESP32S3_ADC
#include "esp32s3_board_adc.h"
#endif
#include "esp32s3-korvo-2.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;
#if (defined(CONFIG_ESP32S3_I2S0) && !defined(CONFIG_AUDIO_CS4344) && \
!defined(CONFIG_AUDIO_ES8311)) || defined(CONFIG_ESP32S3_I2S1)
bool i2s_enable_tx;
bool i2s_enable_rx;
#endif
#if defined(CONFIG_ESP32S3_SPIRAM) && \
defined(CONFIG_ESP32S3_SPIRAM_BANKSWITCH_ENABLE)
ret = esp_himem_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init HIMEM: %d\n", ret);
}
#endif
#if defined(CONFIG_ESP32S3_SPI) && defined(CONFIG_SPI_DRIVER)
#ifdef CONFIG_ESP32S3_SPI2
ret = board_spidev_initialize(ESP32S3_SPI2);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init spidev 2: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP32S3_SPI3
ret = board_spidev_initialize(ESP32S3_SPI3);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init spidev 3: %d\n", ret);
}
#endif
#endif
#if defined(CONFIG_ESP32S3_EFUSE)
ret = esp32s3_efuse_initialize("/dev/efuse");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init EFUSE: %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
#ifdef CONFIG_ESP32S3_LEDC
ret = esp32s3_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: esp32s3_pwm_setup() failed: %d\n", ret);
}
#endif /* CONFIG_ESP32S3_LEDC */
#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_SPIFLASH
ret = board_spiflash_init();
if (ret)
{
syslog(LOG_ERR, "ERROR: Failed to initialize SPI Flash\n");
}
#endif
#ifdef CONFIG_ESP32S3_PARTITION_TABLE
ret = esp32s3_partition_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize partition error=%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_ESP_RMT
ret = board_rmt_txinitialize(RMT_TXCHANNEL, RMT_OUTPUT_PIN);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_rmt_txinitialize() failed: %d\n", ret);
}
ret = board_rmt_rxinitialize(RMT_RXCHANNEL, RMT_INPUT_PIN);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_rmt_txinitialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_RTC_DRIVER
/* Instantiate the ESP32-S3 RTC driver */
ret = esp32s3_rtc_driverinit();
if (ret < 0)
{
syslog(LOG_ERR,
"ERROR: Failed to Instantiate the RTC driver: %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_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
#ifdef CONFIG_ESP32S3_TWAI
/* Initialize TWAI and register the TWAI driver. */
ret = esp32s3_twai_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: esp32s3_twai_setup failed: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP32S3_I2S
# ifdef CONFIG_ESP32S3_I2S0
# ifdef CONFIG_AUDIO_ES8311
/* Configure ES8311 audio on I2C0 and I2S0 */
esp32s3_configgpio(SPEAKER_ENABLE_GPIO, OUTPUT);
esp32s3_gpiowrite(SPEAKER_ENABLE_GPIO, true);
ret = esp32s3_es8311_initialize(ESP32S3_I2C0, ES8311_I2C_ADDR,
ES8311_I2C_FREQ, ESP32S3_I2S0);
if (ret != OK)
{
syslog(LOG_ERR, "Failed to initialize ES8311 audio: %d\n", ret);
}
# else
# ifdef CONFIG_ESP32S3_I2S0_TX
i2s_enable_tx = true;
# else
i2s_enable_tx = false;
# endif /* CONFIG_ESP32S3_I2S0_TX */
# ifdef CONFIG_ESP32S3_I2S0_RX
i2s_enable_rx = true;
# else
i2s_enable_rx = false;
# endif /* CONFIG_ESP32S3_I2S0_RX */
/* Configure I2S generic audio on I2S0 */
ret = board_i2sdev_initialize(ESP32S3_I2S0, i2s_enable_tx, i2s_enable_rx);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2S0 driver: %d\n", ret);
}
# endif /* CONFIG_AUDIO_ES8311 */
# endif /* CONFIG_ESP32S3_I2S0 */
# ifdef CONFIG_ESP32S3_I2S1
# ifdef CONFIG_ESP32S3_I2S1_TX
i2s_enable_tx = true;
# else
i2s_enable_tx = false;
# endif /* CONFIG_ESP32S3_I2S1_TX */
# ifdef CONFIG_ESP32S3_I2S1_RX
i2s_enable_rx = true;
# else
i2s_enable_rx = false;
# endif /* CONFIG_ESP32S3_I2S1_RX */
/* Configure I2S generic audio on I2S1 */
ret = board_i2sdev_initialize(ESP32S3_I2S1, i2s_enable_tx, i2s_enable_rx);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2S%d driver: %d\n",
CONFIG_ESP32S3_I2S1, ret);
}
# endif /* CONFIG_ESP32S3_I2S1 */
#endif /* CONFIG_ESP32S3_I2S */
#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_WIRELESS
#ifdef CONFIG_ESP32S3_WIFI_BT_COEXIST
ret = esp32s3_wifi_bt_coexist_init();
if (ret)
{
syslog(LOG_ERR, "ERROR: Failed to initialize Wi-Fi and BT coexist\n");
}
#endif
#ifdef CONFIG_ESP32S3_BLE
ret = esp32s3_ble_initialize();
if (ret)
{
syslog(LOG_ERR, "ERROR: Failed to initialize BLE\n");
}
#endif
#ifdef CONFIG_ESP32S3_WIFI
ret = board_wlan_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize wireless subsystem=%d\n",
ret);
}
#endif
#endif
#ifdef CONFIG_DEV_GPIO
ret = esp32s3_gpio_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP32S3_AES_ACCELERATOR
ret = esp32s3_aes_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize AES: %d\n", ret);
}
#ifdef CONFIG_ESP32S3_AES_ACCELERATOR_TEST
else
{
esp32s3_aes_test();
}
#endif
#endif
#ifdef CONFIG_ESP32S3_ADC
/* Configure ADC */
ret = board_adc_init();
if (ret)
{
syslog(LOG_ERR, "ERROR: board_adc_init() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP_MCPWM_CAPTURE
ret = board_capture_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_capture_initialize failed: %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.
*/
UNUSED(ret);
return OK;
}
@@ -0,0 +1,164 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_buttons.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 <assert.h>
#include <debug.h>
#include <stdbool.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include "esp32s3_gpio.h"
#include "hardware/esp32s3_gpio_sigmap.h"
#include "esp32s3-korvo-2.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/
uint32_t board_button_initialize(void)
{
esp32s3_configgpio(BUTTON_BOOT, INPUT_FUNCTION_2 | PULLUP);
return 1;
}
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be
* called to collect the state of all buttons. board_buttons() returns an
* 8-bit bit set with each bit associated with a button. See the
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
*
****************************************************************************/
uint32_t board_buttons(void)
{
uint8_t ret = 0;
int i = 0;
int n = 0;
bool b0 = esp32s3_gpioread(BUTTON_BOOT);
for (i = 0; i < 10; i++)
{
up_mdelay(1);
bool b1 = esp32s3_gpioread(BUTTON_BOOT);
if (b0 == b1)
{
n++;
}
else
{
n = 0;
}
if (3 == n)
{
break;
}
b0 = b1;
}
iinfo("b=%d n=%d\n", b0, n);
/* Low value means that the button is pressed */
if (!b0)
{
ret = 0x1;
}
return ret;
}
/****************************************************************************
* Name: board_button_irq
*
* Description:
* board_button_irq() may be called to register an interrupt handler that
* will be called when a button is depressed or released. The ID value is
* a button enumeration value that uniquely identifies a button resource.
* See the BUTTON_* definitions in board.h for the meaning of enumeration
* value.
*
****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS
int board_button_irq(int id, xcpt_t irqhandler, void *arg)
{
int ret;
DEBUGASSERT(id == 0);
int irq = ESP32S3_PIN2IRQ(BUTTON_BOOT);
if (irqhandler != NULL)
{
/* Make sure the interrupt is disabled */
esp32s3_gpioirqdisable(irq);
ret = irq_attach(irq, irqhandler, arg);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: irq_attach() failed: %d\n", ret);
return ret;
}
gpioinfo("Attach %p\n", irqhandler);
gpioinfo("Enabling the interrupt\n");
/* Configure the interrupt for rising and falling edges */
esp32s3_gpioirqenable(irq, CHANGE);
}
else
{
gpioinfo("Disable the interrupt\n");
esp32s3_gpioirqdisable(irq);
}
return OK;
}
#endif
@@ -0,0 +1,85 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-korvo-2/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 <stdlib.h>
#include <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 */