Skip to content

Commit 9c6b661

Browse files
author
Raffael Rostagno
committed
boards: esp32h2_devkitm: Add initial support
Add initial support for esp32h2_devkitm. Signed-off-by: Raffael Rostagno <[email protected]>
1 parent dc803c4 commit 9c6b661

File tree

12 files changed

+395
-0
lines changed

12 files changed

+395
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
5+
int
6+
default 4096
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ESP32-H2 DevKitM board configuration
2+
3+
# Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_ESP32H2_DEVKITM
7+
select SOC_ESP32_H2_MINI_H4
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
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: 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: esp32h2_devkitm
3+
full_name: ESP32-H2-DevKitM
4+
vendor: espressif
5+
socs:
6+
- name: esp32h2
Binary file not shown.
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
.. zephyr:board:: esp32h2_devkitm
2+
3+
Overview
4+
********
5+
6+
ESP32-H2-DevKitM-1 is an entry-level development board based on the ESP32-H2-MINI-1 module,
7+
which integrates Bluetooth® Low Energy (LE) and IEEE 802.15.4 connectivity. It features
8+
the ESP32-H2 SoC — a 32-bit RISC-V core designed for low-power, secure wireless communication,
9+
supporting Bluetooth 5 (LE), Bluetooth Mesh, Thread, Matter, and Zigbee protocols.
10+
This module is ideal for a wide range of low-power IoT applications.
11+
12+
Hardware
13+
********
14+
15+
ESP32-H2 combines IEEE 802.15.4 connectivity with Bluetooth 5 (LE). The SoC is powered by
16+
a single-core, 32-bit RISC-V microcontroller that can be clocked up to 96 MHz. The ESP32-H2 has
17+
been designed to ensure low power consumption and security for connected devices. ESP32-H2 has
18+
320 KB of SRAM with 16 KB of Cache, 128 KB of ROM, 4 KB LP of memory, and a built-in 2 MB or 4 MB
19+
SiP flash. It has 19 programmable GPIOs with support for ADC, SPI, UART, I2C, I2S, RMT, GDMA
20+
and LED PWM.
21+
22+
Most of ESP32-H2-DevKitM-1's I/O pins are broken out to the pin headers on both sides for easy
23+
interfacing. Developers can either connect peripherals with jumper wires or mount the board
24+
on a breadboard.
25+
26+
ESP32-H2 main features:
27+
28+
- RISC-V 32-bit single-core microprocessor
29+
- 320 KB of internal RAM
30+
- 4 KB LP Memory
31+
- Bluetooth LE: Bluetooth 5.3 certified
32+
- IEEE 802.15.4 (Zigbee and Thread)
33+
- 19 programmable GPIOs
34+
- Numerous peripherals (details below)
35+
36+
Digital interfaces:
37+
38+
- 19x GPIOs
39+
- 2x UART
40+
- 2x I2C
41+
- 1x General-purpose SPI
42+
- 1x I2S
43+
- 1x Pulse counter
44+
- 1x USB Serial/JTAG controller
45+
- 1x TWAI® controller, compatible with ISO 11898-1 (CAN Specification 2.0)
46+
- 1x LED PWM controller, up to 6 channels
47+
- 1x Motor Control PWM (MCPWM)
48+
- 1x Remote Control peripheral (RMT), with up to 2 TX and 2 RX channels
49+
- 1x Parallel IO interface (PARLIO)
50+
- General DMA controller (GDMA), with 3 transmit channels and 3 receive channels
51+
- Event Task Matrix (ETM)
52+
53+
Analog interfaces:
54+
55+
- 1x 12-bit SAR ADCs, up to 5 channels
56+
- 1x Temperature sensor (die)
57+
58+
Timers:
59+
60+
- 1x 52-bit system timer
61+
- 2x 54-bit general-purpose timers
62+
- 3x Watchdog timers
63+
64+
Low Power:
65+
66+
- Four power modes designed for typical scenarios: Active, Modem-sleep, Light-sleep, Deep-sleep
67+
68+
Security:
69+
70+
- Secure boot
71+
- Flash encryption
72+
- 4-Kbit OTP, up to 1792 bits for users
73+
- Cryptographic hardware acceleration: (AES-128/256, ECC, HMAC, RSA, SHA, Digital signature, Hash)
74+
- Random number generator (RNG)
75+
76+
For detailed information, check the datasheet at `ESP32-H2 Datasheet`_ or the Technical Reference
77+
Manual at `ESP32-H2 Technical Reference Manual`_.
78+
79+
Supported Features
80+
==================
81+
82+
.. zephyr:board-supported-hw::
83+
84+
System requirements
85+
*******************
86+
87+
Prerequisites
88+
=============
89+
90+
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
91+
below to retrieve those files.
92+
93+
.. code-block:: console
94+
95+
west blobs fetch hal_espressif
96+
97+
.. note::
98+
99+
It is recommended running the command above after :file:`west update`.
100+
101+
Building & Flashing
102+
*******************
103+
104+
.. zephyr:board-supported-runners::
105+
106+
Simple boot
107+
===========
108+
109+
The board could be loaded using the single binary image, without 2nd stage bootloader.
110+
It is the default option when building the application without additional configuration.
111+
112+
.. note::
113+
114+
Simple boot does not provide any security features nor OTA updates.
115+
116+
MCUboot bootloader
117+
==================
118+
119+
User may choose to use MCUboot bootloader instead. In that case the bootloader
120+
must be built (and flashed) at least once.
121+
122+
There are two options to be used when building an application:
123+
124+
1. Sysbuild
125+
2. Manual build
126+
127+
.. note::
128+
129+
User can select the MCUboot bootloader by adding the following line
130+
to the board default configuration file.
131+
132+
.. code:: cfg
133+
134+
CONFIG_BOOTLOADER_MCUBOOT=y
135+
136+
Sysbuild
137+
========
138+
139+
The sysbuild makes possible to build and flash all necessary images needed to
140+
bootstrap the board with the EPS32-H2 SoC.
141+
142+
To build the sample application using sysbuild use the command:
143+
144+
.. zephyr-app-commands::
145+
:tool: west
146+
:zephyr-app: samples/hello_world
147+
:board: esp32h2_devkitm
148+
:goals: build
149+
:west-args: --sysbuild
150+
:compact:
151+
152+
By default, the ESP32-H2 sysbuild creates bootloader (MCUboot) and application
153+
images. But it can be configured to create other kind of images.
154+
155+
Build directory structure created by sysbuild is different from traditional
156+
Zephyr build. Output is structured by the domain subdirectories:
157+
158+
.. code-block::
159+
160+
build/
161+
├── hello_world
162+
│   └── zephyr
163+
│   ├── zephyr.elf
164+
│   └── zephyr.bin
165+
├── mcuboot
166+
│ └── zephyr
167+
│ ├── zephyr.elf
168+
│ └── zephyr.bin
169+
└── domains.yaml
170+
171+
.. note::
172+
173+
With ``--sysbuild`` option the bootloader will be re-build and re-flash
174+
every time the pristine build is used.
175+
176+
For more information about the system build please read the :ref:`sysbuild` documentation.
177+
178+
Manual build
179+
============
180+
181+
During the development cycle, it is intended to build & flash as quickly possible.
182+
For that reason, images can be built one at a time using traditional build.
183+
184+
The instructions following are relevant for both manual build and sysbuild.
185+
The only difference is the structure of the build directory.
186+
187+
.. note::
188+
189+
Remember that bootloader (MCUboot) needs to be flash at least once.
190+
191+
Build and flash applications as usual (see :ref:`build_an_application` and
192+
:ref:`application_run` for more details).
193+
194+
.. zephyr-app-commands::
195+
:zephyr-app: samples/hello_world
196+
:board: esp32h2_devkitm
197+
:goals: build
198+
199+
The usual ``flash`` target will work with the ``esp32h2_devkitm`` board
200+
configuration. Here is an example for the :zephyr:code-sample:`hello_world`
201+
application.
202+
203+
.. zephyr-app-commands::
204+
:zephyr-app: samples/hello_world
205+
:board: esp32h2_devkitm
206+
:goals: flash
207+
208+
Open the serial monitor using the following command:
209+
210+
.. code-block:: shell
211+
212+
west espressif monitor
213+
214+
After the board has automatically reset and booted, you should see the following
215+
message in the monitor:
216+
217+
.. code-block:: console
218+
219+
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
220+
Hello World! esp32h2_devkitm/esp32h2
221+
222+
.. include:: ../../../espressif/common/board-variants.rst
223+
:start-after: espressif-board-variants
224+
225+
Debugging
226+
*********
227+
228+
As with much custom hardware, the ESP32-H2 modules require patches to
229+
OpenOCD that are not upstreamed yet. Espressif maintains their own fork of
230+
the project. The custom OpenOCD can be obtained at `OpenOCD ESP32`_.
231+
232+
The Zephyr SDK uses a bundled version of OpenOCD by default. You can overwrite that behavior by adding the
233+
``-DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>``
234+
parameter when building.
235+
236+
Here is an example for building the :zephyr:code-sample:`hello_world` application.
237+
238+
.. zephyr-app-commands::
239+
:zephyr-app: samples/hello_world
240+
:board: esp32h2_devkitm
241+
:goals: build flash
242+
:gen-args: -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>
243+
244+
You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application.
245+
246+
.. zephyr-app-commands::
247+
:zephyr-app: samples/hello_world
248+
:board: esp32h2_devkitm
249+
:goals: debug
250+
251+
References
252+
**********
253+
254+
.. target-notes::
255+
256+
.. _`ESP32-H2-DevKitM-1`: https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32h2/esp32-h2-devkitm-1/user_guide.html
257+
.. _`ESP32-H2 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf
258+
.. _`ESP32-H2 Technical Reference Manual`: https://www.espressif.com/sites/default/files/documentation/esp32-h2_technical_reference_manual_en.pdf
259+
.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
8+
#include <dt-bindings/pinctrl/esp32h2-pinctrl.h>
9+
#include <zephyr/dt-bindings/pinctrl/esp32h2-gpio-sigmap.h>
10+
11+
&pinctrl {
12+
13+
uart0_default: uart0_default {
14+
group1 {
15+
pinmux = <UART0_TX_GPIO24>;
16+
output-high;
17+
};
18+
group2 {
19+
pinmux = <UART0_RX_GPIO23>;
20+
bias-pull-up;
21+
};
22+
};
23+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <espressif/esp32h2/esp32h2_mini_h4.dtsi>
10+
#include "esp32h2_devkitm-pinctrl.dtsi"
11+
#include <zephyr/dt-bindings/input/input-event-codes.h>
12+
#include <espressif/partitions_0x0_default.dtsi>
13+
14+
/ {
15+
model = "Espressif ESP32H2-DevkitM";
16+
compatible = "espressif,esp32h2";
17+
18+
chosen {
19+
zephyr,sram = &sramhp;
20+
zephyr,console = &uart0;
21+
zephyr,shell-uart = &uart0;
22+
zephyr,flash = &flash0;
23+
zephyr,code-partition = &slot0_partition;
24+
};
25+
26+
aliases {
27+
sw0 = &user_button1;
28+
watchdog0 = &wdt0;
29+
};
30+
31+
gpio_keys {
32+
compatible = "gpio-keys";
33+
user_button1: button_1 {
34+
label = "User SW1";
35+
gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
36+
zephyr,code = <INPUT_KEY_0>;
37+
};
38+
};
39+
};
40+
41+
&uart0 {
42+
status = "okay";
43+
current-speed = <115200>;
44+
pinctrl-0 = <&uart0_default>;
45+
pinctrl-names = "default";
46+
};
47+
48+
&gpio0 {
49+
status = "okay";
50+
};
51+
52+
&wdt0 {
53+
status = "okay";
54+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
identifier: esp32h2_devkitm/esp32h2
2+
name: ESP32-H2-DevKitM
3+
vendor: espressif
4+
type: mcu
5+
arch: riscv
6+
toolchain:
7+
- zephyr
8+
supported:
9+
- gpio
10+
- watchdog
11+
- uart

0 commit comments

Comments
 (0)