Skip to content

Commit

Permalink
Initial build support for esp32c6.
Browse files Browse the repository at this point in the history
Plus fixup of module selection for a variety of targets.
  • Loading branch information
jmattsson committed Mar 27, 2024
1 parent a7030ea commit c5d64a2
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 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']
target: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6']

runs-on: ubuntu-20.04

Expand Down
11 changes: 7 additions & 4 deletions components/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(module_srcs
"otaupgrade.c"
"ow.c"
"pipe.c"
"rmt.c"
"rtcmem.c"
"qrcodegen.c"
"sigma_delta.c"
Expand Down Expand Up @@ -52,25 +53,27 @@ if(IDF_TARGET STREQUAL "esp32")
"eth.c"
"i2s.c"
"pulsecnt.c"
"rmt.c"
"sdmmc.c"
"touch.c"
)
elseif(IDF_TARGET STREQUAL "esp32s2")
list(APPEND module_srcs
"dac.c"
"pulsecnt.c"
"rmt.c"
)
elseif(IDF_TARGET STREQUAL "esp32s3")
list(APPEND module_srcs
"dac.c"
"pulsecnt.c"
"rmt.c"
"sdmmc.c"
)
elseif(IDF_TARGET STREQUAL "esp32c3")
list(APPEND module_srcs
"rmt.c"
)
elseif(IDF_TARGET STREQUAL "esp32c6")
list(APPEND module_srcs
"dac.c"
"pulsecnt.c"
)
endif()

Expand Down
6 changes: 3 additions & 3 deletions components/modules/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ menu "NodeMCU modules"
Includes the crypto module.

config NODEMCU_CMODULE_DAC
depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2
depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32_C6
bool "DAC module"
default "n"
help
Expand Down Expand Up @@ -204,7 +204,7 @@ menu "NodeMCU modules"
Includes the pipe module (required by our Lua VM).

config NODEMCU_CMODULE_PULSECNT
depends on IDF_TARGET_ESP32
depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C6
bool "Pulse counter module"
default "n"
help
Expand Down Expand Up @@ -233,7 +233,7 @@ menu "NodeMCU modules"
the battery backed memory.

config NODEMCU_CMODULE_SDMMC
depends on IDF_TARGET_ESP32
depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S3
bool "SD-MMC module"
default "n"
help
Expand Down
17 changes: 13 additions & 4 deletions components/modules/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,30 @@ static int node_bootreason( lua_State *L)
case EXT_CPU_RESET:
#endif
case DEEPSLEEP_RESET:
#if defined(CONFIG_IDF_TARGET_ESP32)
#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)
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)
case EFUSE_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)
#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)
case USB_UART_CHIP_RESET:
case USB_JTAG_CHIP_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)
case POWER_GLITCH_RESET:
#endif
case TG0WDT_SYS_RESET:
case TG1WDT_SYS_RESET:
#if !defined(CONFIG_IDF_TARGET_ESP32C6)
case INTRUSION_RESET:
#endif
case RTCWDT_BROWN_OUT_RESET:
case RTCWDT_RTC_RESET:
rawinfo = 3; break;
Expand Down Expand Up @@ -262,7 +271,7 @@ static int node_sleep (lua_State *L)
esp_sleep_enable_timer_wakeup(usecs);
}

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

#if !defined(CONFIG_IDF_TARGET_ESP32C3)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6)
bool pull = opt_checkbool(L, "pull", false);
if (opt_get(L, "isolate", LUA_TTABLE)) {
for (int i = 1; ; i++) {
Expand Down
1 change: 1 addition & 0 deletions components/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ menu "NodeMCU platform config"
default y if IDF_TARGET_ESP32S2
default y if IDF_TARGET_ESP32S3
default y if IDF_TARGET_ESP32C3
default y if IDF_TARGET_ESP32C6
default y if IDF_TARGET_ESP32H2

config NODEMCU_UART_AT_LEAST_3
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)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6)
// attach GPIO to previous pin
if (gpio_num < 32) {
GPIO.enable_w1ts = (0x1 << gpio_num);
Expand Down
2 changes: 1 addition & 1 deletion components/uzlib/uzlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define uz_malloc malloc
#define uz_free free

#if defined(__XTENSA__) || defined(CONFIG_IDF_TARGET_ESP32C3)
#if defined(CONFIG_IDF_TARGET)

#define UZLIB_THROW(v) longjmp(unwindAddr, (v))
#define UZLIB_SETJMP setjmp
Expand Down

0 comments on commit c5d64a2

Please sign in to comment.