Skip to content

Commit 7a169f1

Browse files
author
Raffael Rostagno
committed
soc: esp32h2: Add initial support
Add initial support files for ESP32-H2. Signed-off-by: Raffael Rostagno <[email protected]>
1 parent 883b9e8 commit 7a169f1

File tree

10 files changed

+750
-0
lines changed

10 files changed

+750
-0
lines changed

zephyr/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ add_subdirectory_ifdef(CONFIG_SOC_SERIES_ESP32 esp32)
88
add_subdirectory_ifdef(CONFIG_SOC_SERIES_ESP32C2 esp32c2)
99
add_subdirectory_ifdef(CONFIG_SOC_SERIES_ESP32C3 esp32c3)
1010
add_subdirectory_ifdef(CONFIG_SOC_SERIES_ESP32C6 esp32c6)
11+
add_subdirectory_ifdef(CONFIG_SOC_SERIES_ESP32H2 esp32h2)
1112
add_subdirectory_ifdef(CONFIG_SOC_SERIES_ESP32S2 esp32s2)
1213
add_subdirectory_ifdef(CONFIG_SOC_SERIES_ESP32S3 esp32s3)

zephyr/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ config IDF_FIRMWARE_CHIP_ID
3131
default 0x000C if SOC_SERIES_ESP32C2
3232
default 0x0005 if SOC_SERIES_ESP32C3
3333
default 0x000D if SOC_SERIES_ESP32C6
34+
default 0x0010 if IDF_TARGET_ESP32H2
3435

3536
config SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
3637
bool
@@ -68,6 +69,10 @@ config IDF_TARGET_ESP32C6
6869
bool
6970
default y if SOC_SERIES_ESP32C6
7071

72+
config IDF_TARGET_ESP32H2
73+
bool
74+
default y if SOC_SERIES_ESP32H2
75+
7176
config ESP_TIMER_IMPL_TG0_LAC
7277
bool
7378
default y

