Skip to content

Commit

Permalink
Initial build support for esp32h2.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattsson committed Mar 27, 2024
1 parent d8b7ca7 commit 15ee369
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
matrix:
lua_ver: ['5.1', '5.3']
numbers: ['default', 'alternate']
target: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6']
target: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']

runs-on: ubuntu-20.04

Expand Down
19 changes: 14 additions & 5 deletions components/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Modules common to all chips
set(wifi_modules
"espnow.c"
"wifi.c"
"wifi_ap.c"
"wifi_common.c"
"wifi_sta.c"
)
set(module_srcs
"adc.c"
"bit.c"
Expand All @@ -8,7 +15,6 @@ set(module_srcs
"dht.c"
"encoder.c"
"eromfs.c"
"espnow.c"
"file.c"
"gpio.c"
"heaptrace.c"
Expand Down Expand Up @@ -38,10 +44,6 @@ set(module_srcs
"u8g2.c"
"uart.c"
"ucg.c"
"wifi.c"
"wifi_ap.c"
"wifi_common.c"
"wifi_sta.c"
"ws2812.c"
)

Expand All @@ -56,17 +58,20 @@ if(IDF_TARGET STREQUAL "esp32")
"pulsecnt.c"
"sdmmc.c"
"touch.c"
${wifi_modules}
)
elseif(IDF_TARGET STREQUAL "esp32s2")
list(APPEND module_srcs
"dac.c"
"pulsecnt.c"
${wifi_modules}
)
elseif(IDF_TARGET STREQUAL "esp32s3")
list(APPEND module_srcs
"dac.c"
"pulsecnt.c"
"sdmmc.c"
${wifi_modules}
)
elseif(IDF_TARGET STREQUAL "esp32c3")
list(APPEND module_srcs
Expand All @@ -75,6 +80,10 @@ elseif(IDF_TARGET STREQUAL "esp32c6")
list(APPEND module_srcs
"dac.c"
"pulsecnt.c"
${wifi_modules}
)
elseif(IDF_TARGET STREQUAL "esp32h2")
list(APPEND module_srcs
)
endif()

Expand Down
2 changes: 2 additions & 0 deletions components/modules/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ menu "NodeMCU modules"
does.

config NODEMCU_CMODULE_ESPNOW
depends on !IDF_TARGET_ESP32H2
bool "ESP-NOW module"
default "n"
help
Expand Down Expand Up @@ -309,6 +310,7 @@ menu "NodeMCU modules"
rsource "../ucg/Kconfig.ucg"

config NODEMCU_CMODULE_WIFI
depends on !IDF_TARGET_ESP32H2
bool "WiFi module"
default "y"
help
Expand Down
12 changes: 6 additions & 6 deletions components/modules/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,20 @@ static int node_bootreason( lua_State *L)
#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32C6)
case SDIO_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32H2)
case GLITCH_RTC_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
case EFUSE_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32C6)
case JTAG_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
case USB_UART_CHIP_RESET:
case USB_JTAG_CHIP_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32H2)
case POWER_GLITCH_RESET:
#endif
case TG0WDT_SYS_RESET:
Expand Down Expand Up @@ -271,7 +271,7 @@ static int node_sleep (lua_State *L)
esp_sleep_enable_timer_wakeup(usecs);
}

#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
// touch option: boolean
if (opt_checkbool(L, "touch", false)) {
int err = esp_sleep_enable_touchpad_wakeup();
Expand Down Expand Up @@ -344,7 +344,7 @@ static int node_dsleep (lua_State *L)
}
}

#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
bool pull = opt_checkbool(L, "pull", false);
if (opt_get(L, "isolate", LUA_TTABLE)) {
for (int i = 1; ; i++) {
Expand Down
2 changes: 1 addition & 1 deletion components/platform/onewire.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int onewire_rmt_attach_pin( uint8_t gpio_num )
return PLATFORM_ERR;

if (gpio_num != ow_rmt.gpio) {
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
// attach GPIO to previous pin
if (gpio_num < 32) {
GPIO.enable_w1ts = (0x1 << gpio_num);
Expand Down

0 comments on commit 15ee369

Please sign in to comment.