boards: xtensa: add M5Stack CoreS3 support

Initial support for M5Statck CoreS3 development board.

Signed-off-by: Zhang Xingtao <zhxt@live.cn>
Co-authored-by: Benjamin Cabé <kartben@gmail.com>
Co-authored-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
Zhang Xingtao 2024-08-06 02:00:01 +08:00 committed by Anas Nashif
commit 0cf866037d
14 changed files with 455 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# Copyright (c) 2024 Zhang Xingtao <zhxt@live.cn>
# SPDX-License-Identifier: Apache-2.0
if BOARD_M5STACK_CORES3_ESP32S3_PROCPU
config HEAP_MEM_POOL_ADD_SIZE_BOARD
int
default $(UINT16_MAX) if WIFI && BT
default 51200 if WIFI
default 40960 if BT
default 4096
endif # BOARD_M5STACK_CORES3_ESP32S3_PROCPU
if BOARD_M5STACK_CORES3_ESP32S3_APPCPU
config HEAP_MEM_POOL_ADD_SIZE_BOARD
int
default 256
endif # BOARD_M5STACK_CORES3_ESP32S3_APPCPU

View file

@ -0,0 +1,9 @@
# M5Stack CoreS3 board configuration
# Copyright (c) 2024 Zhang Xingtao <zhxt@live.cn>
# SPDX-License-Identifier: Apache-2.0
config BOARD_M5STACK_CORES3
select SOC_ESP32S3
select SOC_ESP32S3_PROCPU if BOARD_M5STACK_CORES3_ESP32S3_PROCPU
select SOC_ESP32S3_APPCPU if BOARD_M5STACK_CORES3_ESP32S3_APPCPU

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
set(OPENOCD OPENOCD-NOTFOUND)
endif()
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -0,0 +1,6 @@
board:
name: m5stack_cores3
full_name: CoreS3
vendor: m5stack
socs:
- name: esp32s3

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View file

@ -0,0 +1,117 @@
.. _m5stack_cores3:
M5Stack CoreS3
##############
Overview
********
M5Stack CoreS3 is an ESP32-based development board from M5Stack. It is the third generation of the M5Stack Core series.
M5Stack CoreS3 features consist of:
- ESP32-S3 chip (dual-core Xtensa LX7 processor @240MHz, WIFI, OTG and CDC functions)
- PSRAM 8MB
- Flash 16MB
- LCD ISP 2", 320x240 pixel ILI9342C
- Capacitive multi touch FT6336U
- Camera 30W pixel GC0308
- Speaker 1W AW88298
- Dual Microphones ES7210 Audio decoder
- RTC BM8563
- USB-C
- SD-Card slot
- Geomagnetic sensor BMM150
- Proximity sensor LTR-553ALS-WA
- 6-Axis IMU BMI270
- PMIC AXP2101
- Battery 500mAh 3.7 V
.. figure:: img/m5stack_cores3.webp
:align: center
:alt: M5Stack-CoreS3
:width: 400 px
M5Stack CoreS3 module
Start Application Development
*****************************
Before powering up your M5Stack CoreS3, please make sure that the board is in good
condition with no obvious signs of damage.
System requirements
===================
Prerequisites
-------------
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
below to retrieve those files.
.. code-block:: console
west blobs fetch hal_espressif
.. note::
It is recommended running the command above after :file:`west update`.
Building & Flashing
-------------------
Build and flash applications as usual (see :ref:`build_an_application` and
:ref:`application_run` for more details).
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: m5stack_cores3/esp32s3/procpu
:goals: build
The usual ``flash`` target will work with the ``m5stack_cores3/esp32s3/procpu`` board
configuration. Here is an example for the :zephyr:code-sample:`hello_world`
application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: m5stack_cores3/esp32s3/procpu
:goals: flash
The baud rate of 921600bps is set by default. If experiencing issues when flashing,
try using different values by using ``--esp-baud-rate <BAUD>`` option during
``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).
You can also open the serial monitor using the following command:
.. code-block:: shell
west espressif monitor
After the board has automatically reset and booted, you should see the following
message in the monitor:
.. code-block:: console
*** Booting Zephyr OS build vx.x.x-xxx-gxxxxxxxxxxxx ***
Hello World! m5stack_cores3/esp32s3/procpu
Debugging
---------
ESP32-S3 support on OpenOCD is available upstream as of version 0.12.0.
Download and install OpenOCD from `OpenOCD`_.
ESP32-S3 has a built-in JTAG circuitry and can be debugged without any additional chip. Only an USB cable connected to the D+/D- pins is necessary.
Further documentation can be obtained from the SoC vendor in `JTAG debugging for ESP32-S3`_.
.. _`OpenOCD`: https://github.com/openocd-org/openocd
.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/
Related Documents
*****************
- `M5Stack CoreS3 official docs <http://docs.m5stack.com/en/core/CoreS3>`_
- `M5Stack CoreS3 schematic <https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/K128%20CoreS3/Sch_M5_CoreS3_v1.0.pdf>`_ (PDF)

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2024 Zhang Xingtao <zhxt@live.cn>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
#include <zephyr/dt-bindings/pinctrl/esp32s3-pinctrl.h>
#include <zephyr/dt-bindings/pinctrl/esp32s3-gpio-sigmap.h>
&pinctrl {
uart0_default: uart0_default {
group1 {
pinmux = <UART0_TX_GPIO43>;
output-high;
};
group2 {
pinmux = <UART0_RX_GPIO44>;
bias-pull-up;
};
};
spim2_default: spim2_default {
group1 {
pinmux = <SPIM2_MISO_GPIO35>,
<SPIM2_SCLK_GPIO36>;
};
group2 {
pinmux = <SPIM2_MOSI_GPIO37>;
output-low;
};
};
i2c0_default: i2c0_default {
group1 {
pinmux = <I2C0_SDA_GPIO12>,
<I2C0_SCL_GPIO11>;
bias-pull-up;
drive-open-drain;
output-high;
};
};
};

