Skip to content

Commit 4c67ff5

Browse files
committed
boards: seeed: add XIAO ESP32C6 support
This PR adds supports for XIAO ESP32C6 Signed-off-by: Mario Paja <[email protected]>
1 parent 7d22513 commit 4c67ff5

File tree

14 files changed

+434
-0
lines changed

14 files changed

+434
-0
lines changed

boards/seeed/xiao_esp32c6/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2024 Mario Paja
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
5+
int
6+
default 4096
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2024 Mario Paja
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
choice BOOTLOADER
5+
default BOOTLOADER_MCUBOOT
6+
endchoice
7+
8+
choice BOOT_SIGNATURE_TYPE
9+
default BOOT_SIGNATURE_TYPE_NONE
10+
endchoice
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# XIAO ESP32C6 board configuration
2+
3+
# Copyright (c) 2024 Mario Paja
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_XIAO_ESP32C6
7+
select SOC_ESP32_C6_WROOM_1U_N4
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: xiao_esp32c6
3+
full_name: XIAO ESP32C6
4+
vendor: seeed
5+
socs:
6+
- name: esp32c6
28.2 KB
Loading
40.7 KB
Loading
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
.. zephyr:board:: xiao_esp32c6
2+
3+
Overview
4+
********
5+
6+
Seeed Studio XIAO ESP32C6 is powered by the highly-integrated ESP32-C6 SoC.
7+
It consists of a high-performance (HP) 32-bit RISC-V processor, which can be clocked up to 160 MHz,
8+
and a low-power (LP) 32-bit RISC-V processor, which can be clocked up to 20 MHz.
9+
It has a 320KB ROM, a 512KB SRAM, and works with external flash.
10+
This board integrates complete Wi-Fi, Bluetooth LE, Zigbee, and Thread functions.
11+
For more information, check `Seeed Studio XIAO ESP32C6`_ .
12+
13+
Hardware
14+
********
15+
16+
This board is based on the ESP32-C6 with 4MB of flash, integrating 2.4 GHz Wi-Fi 6,
17+
Bluetooth 5.3 (LE) and the 802.15.4 protocol. It has an USB-C port for programming
18+
and debugging, integrated battery charging and an U.FL external antenna connector.
19+
It is based on a standard XIAO 14 pin pinout.
20+
21+
Supported Features
22+
==================
23+
24+
The Zephyr ``xiao_esp32c6`` board target supports the following hardware features:
25+
26+
+------------+------------+-------------------------------------+
27+
| Interface | Controller | Driver/Component |
28+
+============+============+=====================================+
29+
| UART | on-chip | serial port |
30+
+------------+------------+-------------------------------------+
31+
| GPIO | on-chip | gpio |
32+
+------------+------------+-------------------------------------+
33+
| PINMUX | on-chip | pinmux |
34+
+------------+------------+-------------------------------------+
35+
| USB-JTAG | on-chip | hardware interface |
36+
+------------+------------+-------------------------------------+
37+
| SPI Master | on-chip | spi |
38+
+------------+------------+-------------------------------------+
39+
| Watchdog | on-chip | watchdog |
40+
+------------+------------+-------------------------------------+
41+
| LEDC | on-chip | pwm |
42+
+------------+------------+-------------------------------------+
43+
| SPI DMA | on-chip | spi |
44+
+------------+------------+-------------------------------------+
45+
| GDMA | on-chip | dma |
46+
+------------+------------+-------------------------------------+
47+
| TRNG | on-chip | entropy |
48+
+------------+------------+-------------------------------------+
49+
| USB-CDC | on-chip | serial |
50+
+------------+------------+-------------------------------------+
51+
| Wi-Fi | on-chip | |
52+
+------------+------------+-------------------------------------+
53+
54+
The board uses a standard XIAO pinout, the default pin mapping is the following:
55+
56+
.. figure:: img/xiao_esp32c6_pinout.webp
57+
:align: center
58+
:alt: XIAO ESP32C6 Pinout
59+
60+
XIAO ESP32C6 Pinout
61+
62+
System requirements
63+
*******************
64+
65+
Prerequisites
66+
=============
67+
68+
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
69+
below to retrieve those files.
70+
71+
.. code-block:: console
72+
73+
west blobs fetch hal_espressif
74+
75+
.. note::
76+
77+
It is recommended running the command above after :file:`west update`.
78+
79+
Building & Flashing
80+
*******************
81+
82+
Simple boot
83+
===========
84+
85+
The board could be loaded using the single binary image, without 2nd stage bootloader.
86+
It is the default option when building the application without additional configuration.
87+
88+
.. note::
89+
90+
Simple boot does not provide any security features nor OTA updates.
91+
92+
MCUboot bootloader
93+
==================
94+
95+
User may choose to use MCUboot bootloader instead. In that case the bootloader
96+
must be built (and flashed) at least once.
97+
98+
There are two options to be used when building an application:
99+
100+
1. Sysbuild
101+
2. Manual build
102+
103+
.. note::
104+
105+
User can select the MCUboot bootloader by adding the following line
106+
to the board default configuration file.
107+
108+
.. code:: cfg
109+
110+
CONFIG_BOOTLOADER_MCUBOOT=y
111+
112+
Sysbuild
113+
========
114+
115+
The sysbuild makes possible to build and flash all necessary images needed to
116+
bootstrap the board with the EPS32 SoC.
117+
118+
To build the sample application using sysbuild use the command:
119+
120+
.. zephyr-app-commands::
121+
:tool: west
122+
:zephyr-app: samples/hello_world
123+
:board: xiao_esp32c6
124+
:goals: build
125+
:west-args: --sysbuild
126+
:compact:
127+
128+
By default, the ESP32 sysbuild creates bootloader (MCUboot) and application
129+
images. But it can be configured to create other kind of images.
130+
131+
Build directory structure created by sysbuild is different from traditional
132+
Zephyr build. Output is structured by the domain subdirectories:
133+
134+
.. code-block::
135+
136+
build/
137+
├── hello_world
138+
│   └── zephyr
139+
│   ├── zephyr.elf
140+
│   └── zephyr.bin
141+
├── mcuboot
142+
│ └── zephyr
143+
│ ├── zephyr.elf
144+
│ └── zephyr.bin
145+
└── domains.yaml
146+
147+
.. note::
148+
149+
With ``--sysbuild`` option the bootloader will be re-build and re-flash
150+
every time the pristine build is used.
151+
152+
For more information about the system build please read the :ref:`sysbuild` documentation.
153+
154+
Manual build
155+
============
156+
157+
During the development cycle, it is intended to build & flash as quickly possible.
158+
For that reason, images can be built one at a time using traditional build.
159+
160+
The instructions following are relevant for both manual build and sysbuild.
161+
The only difference is the structure of the build directory.
162+
163+
.. note::
164+
165+
Remember that bootloader (MCUboot) needs to be flash at least once.
166+
167+
Build and flash applications as usual (see :ref:`build_an_application` and
168+
:ref:`application_run` for more details).
169+
170+
.. zephyr-app-commands::
171+
:zephyr-app: samples/hello_world
172+
:board: xiao_esp32c6
173+
:goals: build
174+
175+
The usual ``flash`` target will work with the ``xiao_esp32c6`` board
176+
configuration. Here is an example for the :zephyr:code-sample:`hello_world`
177+
application.
178+
179+
.. zephyr-app-commands::
180+
:zephyr-app: samples/hello_world
181+
:board: xiao_esp32c6
182+
:goals: flash
183+
184+
Since the Zephyr console is by default on the ``usb_serial`` device, we use
185+
the espressif monitor to view.
186+
187+
.. code-block:: console
188+
189+
$ west espressif monitor
190+
191+
After the board has automatically reset and booted, you should see the following
192+
message in the monitor:
193+
194+
.. code-block:: console
195+
196+
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
197+
Hello World! xiao_esp32c6/esp32c6
198+
199+
Debugging
200+
*********
201+
202+
As with much custom hardware, the ESP32-C6 modules require patches to
203+
OpenOCD that are not upstreamed yet. Espressif maintains their own fork of
204+
the project. The custom OpenOCD can be obtained at `OpenOCD ESP32`_.
205+
206+
The Zephyr SDK uses a bundled version of OpenOCD by default. You can overwrite that behavior by adding the
207+
``-DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>``
208+
parameter when building.
209+
210+
Here is an example for building the :zephyr:code-sample:`hello_world` application.
211+
212+
.. zephyr-app-commands::
213+
:zephyr-app: samples/hello_world
214+
:board: xiao_esp32c6
215+
:goals: build flash
216+
:gen-args: -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>
217+
218+
You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application.
219+
220+
.. zephyr-app-commands::
221+
:zephyr-app: samples/hello_world
222+
:board: xiao_esp32c6
223+
:goals: debug
224+
225+
References
226+
**********
227+
228+
.. target-notes::
229+
230+
.. _`Seeed Studio XIAO ESP32C6`: https://wiki.seeedstudio.com/xiao_esp32c6_getting_started/
231+
.. _`ESP32-C6 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf
232+
.. _`ESP32-C6 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf
233+
.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2024 Mario Paja
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
xiao_d: connector {
9+
compatible = "seeed,xiao-gpio";
10+
#gpio-cells = <2>;
11+
gpio-map-mask = <0xffffffff 0xffffffc0>;
12+
gpio-map-pass-thru = <0 0x3f>;
13+
gpio-map = <0 0 &gpio0 0 0>, /* D0 */
14+
<1 0 &gpio0 1 0>, /* D1 */
15+
<2 0 &gpio0 2 0>, /* D2 */
16+
<3 0 &gpio0 21 0>, /* D3 */
17+
<4 0 &gpio0 22 0>, /* D4 */
18+
<5 0 &gpio0 23 0>, /* D5 */
19+
<6 0 &gpio0 16 0>, /* D6 */
20+
<7 0 &gpio0 17 0>, /* D7 */
21+
<8 0 &gpio0 19 0>, /* D8 */
22+
<9 0 &gpio0 20 0>, /* D9 */
23+
<10 0 &gpio0 18 0>; /* D10 */
24+
};
25+
};
26+
27+
xiao_spi: &spi2 {};
28+
xiao_serial: &uart0 {};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# ESP32C6 has built-in JTAG interface over USB port in pins GPIO13/GPIO12 (D-/D+).
2+
set ESP_RTOS none
3+
4+
source [find board/esp32c6-builtin.cfg]

0 commit comments

Comments
 (0)