diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 6095f88e727..3eb020c09a3 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -90,6 +90,7 @@ if [ "$BUILD_LOG" -eq 1 ]; then fi #build sketches for different targets +build "esp32c5" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}" build "esp32p4" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}" build "esp32s3" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}" build "esp32s2" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}" diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index e536da50111..323f39b3afc 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -156,6 +156,7 @@ function build_sketch { # build_sketch [ext esp32c6_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g') esp32h2_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g') esp32p4_opts=$(echo "PSRAM=enabled,USBMode=default,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g') + esp32c5_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g') # Select the common part of the FQBN based on the target. The rest will be # appended depending on the passed options. @@ -191,6 +192,10 @@ function build_sketch { # build_sketch [ext [ -n "${options:-$esp32p4_opts}" ] && opt=":${options:-$esp32p4_opts}" fqbn="espressif:esp32:esp32p4$opt" ;; + "esp32c5") + [ -n "${options:-$esp32c5_opts}" ] && opt=":${options:-$esp32c5_opts}" + fqbn="espressif:esp32:esp32c5$opt" + ;; *) echo "ERROR: Invalid chip: $target" exit 1 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d98da24fc07..3ce67700a88 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -47,6 +47,7 @@ on: - "variants/esp32/**/*" - "variants/esp32c2/**/*" - "variants/esp32c3/**/*" + - "variants/esp32c5/**/*" - "variants/esp32c6/**/*" - "variants/esp32h2/**/*" - "variants/esp32p4/**/*" diff --git a/CMakeLists.txt b/CMakeLists.txt index 14fcb19b6da..5ba9c999d81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ # idf.py build set(min_supported_idf_version "5.3.0") -set(max_supported_idf_version "5.4.99") +set(max_supported_idf_version "5.5.99") set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}") if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}") diff --git a/boards.txt b/boards.txt index f0df27762c2..f3ea60dc46b 100644 --- a/boards.txt +++ b/boards.txt @@ -161,6 +161,217 @@ esp32c2.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +esp32c5.name=ESP32C5 Dev Module + +esp32c5.bootloader.tool=esptool_py +esp32c5.bootloader.tool.default=esptool_py + +esp32c5.upload.tool=esptool_py +esp32c5.upload.tool.default=esptool_py +esp32c5.upload.tool.network=esp_ota + +esp32c5.upload.maximum_size=1310720 +esp32c5.upload.maximum_data_size=327680 +esp32c5.upload.flags= +esp32c5.upload.extra_flags= +esp32c5.upload.use_1200bps_touch=false +esp32c5.upload.wait_for_upload_port=false + +esp32c5.serial.disableDTR=false +esp32c5.serial.disableRTS=false + +esp32c5.build.tarch=riscv32 +esp32c5.build.target=esp +esp32c5.build.mcu=esp32c5 +esp32c5.build.core=esp32 +esp32c5.build.variant=esp32c5 +esp32c5.build.board=ESP32C5_DEV +esp32c5.build.bootloader_addr=0x2000 + +esp32c5.build.cdc_on_boot=0 +esp32c5.build.f_cpu=240000000L +esp32c5.build.flash_size=4MB +esp32c5.build.flash_freq=80m +esp32c5.build.flash_mode=qio +esp32c5.build.boot=qio +esp32c5.build.partitions=default +esp32c5.build.defines= + +## IDE 2.0 Seems to not update the value +esp32c5.menu.JTAGAdapter.default=Disabled +esp32c5.menu.JTAGAdapter.default.build.copy_jtag_files=0 +esp32c5.menu.JTAGAdapter.builtin=Integrated USB JTAG +esp32c5.menu.JTAGAdapter.builtin.build.openocdscript=esp32c5-builtin.cfg +esp32c5.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +esp32c5.menu.JTAGAdapter.external=FTDI Adapter +esp32c5.menu.JTAGAdapter.external.build.openocdscript=esp32c5-ftdi.cfg +esp32c5.menu.JTAGAdapter.external.build.copy_jtag_files=1 +esp32c5.menu.JTAGAdapter.bridge=ESP USB Bridge +esp32c5.menu.JTAGAdapter.bridge.build.openocdscript=esp32c5-bridge.cfg +esp32c5.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +esp32c5.menu.PSRAM.disabled=Disabled +esp32c5.menu.PSRAM.disabled.build.defines= +esp32c5.menu.PSRAM.enabled=Enabled +esp32c5.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM + +esp32c5.menu.CDCOnBoot.default=Disabled +esp32c5.menu.CDCOnBoot.default.build.cdc_on_boot=0 +esp32c5.menu.CDCOnBoot.cdc=Enabled +esp32c5.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +esp32c5.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +esp32c5.menu.PartitionScheme.default.build.partitions=default +esp32c5.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +esp32c5.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +esp32c5.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +esp32c5.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +esp32c5.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +esp32c5.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +esp32c5.menu.PartitionScheme.minimal.build.partitions=minimal +esp32c5.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2) +esp32c5.menu.PartitionScheme.no_fs.build.partitions=no_fs +esp32c5.menu.PartitionScheme.no_fs.upload.maximum_size=2031616 +esp32c5.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +esp32c5.menu.PartitionScheme.no_ota.build.partitions=no_ota +esp32c5.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +esp32c5.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +esp32c5.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +esp32c5.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +esp32c5.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +esp32c5.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +esp32c5.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +esp32c5.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +esp32c5.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +esp32c5.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +esp32c5.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +esp32c5.menu.PartitionScheme.huge_app.build.partitions=huge_app +esp32c5.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +esp32c5.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +esp32c5.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +esp32c5.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +esp32c5.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +esp32c5.menu.PartitionScheme.fatflash.build.partitions=ffat +esp32c5.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +esp32c5.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +esp32c5.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +esp32c5.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +esp32c5.menu.PartitionScheme.rainmaker=RainMaker 4MB +esp32c5.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +esp32c5.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080 +esp32c5.menu.PartitionScheme.rainmaker_4MB=RainMaker 4MB No OTA +esp32c5.menu.PartitionScheme.rainmaker_4MB.build.partitions=rainmaker_4MB_no_ota +esp32c5.menu.PartitionScheme.rainmaker_4MB.upload.maximum_size=4038656 +esp32c5.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB +esp32c5.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB +esp32c5.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 +esp32c5.menu.PartitionScheme.zigbee_2MB=Zigbee 2MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_2MB.build.partitions=zigbee_2MB +esp32c5.menu.PartitionScheme.zigbee_2MB.upload.maximum_size=1310720 +esp32c5.menu.PartitionScheme.zigbee=Zigbee 4MB with spiffs +esp32c5.menu.PartitionScheme.zigbee.build.partitions=zigbee +esp32c5.menu.PartitionScheme.zigbee.upload.maximum_size=1310720 +esp32c5.menu.PartitionScheme.zigbee_8MB=Zigbee 8MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_8MB.build.partitions=zigbee_8MB +esp32c5.menu.PartitionScheme.zigbee_8MB.upload.maximum_size=3407872 +esp32c5.menu.PartitionScheme.zigbee_zczr_2MB=Zigbee ZCZR 2MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_zczr_2MB.build.partitions=zigbee_zczr_2MB +esp32c5.menu.PartitionScheme.zigbee_zczr_2MB.upload.maximum_size=1310720 +esp32c5.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr +esp32c5.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +esp32c5.menu.PartitionScheme.zigbee_zczr_8MB=Zigbee ZCZR 8MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_zczr_8MB.build.partitions=zigbee_zczr_8MB +esp32c5.menu.PartitionScheme.zigbee_zczr_8MB.upload.maximum_size=3407872 +esp32c5.menu.PartitionScheme.custom=Custom +esp32c5.menu.PartitionScheme.custom.build.partitions= +esp32c5.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +esp32c5.menu.CPUFreq.240=240MHz (WiFi) +esp32c5.menu.CPUFreq.240.build.f_cpu=240000000L +esp32c5.menu.CPUFreq.120=120MHz (WiFi) +esp32c5.menu.CPUFreq.120.build.f_cpu=120000000L +esp32c5.menu.CPUFreq.80=80MHz (WiFi) +esp32c5.menu.CPUFreq.80.build.f_cpu=80000000L +esp32c5.menu.CPUFreq.40=40MHz +esp32c5.menu.CPUFreq.40.build.f_cpu=40000000L +esp32c5.menu.CPUFreq.20=20MHz +esp32c5.menu.CPUFreq.20.build.f_cpu=20000000L +esp32c5.menu.CPUFreq.10=10MHz +esp32c5.menu.CPUFreq.10.build.f_cpu=10000000L + +esp32c5.menu.FlashMode.qio=QIO +esp32c5.menu.FlashMode.qio.build.flash_mode=dio +esp32c5.menu.FlashMode.qio.build.boot=qio +esp32c5.menu.FlashMode.dio=DIO +esp32c5.menu.FlashMode.dio.build.flash_mode=dio +esp32c5.menu.FlashMode.dio.build.boot=dio + +esp32c5.menu.FlashFreq.80=80MHz +esp32c5.menu.FlashFreq.80.build.flash_freq=80m +esp32c5.menu.FlashFreq.40=40MHz +esp32c5.menu.FlashFreq.40.build.flash_freq=40m + +esp32c5.menu.FlashSize.4M=4MB (32Mb) +esp32c5.menu.FlashSize.4M.build.flash_size=4MB +esp32c5.menu.FlashSize.8M=8MB (64Mb) +esp32c5.menu.FlashSize.8M.build.flash_size=8MB +esp32c5.menu.FlashSize.2M=2MB (16Mb) +esp32c5.menu.FlashSize.2M.build.flash_size=2MB +esp32c5.menu.FlashSize.16M=16MB (128Mb) +esp32c5.menu.FlashSize.16M.build.flash_size=16MB + +esp32c5.menu.UploadSpeed.921600=921600 +esp32c5.menu.UploadSpeed.921600.upload.speed=921600 +esp32c5.menu.UploadSpeed.115200=115200 +esp32c5.menu.UploadSpeed.115200.upload.speed=115200 +esp32c5.menu.UploadSpeed.256000.windows=256000 +esp32c5.menu.UploadSpeed.256000.upload.speed=256000 +esp32c5.menu.UploadSpeed.230400.windows.upload.speed=256000 +esp32c5.menu.UploadSpeed.230400=230400 +esp32c5.menu.UploadSpeed.230400.upload.speed=230400 +esp32c5.menu.UploadSpeed.460800.linux=460800 +esp32c5.menu.UploadSpeed.460800.macosx=460800 +esp32c5.menu.UploadSpeed.460800.upload.speed=460800 +esp32c5.menu.UploadSpeed.512000.windows=512000 +esp32c5.menu.UploadSpeed.512000.upload.speed=512000 + +esp32c5.menu.DebugLevel.none=None +esp32c5.menu.DebugLevel.none.build.code_debug=0 +esp32c5.menu.DebugLevel.error=Error +esp32c5.menu.DebugLevel.error.build.code_debug=1 +esp32c5.menu.DebugLevel.warn=Warn +esp32c5.menu.DebugLevel.warn.build.code_debug=2 +esp32c5.menu.DebugLevel.info=Info +esp32c5.menu.DebugLevel.info.build.code_debug=3 +esp32c5.menu.DebugLevel.debug=Debug +esp32c5.menu.DebugLevel.debug.build.code_debug=4 +esp32c5.menu.DebugLevel.verbose=Verbose +esp32c5.menu.DebugLevel.verbose.build.code_debug=5 + +esp32c5.menu.EraseFlash.none=Disabled +esp32c5.menu.EraseFlash.none.upload.erase_cmd= +esp32c5.menu.EraseFlash.all=Enabled +esp32c5.menu.EraseFlash.all.upload.erase_cmd=-e + +esp32c5.menu.ZigbeeMode.default=Disabled +esp32c5.menu.ZigbeeMode.default.build.zigbee_mode= +esp32c5.menu.ZigbeeMode.default.build.zigbee_libs= +esp32c5.menu.ZigbeeMode.ed=Zigbee ED (end device) +esp32c5.menu.ZigbeeMode.ed.build.zigbee_mode=-DZIGBEE_MODE_ED +esp32c5.menu.ZigbeeMode.ed.build.zigbee_libs=-lesp_zb_api.ed -lzboss_stack.ed -lzboss_port.native +esp32c5.menu.ZigbeeMode.zczr=Zigbee ZCZR (coordinator/router) +esp32c5.menu.ZigbeeMode.zczr.build.zigbee_mode=-DZIGBEE_MODE_ZCZR +esp32c5.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api.zczr -lzboss_stack.zczr -lzboss_port.native +esp32c5.menu.ZigbeeMode.ed_debug=Zigbee ED (end device) - Debug +esp32c5.menu.ZigbeeMode.ed_debug.build.zigbee_mode=-DZIGBEE_MODE_ED +esp32c5.menu.ZigbeeMode.ed_debug.build.zigbee_libs=-lesp_zb_api.ed.debug -lzboss_stack.ed.debug -lzboss_port.native.debug +esp32c5.menu.ZigbeeMode.zczr_debug=Zigbee ZCZR (coordinator/router) - Debug +esp32c5.menu.ZigbeeMode.zczr_debug.build.zigbee_mode=-DZIGBEE_MODE_ZCZR +esp32c5.menu.ZigbeeMode.zczr_debug.build.zigbee_libs=-lesp_zb_api.zczr.debug -lzboss_stack.zczr.debug -lzboss_port.native.debug + +############################################################## + esp32p4.name=ESP32P4 Dev Module esp32p4.bootloader.tool=esptool_py diff --git a/cores/esp32/Esp.cpp b/cores/esp32/Esp.cpp index 9f90a828b25..f911b2d5f20 100644 --- a/cores/esp32/Esp.cpp +++ b/cores/esp32/Esp.cpp @@ -21,6 +21,7 @@ #include "Esp.h" #include "esp_sleep.h" #include "spi_flash_mmap.h" +#include "esp_idf_version.h" #include #include #include @@ -63,6 +64,9 @@ extern "C" { #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32p4 is located at 0x2000 +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/spi_flash.h" +#define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32c5 is located at 0x2000 #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -301,7 +305,12 @@ const char *EspClass::getChipModel(void) { case CHIP_ESP32C6: return "ESP32-C6"; case CHIP_ESP32H2: return "ESP32-H2"; case CHIP_ESP32P4: return "ESP32-P4"; - default: return "UNKNOWN"; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) + case CHIP_ESP32C5: return "ESP32-C5"; + case CHIP_ESP32C61: return "ESP32-C61"; + case CHIP_ESP32H21: return "ESP32-H21"; +#endif + default: return "UNKNOWN"; } #endif } diff --git a/cores/esp32/HardwareSerial.h b/cores/esp32/HardwareSerial.h index e974f112701..bd24e0eec0e 100644 --- a/cores/esp32/HardwareSerial.h +++ b/cores/esp32/HardwareSerial.h @@ -162,6 +162,8 @@ typedef enum { #define SOC_RX0 (gpio_num_t)23 #elif CONFIG_IDF_TARGET_ESP32P4 #define SOC_RX0 (gpio_num_t)38 +#elif CONFIG_IDF_TARGET_ESP32C5 +#define SOC_RX0 (gpio_num_t)12 #endif #endif @@ -180,6 +182,8 @@ typedef enum { #define SOC_TX0 (gpio_num_t)24 #elif CONFIG_IDF_TARGET_ESP32P4 #define SOC_TX0 (gpio_num_t)37 +#elif CONFIG_IDF_TARGET_ESP32C5 +#define SOC_TX0 (gpio_num_t)11 #endif #endif @@ -203,6 +207,8 @@ typedef enum { #define RX1 (gpio_num_t)0 #elif CONFIG_IDF_TARGET_ESP32P4 #define RX1 (gpio_num_t)11 +#elif CONFIG_IDF_TARGET_ESP32C5 +#define RX1 (gpio_num_t)4 #endif #endif @@ -223,6 +229,8 @@ typedef enum { #define TX1 (gpio_num_t)1 #elif CONFIG_IDF_TARGET_ESP32P4 #define TX1 (gpio_num_t)10 +#elif CONFIG_IDF_TARGET_ESP32C5 +#define TX1 (gpio_num_t)5 #endif #endif #endif /* SOC_UART_HP_NUM > 1 */ diff --git a/cores/esp32/chip-debug-report.cpp b/cores/esp32/chip-debug-report.cpp index daafef3cab9..281c7bdb62d 100644 --- a/cores/esp32/chip-debug-report.cpp +++ b/cores/esp32/chip-debug-report.cpp @@ -67,6 +67,9 @@ static void printPkgVersion(void) { #elif CONFIG_IDF_TARGET_ESP32P4 uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SYS_2_REG, EFUSE_PKG_VERSION); chip_report_printf("%lu", pkg_ver); +#elif CONFIG_IDF_TARGET_ESP32C5 + uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SYS2_REG, EFUSE_PKG_VERSION); + chip_report_printf("%lu", pkg_ver); #else chip_report_printf("Unknown"); #endif @@ -88,6 +91,11 @@ static void printChipInfo(void) { case CHIP_ESP32C6: chip_report_printf("ESP32-C6\n"); break; case CHIP_ESP32H2: chip_report_printf("ESP32-H2\n"); break; case CHIP_ESP32P4: chip_report_printf("ESP32-P4\n"); break; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) + case CHIP_ESP32C5: chip_report_printf("ESP32-C5\n"); break; + case CHIP_ESP32C61: chip_report_printf("ESP32-C61\n"); break; + case CHIP_ESP32H21: chip_report_printf("ESP32-H21\n"); break; +#endif default: chip_report_printf("Unknown %d\n", info.model); break; } printPkgVersion(); diff --git a/cores/esp32/esp32-hal-cpu.c b/cores/esp32/esp32-hal-cpu.c index 1ffde860792..30c7e3a2b0a 100644 --- a/cores/esp32/esp32-hal-cpu.c +++ b/cores/esp32/esp32-hal-cpu.c @@ -19,7 +19,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "soc/rtc.h" -#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) +#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5) #include "soc/rtc_cntl_reg.h" #include "soc/syscon_reg.h" #endif @@ -48,6 +48,8 @@ #include "esp32h2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -179,7 +181,7 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz) { rtc_cpu_freq_config_t conf, cconf; uint32_t capb, apb; //Get XTAL Frequency and calculate min CPU MHz -#if (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4)) +#if (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5)) rtc_xtal_freq_t xtal = rtc_clk_xtal_freq_get(); #endif #if CONFIG_IDF_TARGET_ESP32 @@ -195,7 +197,7 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz) { } } #endif -#if (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4)) +#if (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5)) if (cpu_freq_mhz > xtal && cpu_freq_mhz != 240 && cpu_freq_mhz != 160 && cpu_freq_mhz != 120 && cpu_freq_mhz != 80) { if (xtal >= RTC_XTAL_FREQ_40M) { log_e("Bad frequency: %u MHz! Options are: 240, 160, 120, 80, %u, %u and %u MHz", cpu_freq_mhz, xtal, xtal / 2, xtal / 4); @@ -265,6 +267,12 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz) { (conf.source == SOC_CPU_CLK_SRC_PLL) ? "PLL" : ((conf.source == SOC_CPU_CLK_SRC_APLL) ? "APLL" : ((conf.source == SOC_CPU_CLK_SRC_XTAL) ? "XTAL" : "8M")), conf.source_freq_mhz, conf.div, conf.freq_mhz, apb ); +#elif defined(CONFIG_IDF_TARGET_ESP32C5) + log_d( + "%s: %u / %u = %u Mhz, APB: %u Hz", + (conf.source == SOC_CPU_CLK_SRC_PLL_F240M || conf.source == SOC_CPU_CLK_SRC_PLL_F160M) ? "PLL" : ((conf.source == SOC_CPU_CLK_SRC_XTAL) ? "XTAL" : "8M"), + conf.source_freq_mhz, conf.div, conf.freq_mhz, apb + ); #else log_d( "%s: %u / %u = %u Mhz, APB: %u Hz", (conf.source == SOC_CPU_CLK_SRC_PLL) ? "PLL" : ((conf.source == SOC_CPU_CLK_SRC_XTAL) ? "XTAL" : "17.5M"), diff --git a/cores/esp32/esp32-hal-i2c-slave.c b/cores/esp32/esp32-hal-i2c-slave.c index 46c3a4d58c2..0e01259da61 100644 --- a/cores/esp32/esp32-hal-i2c-slave.c +++ b/cores/esp32/esp32-hal-i2c-slave.c @@ -43,7 +43,9 @@ #include "soc/i2c_struct.h" #include "soc/periph_defs.h" #include "hal/i2c_ll.h" +#ifndef CONFIG_IDF_TARGET_ESP32C5 #include "hal/clk_gate_ll.h" +#endif #include "esp32-hal-log.h" #include "esp32-hal-i2c-slave.h" #include "esp32-hal-periman.h" @@ -325,7 +327,7 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t frequency = 100000L; } frequency = (frequency * 5) / 4; -#if !defined(CONFIG_IDF_TARGET_ESP32P4) +#if !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5) if (i2c->num == 0) { periph_ll_enable_clk_clear_rst(PERIPH_I2C0_MODULE); #if SOC_HP_I2C_NUM > 1 @@ -556,6 +558,9 @@ static bool i2c_slave_set_frequency(i2c_slave_struct_t *i2c, uint32_t clk_speed) i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_APB); /*!< I2C source clock from APB, 80M*/ } #elif SOC_I2C_SUPPORT_XTAL +#ifndef XTAL_CLK_FREQ +#define XTAL_CLK_FREQ APB_CLK_FREQ +#endif i2c_ll_master_cal_bus_clk(XTAL_CLK_FREQ, clk_speed, &clk_cal); I2C_CLOCK_SRC_ATOMIC() { i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_XTAL); /*!< I2C source clock from XTAL, 40M */ diff --git a/cores/esp32/esp32-hal-matrix.c b/cores/esp32/esp32-hal-matrix.c index 7cddb4e04db..0d81e979f2b 100644 --- a/cores/esp32/esp32-hal-matrix.c +++ b/cores/esp32/esp32-hal-matrix.c @@ -34,6 +34,8 @@ #include "esp32h2/rom/gpio.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/gpio.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 594acd38153..6b46f688305 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -30,7 +30,7 @@ #endif //CONFIG_BT_BLUEDROID_ENABLED #include #include "soc/rtc.h" -#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) +#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5) #include "soc/rtc_cntl_reg.h" #include "soc/syscon_reg.h" #endif @@ -56,6 +56,8 @@ #include "esp32h2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported diff --git a/cores/esp32/esp32-hal-psram.c b/cores/esp32/esp32-hal-psram.c index 3c7a51c3343..0d57a67ede4 100644 --- a/cores/esp32/esp32-hal-psram.c +++ b/cores/esp32/esp32-hal-psram.c @@ -29,6 +29,8 @@ #include "esp32s3/rom/cache.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/cache.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/cache.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 80928309670..4cff353d76c 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -26,7 +26,9 @@ #include "soc/io_mux_reg.h" #include "soc/gpio_sig_map.h" #include "soc/rtc.h" +#ifndef CONFIG_IDF_TARGET_ESP32C5 #include "hal/clk_gate_ll.h" +#endif #include "esp32-hal-periman.h" #include "esp_private/periph_ctrl.h" @@ -60,6 +62,9 @@ #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/ets_sys.h" #include "esp32p4/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/ets_sys.h" +#include "esp32c5/rom/gpio.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -119,7 +124,7 @@ struct spi_struct_t { #define SPI_SS_IDX(p, n) ((p == 0) ? SPI_FSPI_SS_IDX(n) : ((p == 1) ? SPI_HSPI_SS_IDX(n) : 0)) -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5 // ESP32C3 #define SPI_COUNT (1) @@ -161,7 +166,7 @@ static spi_t _spi_bus_array[] = { {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1} #elif CONFIG_IDF_TARGET_ESP32C3 {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1} -#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 +#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5 {(spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1} #else {(volatile spi_dev_t *)(DR_REG_SPI0_BASE), 0, -1, -1, -1, -1}, @@ -188,7 +193,7 @@ static spi_t _spi_bus_array[] = { {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1} #elif CONFIG_IDF_TARGET_ESP32C3 {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1} -#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 +#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5 {(spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1} #else {(volatile spi_dev_t *)(DR_REG_SPI0_BASE), NULL, 0, -1, -1, -1, -1}, @@ -685,7 +690,7 @@ spi_t *spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_t spi->dev->user.doutdin = 1; int i; for (i = 0; i < 16; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = 0x00000000; #else spi->dev->data_buf[i] = 0x00000000; @@ -733,7 +738,7 @@ void spiWrite(spi_t *spi, const uint32_t *data, uint8_t len) { spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif for (i = 0; i < len; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; @@ -760,7 +765,7 @@ void spiTransfer(spi_t *spi, uint32_t *data, uint8_t len) { spi->dev->mosi_dlen.usr_mosi_dbitlen = (len * 32) - 1; spi->dev->miso_dlen.usr_miso_dbitlen = (len * 32) - 1; for (i = 0; i < len; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; @@ -773,7 +778,7 @@ void spiTransfer(spi_t *spi, uint32_t *data, uint8_t len) { spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); for (i = 0; i < len; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data[i] = spi->dev->data_buf[i].val; #else data[i] = spi->dev->data_buf[i]; @@ -791,7 +796,7 @@ void spiWriteByte(spi_t *spi, uint8_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -813,7 +818,7 @@ uint8_t spiTransferByte(spi_t *spi, uint8_t data) { SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 7; spi->dev->miso_dlen.usr_miso_dbitlen = 7; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -824,7 +829,7 @@ uint8_t spiTransferByte(spi_t *spi, uint8_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val & 0xFF; #else data = spi->dev->data_buf[0] & 0xFF; @@ -854,7 +859,7 @@ void spiWriteWord(spi_t *spi, uint16_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -878,7 +883,7 @@ uint16_t spiTransferWord(spi_t *spi, uint16_t data) { SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 15; spi->dev->miso_dlen.usr_miso_dbitlen = 15; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -889,7 +894,7 @@ uint16_t spiTransferWord(spi_t *spi, uint16_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val; #else data = spi->dev->data_buf[0]; @@ -913,7 +918,7 @@ void spiWriteLong(spi_t *spi, uint32_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -937,7 +942,7 @@ uint32_t spiTransferLong(spi_t *spi, uint32_t data) { SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 31; spi->dev->miso_dlen.usr_miso_dbitlen = 31; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -948,7 +953,7 @@ uint32_t spiTransferLong(spi_t *spi, uint32_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val; #else data = spi->dev->data_buf[0]; @@ -987,7 +992,7 @@ static void __spiTransferBytes(spi_t *spi, const uint8_t *data, uint8_t *out, ui spi->dev->miso_dlen.usr_miso_dbitlen = ((bytes * 8) - 1); for (i = 0; i < words; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = wordsBuf[i]; //copy buffer to spi fifo #else spi->dev->data_buf[i] = wordsBuf[i]; //copy buffer to spi fifo @@ -1004,7 +1009,7 @@ static void __spiTransferBytes(spi_t *spi, const uint8_t *data, uint8_t *out, ui if (out) { for (i = 0; i < words; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 wordsBuf[i] = spi->dev->data_buf[i].val; //copy spi fifo to buffer #else wordsBuf[i] = spi->dev->data_buf[i]; //copy spi fifo to buffer @@ -1145,7 +1150,7 @@ void ARDUINO_ISR_ATTR spiWriteByteNL(spi_t *spi, uint8_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1164,7 +1169,7 @@ uint8_t spiTransferByteNL(spi_t *spi, uint8_t data) { } spi->dev->mosi_dlen.usr_mosi_dbitlen = 7; spi->dev->miso_dlen.usr_miso_dbitlen = 7; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1175,7 +1180,7 @@ uint8_t spiTransferByteNL(spi_t *spi, uint8_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val & 0xFF; #else data = spi->dev->data_buf[0] & 0xFF; @@ -1194,7 +1199,7 @@ void ARDUINO_ISR_ATTR spiWriteShortNL(spi_t *spi, uint16_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1216,7 +1221,7 @@ uint16_t spiTransferShortNL(spi_t *spi, uint16_t data) { } spi->dev->mosi_dlen.usr_mosi_dbitlen = 15; spi->dev->miso_dlen.usr_miso_dbitlen = 15; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1227,7 +1232,7 @@ uint16_t spiTransferShortNL(spi_t *spi, uint16_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val & 0xFFFF; #else data = spi->dev->data_buf[0] & 0xFFFF; @@ -1249,7 +1254,7 @@ void ARDUINO_ISR_ATTR spiWriteLongNL(spi_t *spi, uint32_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1271,7 +1276,7 @@ uint32_t spiTransferLongNL(spi_t *spi, uint32_t data) { } spi->dev->mosi_dlen.usr_mosi_dbitlen = 31; spi->dev->miso_dlen.usr_miso_dbitlen = 31; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1282,7 +1287,7 @@ uint32_t spiTransferLongNL(spi_t *spi, uint32_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val; #else data = spi->dev->data_buf[0]; @@ -1313,7 +1318,7 @@ void spiWriteNL(spi_t *spi, const void *data_in, uint32_t len) { spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif for (size_t i = 0; i < c_longs; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; @@ -1352,7 +1357,7 @@ void spiTransferBytesNL(spi_t *spi, const void *data_in, uint8_t *data_out, uint spi->dev->miso_dlen.usr_miso_dbitlen = (c_len * 8) - 1; if (data) { for (size_t i = 0; i < c_longs; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; @@ -1360,7 +1365,7 @@ void spiTransferBytesNL(spi_t *spi, const void *data_in, uint8_t *data_out, uint } } else { for (size_t i = 0; i < c_longs; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = 0xFFFFFFFF; #else spi->dev->data_buf[i] = 0xFFFFFFFF; @@ -1376,13 +1381,13 @@ void spiTransferBytesNL(spi_t *spi, const void *data_in, uint8_t *data_out, uint if (result) { if (c_len & 3) { for (size_t i = 0; i < (c_longs - 1); i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 result[i] = spi->dev->data_buf[i].val; #else result[i] = spi->dev->data_buf[i]; #endif } -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 uint32_t last_data = spi->dev->data_buf[c_longs - 1].val; #else uint32_t last_data = spi->dev->data_buf[c_longs - 1]; @@ -1394,7 +1399,7 @@ void spiTransferBytesNL(spi_t *spi, const void *data_in, uint8_t *data_out, uint } } else { for (size_t i = 0; i < c_longs; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 result[i] = spi->dev->data_buf[i].val; #else result[i] = spi->dev->data_buf[i]; @@ -1436,7 +1441,7 @@ void spiTransferBitsNL(spi_t *spi, uint32_t data, uint32_t *out, uint8_t bits) { spi->dev->mosi_dlen.usr_mosi_dbitlen = (bits - 1); spi->dev->miso_dlen.usr_miso_dbitlen = (bits - 1); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1447,7 +1452,7 @@ void spiTransferBitsNL(spi_t *spi, uint32_t data, uint32_t *out, uint8_t bits) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val; #else data = spi->dev->data_buf[0]; @@ -1488,27 +1493,27 @@ void ARDUINO_ISR_ATTR spiWritePixelsNL(spi_t *spi, const void *data_in, uint32_t if (msb) { if (l_bytes && i == (c_longs - 1)) { if (l_bytes == 2) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 MSB_16_SET(spi->dev->data_buf[i].val, data[i]); #else MSB_16_SET(spi->dev->data_buf[i], data[i]); #endif } else { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i] & 0xFF; #else spi->dev->data_buf[i] = data[i] & 0xFF; #endif } } else { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 MSB_PIX_SET(spi->dev->data_buf[i].val, data[i]); #else MSB_PIX_SET(spi->dev->data_buf[i], data[i]); #endif } } else { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 5311aff4f37..ca88edbca27 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -207,6 +207,14 @@ static bool lpuartCheckPins(int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rt } #endif // SOC_UART_LP_NUM >= 1 +#ifndef GPIO_FUNC_IN_LOW +#define GPIO_FUNC_IN_LOW GPIO_MATRIX_CONST_ZERO_INPUT +#endif + +#ifndef GPIO_FUNC_IN_HIGH +#define GPIO_FUNC_IN_HIGH GPIO_MATRIX_CONST_ONE_INPUT +#endif + // Negative Pin Number will keep it unmodified, thus this function can detach individual pins // This function will also unset the pins in the Peripheral Manager and set the pin to -1 after detaching static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin) { @@ -222,7 +230,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t // detaches HP and LP pins and sets Peripheral Manager and UART information if (rxPin >= 0 && uart->_rxPin == rxPin && perimanGetPinBusType(rxPin) == ESP32_BUS_TYPE_UART_RX) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rxPin], PIN_FUNC_GPIO); + //gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rxPin], PIN_FUNC_GPIO); + esp_rom_gpio_pad_select_gpio(rxPin); // avoids causing BREAK in the UART line if (uart->_inverted) { esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_LOW, UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX), false); @@ -236,7 +245,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t } } if (txPin >= 0 && uart->_txPin == txPin && perimanGetPinBusType(txPin) == ESP32_BUS_TYPE_UART_TX) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[txPin], PIN_FUNC_GPIO); + //gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[txPin], PIN_FUNC_GPIO); + esp_rom_gpio_pad_select_gpio(txPin); esp_rom_gpio_connect_out_signal(txPin, SIG_GPIO_OUT_IDX, false, false); uart->_txPin = -1; // -1 means unassigned/detached if (!perimanClearPinBus(txPin)) { @@ -245,7 +255,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t } } if (ctsPin >= 0 && uart->_ctsPin == ctsPin && perimanGetPinBusType(ctsPin) == ESP32_BUS_TYPE_UART_CTS) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[ctsPin], PIN_FUNC_GPIO); + //gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[ctsPin], PIN_FUNC_GPIO); + esp_rom_gpio_pad_select_gpio(ctsPin); esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_LOW, UART_PERIPH_SIGNAL(uart_num, SOC_UART_CTS_PIN_IDX), false); uart->_ctsPin = -1; // -1 means unassigned/detached if (!perimanClearPinBus(ctsPin)) { @@ -254,7 +265,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t } } if (rtsPin >= 0 && uart->_rtsPin == rtsPin && perimanGetPinBusType(rtsPin) == ESP32_BUS_TYPE_UART_RTS) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rtsPin], PIN_FUNC_GPIO); + //gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rtsPin], PIN_FUNC_GPIO); + esp_rom_gpio_pad_select_gpio(rtsPin); esp_rom_gpio_connect_out_signal(rtsPin, SIG_GPIO_OUT_IDX, false, false); uart->_rtsPin = -1; // -1 means unassigned/detached if (!perimanClearPinBus(rtsPin)) { @@ -827,7 +839,7 @@ void uartSetRxInvert(uart_t *uart, bool invert) { if (uart == NULL) { return; } -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 // POTENTIAL ISSUE :: original code only set/reset rxd_inv bit // IDF or LL set/reset the whole inv_mask! // if (invert) diff --git a/idf_component.yml b/idf_component.yml index 967c4ecf0f6..c1fc614cae5 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -10,6 +10,7 @@ targets: - esp32c6 - esp32h2 - esp32p4 + - esp32c5 tags: - arduino files: @@ -22,6 +23,7 @@ files: - "variants/esp32c6/**/*" - "variants/esp32h2/**/*" - "variants/esp32p4/**/*" + - "variants/esp32c5/**/*" exclude: - "docs/" - "docs/**/*" @@ -44,7 +46,7 @@ files: - "platform.txt" - "programmers.txt" dependencies: - idf: ">=5.3,<5.5" + idf: ">=5.3,<5.6" # mdns 1.2.1 is necessary to build H2 with no WiFi espressif/mdns: version: "^1.2.3" @@ -107,7 +109,7 @@ dependencies: rules: - if: "target == esp32p4" espressif/esp_wifi_remote: - version: "^0.4.1" + version: "^0.5.4" rules: - if: "target == esp32p4" espressif/libsodium: diff --git a/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ci.json b/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ci.json index cd679adefad..dfd49d94fe9 100644 --- a/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ci.json +++ b/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ci.json @@ -3,6 +3,7 @@ "esp32c3": false, "esp32c6": false, "esp32h2": false, - "esp32p4": false + "esp32p4": false, + "esp32c5": false } } diff --git a/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/ci.json b/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/ci.json index 6afa60f44c4..5fa2bd14e5d 100644 --- a/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/ci.json +++ b/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/ci.json @@ -5,6 +5,7 @@ "esp32h2": false, "esp32p4": false, "esp32s2": false, - "esp32s3": false + "esp32s3": false, + "esp32c5": false } } diff --git a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino index 9d2b248ba44..5b1e0e9e115 100644 --- a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino +++ b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino @@ -48,7 +48,7 @@ Method to print the touchpad by which ESP32 has been awaken from sleep */ void print_wakeup_touchpad() { - touchPin = esp_sleep_get_touchpad_wakeup_status(); + touchPin = (touch_pad_t)esp_sleep_get_touchpad_wakeup_status(); #if CONFIG_IDF_TARGET_ESP32 switch (touchPin) { diff --git a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/ci.json b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/ci.json index 25c42144223..ae65fa0df74 100644 --- a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/ci.json +++ b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/ci.json @@ -2,6 +2,7 @@ "targets": { "esp32c3": false, "esp32c6": false, - "esp32h2": false + "esp32h2": false, + "esp32c5": false } } diff --git a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino index 5d0406aee0e..088f5044f65 100644 --- a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino +++ b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino @@ -21,7 +21,7 @@ * */ -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 // ESP32 C3 has only 2 channels for RX and 2 for TX, thus MAX RMT_MEM is 128 #define RMT_TX_PIN 4 #define RMT_RX_PIN 5 diff --git a/libraries/ESP32/examples/ResetReason/ResetReason/ResetReason.ino b/libraries/ESP32/examples/ResetReason/ResetReason/ResetReason.ino index 0104c6422f2..ca7e15bf479 100644 --- a/libraries/ESP32/examples/ResetReason/ResetReason/ResetReason.ino +++ b/libraries/ESP32/examples/ResetReason/ResetReason/ResetReason.ino @@ -28,6 +28,8 @@ #include "esp32h2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/libraries/ESP32/examples/TWAI/TWAIreceive/ci.json b/libraries/ESP32/examples/TWAI/TWAIreceive/ci.json new file mode 100644 index 00000000000..7379dba8bb9 --- /dev/null +++ b/libraries/ESP32/examples/TWAI/TWAIreceive/ci.json @@ -0,0 +1,5 @@ +{ + "targets": { + "esp32c5": false + } +} diff --git a/libraries/ESP32/examples/TWAI/TWAItransmit/ci.json b/libraries/ESP32/examples/TWAI/TWAItransmit/ci.json new file mode 100644 index 00000000000..7379dba8bb9 --- /dev/null +++ b/libraries/ESP32/examples/TWAI/TWAItransmit/ci.json @@ -0,0 +1,5 @@ +{ + "targets": { + "esp32c5": false + } +} diff --git a/libraries/ESP_SR/examples/Basic/ci.json b/libraries/ESP_SR/examples/Basic/ci.json index c395378f45e..ec0e969a7d0 100644 --- a/libraries/ESP_SR/examples/Basic/ci.json +++ b/libraries/ESP_SR/examples/Basic/ci.json @@ -13,6 +13,7 @@ "esp32c6": false, "esp32h2": false, "esp32p4": false, - "esp32s2": false + "esp32s2": false, + "esp32c5": false } } diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index 35e52f43e4d..732128809c9 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -83,7 +83,7 @@ void SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) { _miso = (_spi_num == FSPI) ? MISO : -1; _mosi = (_spi_num == FSPI) ? MOSI : -1; _ss = (_spi_num == FSPI) ? SS : -1; -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 _sck = SCK; _miso = MISO; _mosi = MOSI; diff --git a/libraries/WiFi/examples/WiFiScan/WiFiScan.ino b/libraries/WiFi/examples/WiFiScan/WiFiScan.ino index 15ce367c897..98733adb0bb 100644 --- a/libraries/WiFi/examples/WiFiScan/WiFiScan.ino +++ b/libraries/WiFi/examples/WiFiScan/WiFiScan.ino @@ -1,5 +1,5 @@ /* - * This sketch demonstrates how to scan WiFi networks. + * This sketch demonstrates how to scan WiFi networks. For chips that support 5GHz band, separate scans are done for all bands. * The API is based on the Arduino WiFi Shield library, but has significant changes as newer WiFi functions are supported. * E.g. the return value of `encryptionType()` different because more modern encryption is supported. */ @@ -7,18 +7,13 @@ void setup() { Serial.begin(115200); - - // Set WiFi to station mode and disconnect from an AP if it was previously connected. - WiFi.mode(WIFI_STA); - WiFi.disconnect(); - delay(100); - + // Enable Station Interface + WiFi.STA.begin(); Serial.println("Setup done"); } -void loop() { +void ScanWiFi() { Serial.println("Scan start"); - // WiFi.scanNetworks will return the number of networks found. int n = WiFi.scanNetworks(); Serial.println("Scan done"); @@ -54,11 +49,33 @@ void loop() { delay(10); } } - Serial.println(""); // Delete the scan result to free memory for code below. WiFi.scanDelete(); - + Serial.println("-------------------------------------"); +} +void loop() { + Serial.println("-------------------------------------"); + Serial.println("Default wifi band mode scan:"); + Serial.println("-------------------------------------"); + WiFi.setBandMode(WIFI_BAND_MODE_AUTO); + ScanWiFi(); +#if CONFIG_SOC_WIFI_SUPPORT_5G + // Wait a bit before scanning again. + delay(1000); + Serial.println("-------------------------------------"); + Serial.println("2.4 Ghz wifi band mode scan:"); + Serial.println("-------------------------------------"); + WiFi.setBandMode(WIFI_BAND_MODE_2G_ONLY); + ScanWiFi(); + // Wait a bit before scanning again. + delay(1000); + Serial.println("-------------------------------------"); + Serial.println("5 Ghz wifi band mode scan:"); + Serial.println("-------------------------------------"); + WiFi.setBandMode(WIFI_BAND_MODE_5G_ONLY); + ScanWiFi(); +#endif // Wait a bit before scanning again. - delay(5000); + delay(10000); } diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index 3faf34fef34..e669ba81c12 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -378,6 +378,10 @@ static bool espWiFiStart() { log_e("esp_wifi_start 0x%x: %s", err, esp_err_to_name(err)); return _esp_wifi_started; } +#if SOC_WIFI_SUPPORT_5G + log_v("Setting Band Mode to AUTO"); + esp_wifi_set_band_mode(WIFI_BAND_MODE_AUTO); +#endif return _esp_wifi_started; } @@ -729,6 +733,90 @@ wifi_ps_type_t WiFiGenericClass::getSleep() { return _sleepEnabled; } +/** + * control wifi band mode + * @param band_mode enum possible band modes + * @return ok + */ +bool WiFiGenericClass::setBandMode(wifi_band_mode_t band_mode) { +#if SOC_WIFI_SUPPORT_5G + if (!WiFi.STA.started() && !WiFi.AP.started()) { + log_e("You need to start WiFi first"); + return false; + } + wifi_band_mode_t bm = WIFI_BAND_MODE_AUTO; + esp_err_t err = esp_wifi_get_band_mode(&bm); + if (err != ESP_OK) { + log_e("Failed to get Current Band Mode: 0x%x: %s", err, esp_err_to_name(err)); + return false; + } else if (bm == band_mode) { + log_d("No change in Band Mode"); + return true; + } else { + log_d("Switching Band Mode from %d to %d", bm, band_mode); + } +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR + if (WiFi.STA.connected() || WiFi.AP.connected()) { + log_e("Your network will get disconnected!"); + } +#endif + err = esp_wifi_set_band_mode(band_mode); + if (err != ESP_OK) { + log_e("Failed to set Band Mode: 0x%x: %s", err, esp_err_to_name(err)); + return false; + } + delay(100); + return true; +#else + if (band_mode == WIFI_BAND_MODE_5G_ONLY) { + log_e("This chip supports only 2.4GHz WiFi"); + } + return band_mode != WIFI_BAND_MODE_5G_ONLY; +#endif +} + +/** + * get the current enabled wifi band mode + * @return enum band mode + */ +wifi_band_mode_t WiFiGenericClass::getBandMode() { +#if SOC_WIFI_SUPPORT_5G + wifi_band_mode_t band_mode = WIFI_BAND_MODE_AUTO; + if (!WiFi.STA.started() && !WiFi.AP.started()) { + log_e("You need to start WiFi first"); + return band_mode; + } + esp_err_t err = esp_wifi_get_band_mode(&band_mode); + if (err != ESP_OK) { + log_e("Failed to get Band Mode: 0x%x: %s", err, esp_err_to_name(err)); + } + return band_mode; +#else + return WIFI_BAND_MODE_2G_ONLY; +#endif +} + +/** + * get the current active wifi band + * @return enum band + */ +wifi_band_t WiFiGenericClass::getBand() { +#if SOC_WIFI_SUPPORT_5G + wifi_band_t band = WIFI_BAND_2G; + if (!WiFi.STA.started() && !WiFi.AP.started()) { + log_e("You need to start WiFi first"); + return band; + } + esp_err_t err = esp_wifi_get_band(&band); + if (err != ESP_OK) { + log_e("Failed to get Band: 0x%x: %s", err, esp_err_to_name(err)); + } + return band; +#else + return WIFI_BAND_2G; +#endif +} + /** * control wifi tx power * @param power enum maximum wifi tx power diff --git a/libraries/WiFi/src/WiFiGeneric.h b/libraries/WiFi/src/WiFiGeneric.h index ed216229ed4..8497b4b4f3d 100644 --- a/libraries/WiFi/src/WiFiGeneric.h +++ b/libraries/WiFi/src/WiFiGeneric.h @@ -111,6 +111,10 @@ class WiFiGenericClass { bool setTxPower(wifi_power_t power); wifi_power_t getTxPower(); + bool setBandMode(wifi_band_mode_t band_mode); + wifi_band_mode_t getBandMode(); + wifi_band_t getBand(); + bool initiateFTM(uint8_t frm_count = 16, uint16_t burst_period = 2, uint8_t channel = 1, const uint8_t *mac = NULL); static bool setDualAntennaConfig(uint8_t gpio_ant1, uint8_t gpio_ant2, wifi_rx_ant_t rx_mode, wifi_tx_ant_t tx_mode); diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 19254d11682..1b935fd8acf 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -51,7 +51,7 @@ { "packager": "esp32", "name": "esp32-arduino-libs", - "version": "idf-release_v5.4-2f7dcd86-v1" + "version": "idf-master-a45d713b-v1" }, { "packager": "esp32", @@ -61,7 +61,7 @@ { "packager": "esp32", "name": "xtensa-esp-elf-gdb", - "version": "14.2_20240403" + "version": "15.2_20241112" }, { "packager": "esp32", @@ -71,12 +71,12 @@ { "packager": "esp32", "name": "riscv32-esp-elf-gdb", - "version": "14.2_20240403" + "version": "15.2_20241112" }, { "packager": "esp32", "name": "openocd-esp32", - "version": "v0.12.0-esp32-20241016" + "version": "v0.12.0-esp32-20250226" }, { "packager": "esp32", @@ -104,63 +104,63 @@ "tools": [ { "name": "esp32-arduino-libs", - "version": "idf-release_v5.4-2f7dcd86-v1", + "version": "idf-master-a45d713b-v1", "systems": [ { "host": "i686-mingw32", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "checksum": "SHA-256:52aec557b9744e721770853c67c4ee6a391debd7bb779f654bea0e5113658786", + "size": "420636315" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "checksum": "SHA-256:52aec557b9744e721770853c67c4ee6a391debd7bb779f654bea0e5113658786", + "size": "420636315" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "checksum": "SHA-256:52aec557b9744e721770853c67c4ee6a391debd7bb779f654bea0e5113658786", + "size": "420636315" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "checksum": "SHA-256:52aec557b9744e721770853c67c4ee6a391debd7bb779f654bea0e5113658786", + "size": "420636315" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "checksum": "SHA-256:52aec557b9744e721770853c67c4ee6a391debd7bb779f654bea0e5113658786", + "size": "420636315" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "checksum": "SHA-256:52aec557b9744e721770853c67c4ee6a391debd7bb779f654bea0e5113658786", + "size": "420636315" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "checksum": "SHA-256:52aec557b9744e721770853c67c4ee6a391debd7bb779f654bea0e5113658786", + "size": "420636315" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-a45d713b-v1.zip", + "checksum": "SHA-256:52aec557b9744e721770853c67c4ee6a391debd7bb779f654bea0e5113658786", + "size": "420636315" } ] }, @@ -228,63 +228,63 @@ }, { "name": "xtensa-esp-elf-gdb", - "version": "14.2_20240403", + "version": "15.2_20241112", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-x86_64-linux-gnu.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-x86_64-linux-gnu.tar.gz", - "checksum": "SHA-256:9d68472d4cba5cf8c2b79d94f86f92c828e76a632bd1e6be5e7706e5b304d36e", - "size": "31010320" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/xtensa-esp-elf-gdb-15.2_20241112-x86_64-linux-gnu.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-15.2_20241112-x86_64-linux-gnu.tar.gz", + "checksum": "SHA-256:18774349d2b1c7d7f5ba984563f7022aef4a3df4b706ed8821c53266f599343d", + "size": "35179121" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-aarch64-linux-gnu.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-aarch64-linux-gnu.tar.gz", - "checksum": "SHA-256:bdabc3217994815fc311c4e16e588b78f6596b5ad4ffa46c80b40e982cfb1e66", - "size": "30954580" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/xtensa-esp-elf-gdb-15.2_20241112-aarch64-linux-gnu.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-15.2_20241112-aarch64-linux-gnu.tar.gz", + "checksum": "SHA-256:77cb3b2c85d6cfbb40b7f99eebbc2b1c3f4fe13eba20b3da798bdbbc6eb8e87c", + "size": "34295046" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-arm-linux-gnueabi.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-arm-linux-gnueabi.tar.gz", - "checksum": "SHA-256:d54b8d703ba897b28c627da3d27106a3906dd01ba298778a67064710bc33c76d", - "size": "28697281" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/xtensa-esp-elf-gdb-15.2_20241112-arm-linux-gnueabi.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-15.2_20241112-arm-linux-gnueabi.tar.gz", + "checksum": "SHA-256:b87af0539de118eb9d43a4a89c8c1b0a6ab2557560015155104c44f91b5c4aa0", + "size": "30338727" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-i586-linux-gnu.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-i586-linux-gnu.tar.gz", - "checksum": "SHA-256:64d3bc992ed8fdec383d49e8b803ac494605a38117c8293db8da055037de96b0", - "size": "29890994" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/xtensa-esp-elf-gdb-15.2_20241112-i586-linux-gnu.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-15.2_20241112-i586-linux-gnu.tar.gz", + "checksum": "SHA-256:2c7531bd390928fed479999ac9089b39a25f56ca4f4cc330db7d7a633a37405b", + "size": "33906121" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-x86_64-apple-darwin14.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-x86_64-apple-darwin14.tar.gz", - "checksum": "SHA-256:023e74b3fda793da4bc0509b02de776ee0dad6efaaac17bef5916fb7dc9c26b9", - "size": "44446611" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/xtensa-esp-elf-gdb-15.2_20241112-x86_64-apple-darwin21.1.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-15.2_20241112-x86_64-apple-darwin21.1.tar.gz", + "checksum": "SHA-256:ba2907be9a4c22c4e418f42ec84cf57401570a71dabbe69425227114ebf351a7", + "size": "52502302" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-aarch64-apple-darwin21.1.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-aarch64-apple-darwin21.1.tar.gz", - "checksum": "SHA-256:ea757c6bf8c25238f6d2fdcc6bbab25a1b00608a0f9e19b7ddd2f37ddbdc3fb1", - "size": "37021423" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/xtensa-esp-elf-gdb-15.2_20241112-aarch64-apple-darwin21.1.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-15.2_20241112-aarch64-apple-darwin21.1.tar.gz", + "checksum": "SHA-256:893500d6de354a6870820b9398531d8cd37d1cd85f3ae9b1f8a4c070b8048707", + "size": "41892363" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-i686-w64-mingw32.zip", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-i686-w64-mingw32.zip", - "checksum": "SHA-256:322e8d9b700dc32d8158e3dc55fb85ec55de48d0bb7789375ee39a28d5d655e2", - "size": "26302466" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/xtensa-esp-elf-gdb-15.2_20241112-i686-w64-mingw32.zip", + "archiveFileName": "xtensa-esp-elf-gdb-15.2_20241112-i686-w64-mingw32.zip", + "checksum": "SHA-256:328181380fccb252105c51a86071edbc5ef63e0114540edc4f8b2d62acf44916", + "size": "31307770" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-x86_64-w64-mingw32.zip", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-x86_64-w64-mingw32.zip", - "checksum": "SHA-256:a27a2fe20f192f8e0a51b8936428b4e1cf8935cfe008ee445cc49f6fc7f6db2e", - "size": "28366035" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/xtensa-esp-elf-gdb-15.2_20241112-x86_64-w64-mingw32.zip", + "archiveFileName": "xtensa-esp-elf-gdb-15.2_20241112-x86_64-w64-mingw32.zip", + "checksum": "SHA-256:9c1949058d7aa1fa6f6f2d03173659b9f54e3c3940cbeebc1d56ae169c604ab2", + "size": "31420687" } ] }, @@ -352,118 +352,118 @@ }, { "name": "riscv32-esp-elf-gdb", - "version": "14.2_20240403", + "version": "15.2_20241112", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-x86_64-linux-gnu.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-x86_64-linux-gnu.tar.gz", - "checksum": "SHA-256:ce004bc0bbd71b246800d2d13b239218b272a38bd528e316f21f1af2db8a4b13", - "size": "30707431" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/riscv32-esp-elf-gdb-15.2_20241112-x86_64-linux-gnu.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-15.2_20241112-x86_64-linux-gnu.tar.gz", + "checksum": "SHA-256:bfca245b3d84244ad3b6156496728d916ac5ccc0d7f8e048194b7eba5cdbe047", + "size": "35297398" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-aarch64-linux-gnu.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-aarch64-linux-gnu.tar.gz", - "checksum": "SHA-256:ba10f2866c61410b88c65957274280b1a62e3bed05131654ed9b6758efe18e55", - "size": "30824065" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/riscv32-esp-elf-gdb-15.2_20241112-aarch64-linux-gnu.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-15.2_20241112-aarch64-linux-gnu.tar.gz", + "checksum": "SHA-256:8536da9e3093b8f25e0b5204b04ed4afea432d1fd262f2abb466016d3d750ea6", + "size": "34455317" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-arm-linux-gnueabi.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-arm-linux-gnueabi.tar.gz", - "checksum": "SHA-256:88539db5d987f28827efac7e26080a2803b9b539342ccd2963ccfdd56d7f08f7", - "size": "29000575" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/riscv32-esp-elf-gdb-15.2_20241112-arm-linux-gnueabi.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-15.2_20241112-arm-linux-gnueabi.tar.gz", + "checksum": "SHA-256:33a80d5e6604bb7d08b15492b8ec84c9176245e066d0bf8aad7570786ca44081", + "size": "31188203" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-i586-linux-gnu.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-i586-linux-gnu.tar.gz", - "checksum": "SHA-256:0e628ee37438ab6ba05eb889a76d09e50cb98e0020a16b8e2b935c5cf19b4ed2", - "size": "29947521" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/riscv32-esp-elf-gdb-15.2_20241112-i586-linux-gnu.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-15.2_20241112-i586-linux-gnu.tar.gz", + "checksum": "SHA-256:ba448ecf2c80064013eaacb0e7be514a5ef17516f49ff3e50bc41c5578b8d88e", + "size": "34211289" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-x86_64-apple-darwin14.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-x86_64-apple-darwin14.tar.gz", - "checksum": "SHA-256:8f6bda832d70dad5860a639d55aba4237bd10cbac9f4822db1eece97357b34a9", - "size": "44196117" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/riscv32-esp-elf-gdb-15.2_20241112-x86_64-apple-darwin21.1.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-15.2_20241112-x86_64-apple-darwin21.1.tar.gz", + "checksum": "SHA-256:bdd07c54fe3216eb5c34f92cac514eb4af777c951573f186c33408c75f56bb4b", + "size": "52831957" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-aarch64-apple-darwin21.1.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-aarch64-apple-darwin21.1.tar.gz", - "checksum": "SHA-256:d88b6116e86456c8480ce9bc95aed375a35c0d091f1da0a53b86be0e6ef3d320", - "size": "36794404" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/riscv32-esp-elf-gdb-15.2_20241112-aarch64-apple-darwin21.1.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-15.2_20241112-aarch64-apple-darwin21.1.tar.gz", + "checksum": "SHA-256:9924f439ae77c3346e532a48a0d56330466c33ce1abd8d72b77f9f7f5c3b1196", + "size": "42227631" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-i686-w64-mingw32.zip", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-i686-w64-mingw32.zip", - "checksum": "SHA-256:d6e7ce05805b0d8d4dd138ad239b98a1adf8da98941867d60760eb1ae5361730", - "size": "26486295" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/riscv32-esp-elf-gdb-15.2_20241112-i686-w64-mingw32.zip", + "archiveFileName": "riscv32-esp-elf-gdb-15.2_20241112-i686-w64-mingw32.zip", + "checksum": "SHA-256:dcdafd30854b092671f555d844d94b0733e2ffcac8c026b4fb7b8a72ebef0016", + "size": "31971712" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-x86_64-w64-mingw32.zip", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-x86_64-w64-mingw32.zip", - "checksum": "SHA-256:5c9f211dc46daf6b96fad09d709284a0f0186fef8947d9f6edd6bca5b5ad4317", - "size": "27942579" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v15.2_20241112/riscv32-esp-elf-gdb-15.2_20241112-x86_64-w64-mingw32.zip", + "archiveFileName": "riscv32-esp-elf-gdb-15.2_20241112-x86_64-w64-mingw32.zip", + "checksum": "SHA-256:6ec8b3a073f2c5835321b4b560f8fc56180458204d071da139ff983436ea45e5", + "size": "31759225" } ] }, { "name": "openocd-esp32", - "version": "v0.12.0-esp32-20241016", + "version": "v0.12.0-esp32-20250226", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-linux-amd64-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-linux-amd64-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:e82b0f036dc99244bead5f09a86e91bb2365cbcd1122ac68261e5647942485df", - "size": "2398717" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-linux-amd64-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-linux-amd64-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:914c726342ba5828e53f41aa454f01f317c42d8e6772d3d874593a6960fc4729", + "size": "2414924" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-linux-arm64-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-linux-arm64-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:8f8daf5bd22ec5d2fa9257b0862ec33da18ee677e023fb9a9eb17f74ce208c76", - "size": "2271584" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-linux-arm64-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-linux-arm64-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:c44ee99a9209c0234dbbcec86339fd685f5c61a763b29c33eba590bf62db2296", + "size": "2293923" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-linux-armel-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-linux-armel-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:bc9c020ecf20e2000f76cffa44305fd5bc44d2e688ea78cce423399d33f19767", - "size": "2414206" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-linux-armel-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-linux-armel-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:21ab6af3cf05f9290f4d59f1f381d5094dd2755fc528d3d2feb9334348fc0d8d", + "size": "2436071" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-macos-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-macos-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:02a2dffe801a2d005fa9e614d80ff8173395b2cb0b5d3118d0229d094a9946a7", - "size": "2508089" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-macos-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-macos-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:0b5751699e93b6d101381611c96216ddff8c7dfd16425c610993fa27993f9a0a", + "size": "2525387" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-macos-arm64-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-macos-arm64-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:c382f9e884d6565cb6089bff5f200f4810994667d885f062c3d3c5625a0fa9d6", - "size": "2552569" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-macos-arm64-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-macos-arm64-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:8bffbbb594b27a4971a3922792135f8c836fff26991f7f450094386920263531", + "size": "2568843" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-win32-0.12.0-esp32-20241016.zip", - "archiveFileName": "openocd-esp32-win32-0.12.0-esp32-20241016.zip", - "checksum": "SHA-256:3b5d615e0a72cc771a45dd469031312d5881c01d7b6bc9edb29b8b6bda8c2e90", - "size": "2946244" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-win32-0.12.0-esp32-20250226.zip", + "archiveFileName": "openocd-esp32-win32-0.12.0-esp32-20250226.zip", + "checksum": "SHA-256:aaf3c955bb4eb47805a1ba108dfd07a8a56ce720cb40194a354362b5f0961230", + "size": "2960226" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-win64-0.12.0-esp32-20241016.zip", - "archiveFileName": "openocd-esp32-win64-0.12.0-esp32-20241016.zip", - "checksum": "SHA-256:5e7b2fd1947d3a8625f6a11db7a2340cf2f41ff4c61284c022c7d7c32b18780a", - "size": "2946244" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-win64-0.12.0-esp32-20250226.zip", + "archiveFileName": "openocd-esp32-win64-0.12.0-esp32-20250226.zip", + "checksum": "SHA-256:79baf35325117a53093b62f6b9bee677dd12275d7066e3f8a274d2a80e986b6e", + "size": "2960225" } ] }, diff --git a/platform.txt b/platform.txt index 65be05b3bf4..f41a8b4a764 100644 --- a/platform.txt +++ b/platform.txt @@ -84,6 +84,7 @@ build.extra_flags.esp32c3=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build. build.extra_flags.esp32c6=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} build.extra_flags.esp32h2=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} build.extra_flags.esp32p4=-DARDUINO_USB_MODE={build.usb_mode} -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} -DARDUINO_USB_MSC_ON_BOOT={build.msc_on_boot} -DARDUINO_USB_DFU_ON_BOOT={build.dfu_on_boot} +build.extra_flags.esp32c5=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} # This can be overriden in boards.txt build.zigbee_mode= @@ -260,6 +261,14 @@ debug_config.esp32c6= debug_script.esp32h2=esp32h2-builtin.cfg debug_config.esp32h2= +# ESP32-P4 debug configuration (TBD) +debug_script.esp32p4=esp32p4-builtin.cfg +debug_config.esp32p4= + +# ESP32-C5 debug configuration (TBD) +debug_script.esp32c5=esp32c5-builtin.cfg +debug_config.esp32c5= + # Debug API variable definitions debug.executable={build.path}/{build.project_name}.elf debug.toolchain=gcc diff --git a/tools/pioarduino-build.py b/tools/pioarduino-build.py index 3335a716888..47940b0d043 100644 --- a/tools/pioarduino-build.py +++ b/tools/pioarduino-build.py @@ -213,7 +213,11 @@ def add_tinyuf2_extra_image(): LIBSOURCE_DIRS=[join(FRAMEWORK_DIR, "libraries")], FLASH_EXTRA_IMAGES=[ ( - "0x1000" if build_mcu in ["esp32", "esp32s2"] else ("0x2000" if build_mcu in ["esp32p4"] else "0x0000"), + ( + "0x1000" + if build_mcu in ["esp32", "esp32s2"] + else ("0x2000" if build_mcu in ["esp32p4", "esp32c5"] else "0x0000") + ), get_bootloader_image(variants_dir), ), ("0x8000", join(env.subst("$BUILD_DIR"), "partitions.bin")), diff --git a/variants/esp32c5/pins_arduino.h b/variants/esp32c5/pins_arduino.h new file mode 100644 index 00000000000..e3a7e57ef44 --- /dev/null +++ b/variants/esp32c5/pins_arduino.h @@ -0,0 +1,48 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define PIN_RGB_LED 27 +// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT + PIN_RGB_LED; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN +// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API rgbLedWrite() +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +static const uint8_t TX = 11; +static const uint8_t RX = 12; + +// static const uint8_t USB_DM = 13; +// static const uint8_t USB_DP = 14; + +static const uint8_t SDA = 0; +static const uint8_t SCL = 1; + +static const uint8_t SS = 6; +static const uint8_t MOSI = 8; +static const uint8_t MISO = 9; +static const uint8_t SCK = 10; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; + +// LP I2C Pins are fixed on ESP32-C5 +static const uint8_t LP_SDA = 2; +static const uint8_t LP_SCL = 3; +#define WIRE1_PIN_DEFINED +#define SDA1 LP_SDA +#define SCL1 LP_SCL + +// LP UART Pins are fixed on ESP32-C5 +static const uint8_t LP_RX = 4; +static const uint8_t LP_TX = 5; + +#endif /* Pins_Arduino_h */