View file

@ -0,0 +1,66 @@
/*
* Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32s3/esp32s3_appcpu.dtsi>
/ {
model = "M5Stack CoreS3 APPCPU";
compatible = "espressif,esp32s3";
chosen {
zephyr,sram = &sram0;
zephyr,ipc_shm = &shm0;
zephyr,ipc = &ipm0;
};
};
&ipm0 {
status = "okay";
};
&trng0 {
status = "okay";
};
&flash0 {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Reserve 60kB for the bootloader */
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x00001000 0x0000F000>;
read-only;
};
/* Reserve 1024kB for the application in slot 0 */
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00100000>;
};
/* Reserve 1024kB for the application in slot 1 */
slot1_partition: partition@110000 {
label = "image-1";
reg = <0x00110000 0x00100000>;
};
/* Reserve 256kB for the scratch partition */
scratch_partition: partition@210000 {
label = "image-scratch";
reg = <0x00210000 0x00040000>;
};
storage_partition: partition@250000 {
label = "storage";
reg = <0x00250000 0x00006000>;
};
};
};

View file

@ -0,0 +1,27 @@
identifier: m5stack_cores3/esp32s3/appcpu
name: M5Stack CoreS3 APPCPU
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- uart
testing:
ignore_tags:
- net
- bluetooth
- flash
- cpp
- posix
- watchdog
- logging
- kernel
- pm
- gpio
- crypto
- eeprom
- heap
- cmsis_rtos
- jwt
- zdsp
vendor: m5stack

View file

@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_CLOCK_CONTROL=y

View file

@ -0,0 +1,118 @@
/*
* Copyright (c) 2024 Zhang Xingtao <zhxt@live.cn>
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32s3/esp32s3.dtsi>
#include "m5stack_cores3-pinctrl.dtsi"
/ {
model = "M5Stack CoreS3 PROCPU";
compatible = "m5stack,cores3";
chosen {
zephyr,sram = &sram0;
zephyr,console = &usb_serial;
zephyr,shell-uart = &usb_serial;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,bt-hci = &esp32_bt_hci;
};
aliases {
i2c-0 = &i2c0;
watchdog0 = &wdt0;
accel0 = &bmi270;
magn0 = &bmm150;
};
};
&usb_serial {
status = "okay";
};
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
bmi270: bmi270@69 {
compatible = "bosch,bmi270";
reg = <0x69>;
};
bmm150: bmm150@10 {
compatible = "bosch,bmm150";
status = "okay";
reg = <0x10>;
};
};
&spi2 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-0 = <&spim2_default>;
pinctrl-names = "default";
};
&wdt0 {
status = "okay";
};
&psram0 {
reg = <0x3c000000 DT_SIZE_M(8)>;
status = "okay";
};
&flash0 {
status = "okay";
reg = <0x0 DT_SIZE_M(16)>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x0000F000>;
read-only;
};
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00100000>;
};
slot1_partition: partition@110000 {
label = "image-1";
reg = <0x00110000 0x00100000>;
};
scratch_partition: partition@210000 {
label = "image-scratch";
reg = <0x00210000 0x00040000>;
};
storage_partition: partition@250000 {
label = "storage";
reg = <0x00250000 0x00006000>;
};
};
};
&esp32_bt_hci {
status = "okay";
};

View file

@ -0,0 +1,21 @@
identifier: m5stack_cores3/esp32s3/procpu
name: M5Stack CoreS3 PROCPU
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- dma
- i2c
- spi
- uart
- watchdog
testing:
ignore_tags:
- bluetooth
- gpio
- net
- pinmux
- pwm
- regulator
vendor: m5stack

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_GPIO=y

View file

@ -0,0 +1,7 @@
set ESP_RTOS none
set ESP32_ONLYCPU 1
# Source the JTAG interface configuration file
source [find interface/esp_usb_jtag.cfg]
# Source the ESP32-S3 configuration file
source [find target/esp32s3.cfg]