Skip to content

Commit 0cf8660

Browse files
zhxtkartbensoburi
authored andcommitted
boards: xtensa: add M5Stack CoreS3 support
Initial support for M5Statck CoreS3 development board. Signed-off-by: Zhang Xingtao <[email protected]> Co-authored-by: Benjamin Cabé <[email protected]> Co-authored-by: TOKITA Hiroshi <[email protected]>
1 parent f27323a commit 0cf8660

14 files changed

+455
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 Zhang Xingtao <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_M5STACK_CORES3_ESP32S3_PROCPU
5+
6+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
7+
int
8+
default $(UINT16_MAX) if WIFI && BT
9+
default 51200 if WIFI
10+
default 40960 if BT
11+
default 4096
12+
13+
endif # BOARD_M5STACK_CORES3_ESP32S3_PROCPU
14+
15+
if BOARD_M5STACK_CORES3_ESP32S3_APPCPU
16+
17+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
18+
int
19+
default 256
20+
21+
endif # BOARD_M5STACK_CORES3_ESP32S3_APPCPU
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# M5Stack CoreS3 board configuration
2+
3+
# Copyright (c) 2024 Zhang Xingtao <[email protected]>
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_M5STACK_CORES3
7+
select SOC_ESP32S3
8+
select SOC_ESP32S3_PROCPU if BOARD_M5STACK_CORES3_ESP32S3_PROCPU
9+
select SOC_ESP32S3_APPCPU if BOARD_M5STACK_CORES3_ESP32S3_APPCPU
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
4+
set(OPENOCD OPENOCD-NOTFOUND)
5+
endif()
6+
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
7+
8+
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: m5stack_cores3
3+
full_name: CoreS3
4+
vendor: m5stack
5+
socs:
6+
- name: esp32s3
72.3 KB
Loading
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
.. _m5stack_cores3:
2+
3+
M5Stack CoreS3
4+
##############
5+
6+
Overview
7+
********
8+
9+
M5Stack CoreS3 is an ESP32-based development board from M5Stack. It is the third generation of the M5Stack Core series.
10+
11+
M5Stack CoreS3 features consist of:
12+
13+
- ESP32-S3 chip (dual-core Xtensa LX7 processor @240MHz, WIFI, OTG and CDC functions)
14+
- PSRAM 8MB
15+
- Flash 16MB
16+
- LCD ISP 2", 320x240 pixel ILI9342C
17+
- Capacitive multi touch FT6336U
18+
- Camera 30W pixel GC0308
19+
- Speaker 1W AW88298
20+
- Dual Microphones ES7210 Audio decoder
21+
- RTC BM8563
22+
- USB-C
23+
- SD-Card slot
24+
- Geomagnetic sensor BMM150
25+
- Proximity sensor LTR-553ALS-WA
26+
- 6-Axis IMU BMI270
27+
- PMIC AXP2101
28+
- Battery 500mAh 3.7 V
29+
30+
.. figure:: img/m5stack_cores3.webp
31+
:align: center
32+
:alt: M5Stack-CoreS3
33+
:width: 400 px
34+
35+
M5Stack CoreS3 module
36+
37+
Start Application Development
38+
*****************************
39+
40+
Before powering up your M5Stack CoreS3, please make sure that the board is in good
41+
condition with no obvious signs of damage.
42+
43+
System requirements
44+
===================
45+
46+
Prerequisites
47+
-------------
48+
49+
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
50+
below to retrieve those files.
51+
52+
.. code-block:: console
53+
54+
west blobs fetch hal_espressif
55+
56+
.. note::
57+
58+
It is recommended running the command above after :file:`west update`.
59+
60+
Building & Flashing
61+
-------------------
62+
63+
Build and flash applications as usual (see :ref:`build_an_application` and
64+
:ref:`application_run` for more details).
65+
66+
.. zephyr-app-commands::
67+
:zephyr-app: samples/hello_world
68+
:board: m5stack_cores3/esp32s3/procpu
69+
:goals: build
70+
71+
The usual ``flash`` target will work with the ``m5stack_cores3/esp32s3/procpu`` board
72+
configuration. Here is an example for the :zephyr:code-sample:`hello_world`
73+
application.
74+
75+
.. zephyr-app-commands::
76+
:zephyr-app: samples/hello_world
77+
:board: m5stack_cores3/esp32s3/procpu
78+
:goals: flash
79+
80+
The baud rate of 921600bps is set by default. If experiencing issues when flashing,
81+
try using different values by using ``--esp-baud-rate <BAUD>`` option during
82+
``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).
83+
84+
You can also open the serial monitor using the following command:
85+
86+
.. code-block:: shell
87+
88+
west espressif monitor
89+
90+
After the board has automatically reset and booted, you should see the following
91+
message in the monitor:
92+
93+
.. code-block:: console
94+
95+
*** Booting Zephyr OS build vx.x.x-xxx-gxxxxxxxxxxxx ***
96+
Hello World! m5stack_cores3/esp32s3/procpu
97+
98+
99+
Debugging
100+
---------
101+
102+
ESP32-S3 support on OpenOCD is available upstream as of version 0.12.0.
103+
Download and install OpenOCD from `OpenOCD`_.
104+
105+
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.
106+
107+
Further documentation can be obtained from the SoC vendor in `JTAG debugging for ESP32-S3`_.
108+
109+
.. _`OpenOCD`: https://github.com/openocd-org/openocd
110+
.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/
111+
112+
113+
Related Documents
114+
*****************
115+
116+
- `M5Stack CoreS3 official docs <http://docs.m5stack.com/en/core/CoreS3>`_
117+
- `M5Stack CoreS3 schematic <https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/K128%20CoreS3/Sch_M5_CoreS3_v1.0.pdf>`_ (PDF)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2024 Zhang Xingtao <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
8+
#include <zephyr/dt-bindings/pinctrl/esp32s3-pinctrl.h>
9+
#include <zephyr/dt-bindings/pinctrl/esp32s3-gpio-sigmap.h>
10+
11+
&pinctrl {
12+
uart0_default: uart0_default {
13+
group1 {
14+
pinmux = <UART0_TX_GPIO43>;
15+
output-high;
16+
};
17+
group2 {
18+
pinmux = <UART0_RX_GPIO44>;
19+
bias-pull-up;
20+
};
21+
};
22+
23+
spim2_default: spim2_default {
24+
group1 {
25+
pinmux = <SPIM2_MISO_GPIO35>,
26+
<SPIM2_SCLK_GPIO36>;
27+
};
28+
group2 {
29+
pinmux = <SPIM2_MOSI_GPIO37>;
30+
output-low;
31+
};
32+
};
33+
34+
i2c0_default: i2c0_default {
35+
group1 {
36+
pinmux = <I2C0_SDA_GPIO12>,
37+
<I2C0_SCL_GPIO11>;
38+
bias-pull-up;
39+
drive-open-drain;
40+
output-high;
41+
};
42+
};
43+
};
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/dts-v1/;
7+
8+
#include <espressif/esp32s3/esp32s3_appcpu.dtsi>
9+
10+
/ {
11+
model = "M5Stack CoreS3 APPCPU";
12+
compatible = "espressif,esp32s3";
13+
14+
chosen {
15+
zephyr,sram = &sram0;
16+
zephyr,ipc_shm = &shm0;
17+
zephyr,ipc = &ipm0;
18+
};
19+
};
20+
21+
&ipm0 {
22+
status = "okay";
23+
};
24+
25+
&trng0 {
26+
status = "okay";
27+
};
28+
29+
&flash0 {
30+
status = "okay";
31+
partitions {
32+
compatible = "fixed-partitions";
33+
#address-cells = <1>;
34+
#size-cells = <1>;
35+
36+
/* Reserve 60kB for the bootloader */
37+
boot_partition: partition@1000 {
38+
label = "mcuboot";
39+
reg = <0x00001000 0x0000F000>;
40+
read-only;
41+
};
42+
43+
/* Reserve 1024kB for the application in slot 0 */
44+
slot0_partition: partition@10000 {
45+
label = "image-0";
46+
reg = <0x00010000 0x00100000>;
47+
};
48+
49+
/* Reserve 1024kB for the application in slot 1 */
50+
slot1_partition: partition@110000 {
51+
label = "image-1";
52+
reg = <0x00110000 0x00100000>;
53+
};
54+
55+
/* Reserve 256kB for the scratch partition */
56+
scratch_partition: partition@210000 {
57+
label = "image-scratch";
58+
reg = <0x00210000 0x00040000>;
59+
};
60+
61+
storage_partition: partition@250000 {
62+
label = "storage";
63+
reg = <0x00250000 0x00006000>;
64+
};
65+
};
66+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
identifier: m5stack_cores3/esp32s3/appcpu
2+
name: M5Stack CoreS3 APPCPU
3+
type: mcu
4+
arch: xtensa
5+
toolchain:
6+
- zephyr
7+
supported:
8+
- uart
9+
testing:
10+
ignore_tags:
11+
- net
12+
- bluetooth
13+
- flash
14+
- cpp
15+
- posix
16+
- watchdog
17+
- logging
18+
- kernel
19+
- pm
20+
- gpio
21+
- crypto
22+
- eeprom
23+
- heap
24+
- cmsis_rtos
25+
- jwt
26+
- zdsp
27+
vendor: m5stack
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
CONFIG_MAIN_STACK_SIZE=2048
4+
CONFIG_CLOCK_CONTROL=y

0 commit comments

Comments
 (0)