zephyr/esp32h2/CMakeLists.txt

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if(CONFIG_SOC_SERIES_ESP32H2)
4+
5+
zephyr_compile_options(-fstrict-volatile-bitfields)
6+
zephyr_compile_definitions_ifndef(CONFIG_MCUBOOT CONFIG_APP_BUILD_USE_FLASH_SECTIONS)
7+
zephyr_compile_definitions_ifndef(asm asm=__asm__)
8+
9+
zephyr_compile_definitions(CONFIG_IDF_TARGET_ARCH_RISCV)
10+
11+
if(CONFIG_MCUBOOT)
12+
zephyr_compile_options(-fdump-rtl-expand)
13+
endif()
14+
15+
zephyr_include_directories(
16+
include
17+
../port/include
18+
../common/include
19+
20+
../../components/efuse/include
21+
../../components/efuse/private_include
22+
../../components/efuse/${CONFIG_SOC_SERIES}/include
23+
../../components/efuse/${CONFIG_SOC_SERIES}/private_include
24+
25+
../../components/esp_common/include
26+
27+
../../components/esp_hw_support/dma
28+
../../components/esp_hw_support/include
29+
../../components/esp_hw_support/include/esp_private
30+
../../components/esp_hw_support/include/hal
31+
../../components/esp_hw_support/include/soc
32+
../../components/esp_hw_support/include/soc/${CONFIG_SOC_SERIES}
33+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}
34+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/private_include
35+
../../components/esp_hw_support/port/include
36+
../../components/esp_rom/${CONFIG_SOC_SERIES}
37+
../../components/esp_rom/${CONFIG_SOC_SERIES}/ld
38+
../../components/esp_rom/include/
39+
../../components/esp_rom/include/${CONFIG_SOC_SERIES}
40+
41+
../../components/esp_system/include
42+
../../components/esp_system/include/esp_private
43+
../../components/esp_system/port/include
44+
../../components/esp_system/port/include/private/esp_private
45+
../../components/esp_system/port/include/private
46+
47+
../../components/hal/${CONFIG_SOC_SERIES}/include
48+
../../components/hal/include
49+
../../components/hal/platform_port/include
50+
51+
../../components/log/include
52+
53+
../../components/soc/${CONFIG_SOC_SERIES}/include
54+
../../components/soc/${CONFIG_SOC_SERIES}/ld
55+
../../components/soc/include
56+
57+
../../components/riscv/${CONFIG_SOC_SERIES}/include
58+
../../components/riscv/include
59+
../../components/riscv/include/esp_private
60+
../../components/riscv/include/xtensa
61+
62+
../../components/esp_timer/include
63+
../../components/esp_timer/private_include
64+
65+
../../components/driver/include
66+
../../components/driver/deprecated
67+
../../components/driver/gpio/include
68+
../../components/driver/uart/include
69+
../../components/driver/spi/include
70+
71+
../../components/spi_flash/include
72+
../../components/spi_flash/include/spi_flash
73+
74+
../../components/esp_pm/include
75+
76+
../../components/bootloader_support/include
77+
../../components/bootloader_support/private_include
78+
../../components/bootloader_support/bootloader_flash/include
79+
80+
../../components/heap/include
81+
82+
../../components/esp_mm/include
83+
84+
../../components/esp_phy/include
85+
../../components/esp_phy/include/esp_private
86+
../../components/esp_phy/${CONFIG_SOC_SERIES}/include
87+
../../components/esp_event/include
88+
89+
../port/include/boot
90+
)
91+
92+
zephyr_link_libraries(
93+
gcc
94+
-T${CMAKE_CURRENT_SOURCE_DIR}/src/linker/${CONFIG_SOC_SERIES}.rom.alias.ld
95+
-T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.ld
96+
-T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.api.ld
97+
-T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.newlib.ld
98+
-T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.libgcc.ld
99+
-T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.version.ld
100+
-T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.wdt.ld
101+
-T${CMAKE_CURRENT_SOURCE_DIR}/../../components/soc/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.peripherals.ld
102+
-T${CMAKE_CURRENT_SOURCE_DIR}/../../tools/flasher_stub/ld/rom_32h2.ld
103+
)
104+
105+
zephyr_compile_definitions(ESP_PLATFORM)
106+
107+
zephyr_sources(
108+
../../components/efuse/src/esp_efuse_api.c
109+
../../components/efuse/src/esp_efuse_utility.c
110+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
111+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
112+
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
113+
)
114+
115+
if(CONFIG_SOC_FLASH_ESP32 OR NOT CONFIG_BOOTLOADER_MCUBOOT)
116+
zephyr_sources(
117+
../../components/esp_mm/esp_mmu_map.c
118+
../../components/esp_mm/port/${CONFIG_SOC_SERIES}/ext_mem_layout.c
119+
../../components/bootloader_support/src/flash_encrypt.c
120+
../../components/esp_hw_support/esp_gpio_reserve.c
121+
../../components/hal/cache_hal.c
122+
../../components/hal/mmu_hal.c
123+
../../components/hal/spi_flash_encrypt_hal_iram.c
124+
../../components/hal/spi_flash_hal.c
125+
../../components/hal/spi_flash_hal_iram.c
126+
../../components/hal/spi_flash_hal_gpspi.c
127+
../../components/spi_flash/esp_flash_api.c
128+
../../components/spi_flash/esp_flash_spi_init.c
129+
../../components/spi_flash/flash_mmap.c
130+
../../components/spi_flash/flash_ops.c
131+
../../components/spi_flash/memspi_host_driver.c
132+
../../components/spi_flash/spi_flash_chip_boya.c
133+
../../components/spi_flash/spi_flash_chip_drivers.c
134+
../../components/spi_flash/spi_flash_chip_gd.c
135+
../../components/spi_flash/spi_flash_chip_generic.c
136+
../../components/spi_flash/spi_flash_chip_issi.c
137+
../../components/spi_flash/spi_flash_chip_mxic.c
138+
../../components/spi_flash/spi_flash_chip_mxic_opi.c
139+
../../components/spi_flash/spi_flash_chip_th.c
140+
../../components/spi_flash/spi_flash_chip_winbond.c
141+
../../components/spi_flash/spi_flash_os_func_noos.c
142+
../../components/spi_flash/spi_flash_os_func_app.c
143+
)
144+
endif()
145+
146+
if (CONFIG_MCUBOOT)
147+
zephyr_sources(
148+
../port/boot/esp_image_loader.c
149+
)
150+
endif()
151+
152+
if (CONFIG_MCUBOOT OR NOT CONFIG_BOOTLOADER_MCUBOOT)
153+
zephyr_include_directories(
154+
../../components/esp_rom/${CONFIG_SOC_SERIES}
155+
)
156+
157+
zephyr_sources(
158+
../../components/bootloader_support/src/bootloader_clock_init.c
159+
../../components/hal/mpu_hal.c
160+
../../components/bootloader_support/bootloader_flash/src/flash_qio_mode.c
161+
../common/console_init.c
162+
../common/soc_init.c
163+
)
164+
endif()
165+
166+
zephyr_sources_ifdef(
167+
CONFIG_SOC_ESP32H2
168+
169+
../../components/soc/${CONFIG_SOC_SERIES}/gpio_periph.c
170+
../../components/soc/${CONFIG_SOC_SERIES}/rtc_io_periph.c
171+
../../components/soc/${CONFIG_SOC_SERIES}/temperature_sensor_periph.c
172+
173+
../../components/esp_hw_support/adc_share_hw_ctrl.c
174+
../../components/esp_hw_support/cpu.c
175+
../../components/esp_hw_support/clk_ctrl_os.c
176+
../../components/esp_hw_support/hw_random.c
177+
../../components/esp_hw_support/esp_clk.c
178+
../../components/esp_hw_support/mac_addr.c
179+
../../components/esp_hw_support/modem_clock.c
180+
../../components/esp_hw_support/periph_ctrl.c
181+
../../components/esp_hw_support/regi2c_ctrl.c
182+
../../components/esp_hw_support/sar_periph_ctrl_common.c
183+
../../components/esp_hw_support/sleep_modes.c
184+
../../components/esp_hw_support/sleep_retention.c
185+
../../components/esp_hw_support/port/esp_clk_tree_common.c
186+
../../components/esp_hw_support/port/regdma_link.c
187+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/esp_cpu_intr.c
188+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/esp_clk_tree.c
189+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/rtc_clk.c
190+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/rtc_clk_init.c
191+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/rtc_time.c
192+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/sar_periph_ctrl.c
193+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/systimer.c
194+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/pmu_init.c
195+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/pmu_param.c
196+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/pmu_sleep.c
197+
../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/cpu_region_protect.c
198+
../../components/esp_rom/patches/esp_rom_crc.c
199+
../../components/esp_rom/patches/esp_rom_sys.c
200+
../../components/esp_rom/patches/esp_rom_uart.c
201+
../../components/esp_rom/patches/esp_rom_spiflash.c
202+
../../components/esp_rom/patches/esp_rom_efuse.c
203+
../../components/esp_rom/patches/esp_rom_gpio.c
204+
../../components/esp_rom/patches/esp_rom_systimer.c
205+
../../components/esp_rom/patches/esp_rom_wdt.c
206+
../../components/esp_rom/patches/esp_rom_regi2c_esp32h2.c
207+
208+
../../components/esp_system/port/soc/${CONFIG_SOC_SERIES}/clk.c
209+
../../components/esp_system/port/soc/${CONFIG_SOC_SERIES}/system_internal.c
210+
../../components/esp_system/port/soc/${CONFIG_SOC_SERIES}/reset_reason.c
211+
../../components/esp_system/esp_err.c
212+
213+
../../components/esp_timer/src/ets_timer_legacy.c
214+
../../components/esp_timer/src/esp_timer.c
215+
../../components/esp_timer/src/esp_timer_etm.c
216+
../../components/esp_timer/src/esp_timer_impl_common.c
217+
../../components/esp_timer/src/esp_timer_impl_systimer.c
218+
../../components/esp_timer/src/system_time.c
219+
220+
../../components/hal/efuse_hal.c
221+
../../components/hal/systimer_hal.c
222+
../../components/hal/wdt_hal_iram.c
223+
../../components/hal/${CONFIG_SOC_SERIES}/clk_tree_hal.c
224+
../../components/hal/${CONFIG_SOC_SERIES}/efuse_hal.c
225+
../../components/hal/${CONFIG_SOC_SERIES}/modem_clock_hal.c
226+
../../components/hal/lp_timer_hal.c
227+
228+
../../components/log/log_noos.c
229+
../../components/log/log.c
230+
231+
../../components/riscv/interrupt.c
232+
../../components/riscv/instruction_decode.c
233+
234+
../port/heap/heap_caps_zephyr.c
235+
../port/host_flash/cache_utils.c
236+
../port/bootloader/bootloader_flash.c
237+
238+
../common/flash_init.c
239+
../common/esp_restart.c
240+
241+
src/stubs.c
242+
src/soc_random.c
243+
src/soc_init.c
244+
src/soc_flash_init.c
245+
)
246+
247+
zephyr_sources_ifdef(
248+
CONFIG_UART_ESP32
249+
../../components/hal/uart_hal.c
250+
../../components/hal/uart_hal_iram.c
251+
../../components/soc/${CONFIG_SOC_SERIES}/uart_periph.c
252+
)
253+
254+
zephyr_link_libraries_ifdef(CONFIG_NEWLIB_LIBC c)
255+
256+
endif()

