Skip to content

Commit 02c0f48

Browse files
authored
Merge pull request #21522 from gschorcht/cpu/esp32/add_esp32h2
cpu/esp32: add ESP32-H2 support
2 parents 5c56d38 + 986cda8 commit 02c0f48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3358
-223
lines changed

boards/common/esp32h2/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2025 Gunar Schorcht
2+
#
3+
# This file is subject to the terms and conditions of the GNU Lesser
4+
# General Public License v2.1. See the file LICENSE in the top level
5+
# directory for more details.
6+
7+
config BOARD_COMMON_ESP32H2
8+
bool
9+
select BOARD_COMMON_ESP32X
10+
11+
source "$(RIOTBOARD)/common/esp32x/Kconfig"

boards/common/esp32h2/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
MODULE = boards_common_esp32h2
2+
3+
DIRS = $(RIOTBOARD)/common/esp32x
4+
5+
include $(RIOTBASE)/Makefile.base

boards/common/esp32h2/Makefile.dep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
USEMODULE += boards_common_esp32h2
2+
3+
include $(RIOTBOARD)/common/esp32x/Makefile.dep
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CPU_FAM = esp32h2
2+
3+
include $(RIOTBOARD)/common/esp32x/Makefile.features
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
INCLUDES += -I$(RIOTBOARD)/common/esp32h2/include
2+
3+
include $(RIOTBOARD)/common/esp32x/Makefile.include

boards/common/esp32h2/doc.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
Copyright (C) 2025 Gunar Schorcht
3+
4+
This file is subject to the terms and conditions of the GNU Lesser
5+
General Public License v2.1. See the file LICENSE in the top level
6+
directory for more details.
7+
-->
8+
9+
@defgroup boards_common_esp32h2 ESP32-H2 Common
10+
@ingroup boards_common
11+
@ingroup boards_esp32h2
12+
@brief Definitions and configurations that are common for all ESP32-H2 boards.
13+
14+
For detailed information about the ESP32-H2, configuring and compiling RIOT
15+
for ESP32-H2 boards, please refer to \ref esp32_riot.
16+
17+
@defgroup boards_esp32h2 ESP32-H2 Boards
18+
@ingroup boards
19+
@brief This group of boards contains the documentation of ESP32-H2 boards.
20+
21+
@note For detailed information about the ESP32-H2 SoC, the tool chain
22+
as well as configuring and compiling RIOT for ESP32-H2 boards,
23+
see \ref esp32_riot.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (C) 2025 Gunar Schorcht
3+
*
4+
* This file is subject to the terms and conditions of the GNU Lesser
5+
* General Public License v2.1. See the file LICENSE in the top level
6+
* directory for more details.
7+
*/
8+
9+
#pragma once
10+
11+
/**
12+
* @ingroup boards_common_esp32h2
13+
* @brief Board definitions that are common for all ESP32-H2 boards.
14+
*
15+
* This file contains board configurations that are valid for all ESP32-H2.
16+
*
17+
* For detailed information about the configuration of ESP32-H2 boards, see
18+
* section \ref esp32_peripherals "Common Peripherals".
19+
*
20+
* @author Gunar Schorcht <[email protected]>
21+
* @file
22+
* @{
23+
*/
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
#if !DOXYGEN
30+
31+
/**
32+
* @name ztimer Configuration valid for all ESP32-H2 boards
33+
* @{
34+
*/
35+
36+
#if CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ == 96
37+
# define CONFIG_ZTIMER_USEC_ADJUST_SET 14
38+
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 13
39+
#elif CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ == 64
40+
# define CONFIG_ZTIMER_USEC_ADJUST_SET 19
41+
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 18
42+
#elif CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ == 48
43+
# define CONFIG_ZTIMER_USEC_ADJUST_SET 34
44+
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 32
45+
#elif CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ == 32
46+
# define CONFIG_ZTIMER_USEC_ADJUST_SET 32
47+
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 33
48+
#elif CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ == 16
49+
# define CONFIG_ZTIMER_USEC_ADJUST_SET 129
50+
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 135
51+
#else
52+
# error "Invalid CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ value"
53+
#endif
54+
55+
/** @} */
56+
57+
#endif /* !DOXYGEN */
58+
59+
#ifdef __cplusplus
60+
} /* end extern "C" */
61+
#endif
62+
63+
/** @} */
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (C) 2025 Gunar Schorcht
3+
*
4+
* This file is subject to the terms and conditions of the GNU Lesser
5+
* General Public License v2.1. See the file LICENSE in the top level
6+
* directory for more details.
7+
*/
8+
9+
#pragma once
10+
11+
/**
12+
* @ingroup boards_common_esp32h2
13+
* @brief Common peripheral configurations for ESP32-H2 boards
14+
*
15+
* This file contains the peripheral configurations that are valid for all
16+
* ESP32-H2 boards.
17+
*
18+
* For detailed information about the peripheral configuration for ESP32-H2
19+
* boards, see section \ref esp32_peripherals "Common Peripherals".
20+
*
21+
* @author Gunar Schorcht <[email protected]>
22+
* @file
23+
* @{
24+
*/
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
/**
31+
* @name UART configuration
32+
* @{
33+
*/
34+
#ifndef UART0_TXD
35+
# define UART0_TXD (GPIO24) /**< TxD of UART_DEV(0) used on all ESP32-H2 boards */
36+
#endif
37+
38+
#ifndef UART0_RXD
39+
# define UART0_RXD (GPIO23) /**< RxD of UART_DEV(0) used on all ESP32-H2 boards */
40+
#endif
41+
/** @} */
42+
43+
#ifdef __cplusplus
44+
} /* end extern "C" */
45+
#endif
46+
47+
/** @} */

boards/common/esp32x/include/board_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
# include "board_common_esp32.h"
3939
#elif defined(CPU_FAM_ESP32C3)
4040
# include "board_common_esp32c3.h"
41+
#elif defined(CPU_FAM_ESP32H2)
42+
# include "board_common_esp32h2.h"
4143
#elif defined(CPU_FAM_ESP32S2)
4244
# include "board_common_esp32s2.h"
4345
#elif defined(CPU_FAM_ESP32S3)

boards/common/esp32x/include/periph_conf_common.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@
2424
*/
2525

2626
#if defined(CPU_FAM_ESP32)
27-
#include "periph_conf_common_esp32.h"
27+
# include "periph_conf_common_esp32.h"
2828
#elif defined(CPU_FAM_ESP32C3)
29-
#include "periph_conf_common_esp32c3.h"
29+
# include "periph_conf_common_esp32c3.h"
30+
#elif defined(CPU_FAM_ESP32H2)
31+
# include "periph_conf_common_esp32h2.h"
3032
#elif defined(CPU_FAM_ESP32S2)
31-
#include "periph_conf_common_esp32s2.h"
33+
# include "periph_conf_common_esp32s2.h"
3234
#elif defined(CPU_FAM_ESP32S3)
33-
#include "periph_conf_common_esp32s3.h"
35+
# include "periph_conf_common_esp32s3.h"
3436
#else
35-
#error "ESP32x SoC family not supported"
37+
# error "ESP32x SoC family not supported"
3638
#endif
3739

3840
/* include periph_cpu.h to make it visible in any case */

0 commit comments

Comments
 (0)