zephyr/esp32h2/include/sdkconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* Aliases used on Zephyr environment */
2+
3+
/* Consider using prefix in all names when adding it */
4+
/* into zephyr source files */
5+
6+
PROVIDE ( esp_rom_uart_tx_one_char = uart_tx_one_char );
7+
PROVIDE ( esp_rom_uart_rx_one_char = uart_rx_one_char );
8+
PROVIDE ( esp_rom_uart_attach = uart_attach );
9+
PROVIDE ( esp_rom_uart_tx_wait_idle = uart_tx_wait_idle );
10+
PROVIDE ( esp_rom_intr_matrix_set = intr_matrix_set );
11+
PROVIDE ( esp_rom_ets_set_user_start = ets_set_user_start );
12+
PROVIDE ( esp_rom_ets_printf = ets_printf );
13+
PROVIDE ( esp_rom_ets_delay_us = ets_delay_us );
14+
PROVIDE ( esp_rom_cache_set_idrom_mmu_size = Cache_Set_IDROM_MMU_Size );
15+
PROVIDE ( esp_rom_Cache_Invalidate_Addr = Cache_Invalidate_Addr );
16+
PROVIDE ( esp_rom_Cache_Suspend_ICache = Cache_Suspend_ICache );
17+
PROVIDE ( esp_rom_Cache_Invalidate_ICache_All = Cache_Invalidate_ICache_All );
18+
PROVIDE ( esp_rom_Cache_Dbus_MMU_Set = Cache_Dbus_MMU_Set );
19+
PROVIDE ( esp_rom_Cache_Ibus_MMU_Set = Cache_Ibus_MMU_Set );
20+
PROVIDE ( esp_rom_Cache_Resume_ICache = Cache_Resume_ICache );
21+
PROVIDE ( esp_rom_gpio_matrix_in = gpio_matrix_in );
22+
PROVIDE ( esp_rom_gpio_matrix_out = gpio_matrix_out );
23+
PROVIDE ( esp_rom_usb_uart_rx_one_char = usb_uart_rx_one_char);
24+
PROVIDE ( esp_rom_usb_uart_tx_one_char = usb_uart_tx_one_char);

0 commit comments

Comments
 (0)