Skip to content

Commit b26343a

Browse files
feat(esp32c61): Add support for ESP32-C61
Co-authored-by: Jan Procházka <[email protected]>
1 parent 491e2d2 commit b26343a

File tree

25 files changed

+583
-244
lines changed

25 files changed

+583
-244
lines changed

.github/scripts/find_all_boards.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ boards_list=$(grep '.tarch=' boards.txt)
88
while read -r line; do
99
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
1010
# skip esp32c2 as we dont build libs for it
11-
if [ "$board_name" == "esp32c2" ]; then
11+
if [ "$board_name" == "esp32c2" ] || [ "$board_name" == "esp32c61" ]; then
1212
echo "Skipping 'espressif:esp32:$board_name'"
1313
continue
1414
fi

.github/workflows/build_component.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
workflow_dispatch:
55
inputs:
66
idf_ver:
7-
description: "IDF Versions"
8-
default: "release-v5.3,release-v5.4,release-v5.5"
7+
description: "Comma separated list of IDF branches to build"
8+
default: "release-v5.5"
99
type: "string"
1010
required: true
1111
idf_targets:
12-
description: "IDF Targets"
13-
default: "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
12+
description: "Comma separated list of IDF targets to build"
13+
default: "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c5,esp32c6,esp32c61,esp32h2,esp32p4"
1414
type: "string"
1515
required: false
1616
push:
@@ -37,6 +37,7 @@ on:
3737
- "variants/esp32c3/**"
3838
- "variants/esp32c5/**"
3939
- "variants/esp32c6/**"
40+
- "variants/esp32c61/**"
4041
- "variants/esp32h2/**"
4142
- "variants/esp32p4/**"
4243
- "variants/esp32s2/**"
@@ -125,7 +126,7 @@ jobs:
125126
echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
126127
;;
127128
"release-v5.5")
128-
echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c5,esp32c6,esp32h2,esp32p4"
129+
echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c5,esp32c6,esp32c61,esp32h2,esp32p4"
129130
;;
130131
*)
131132
echo ""

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hi
378378
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_OpenThread)
379379
#if(CONFIG_SOC_IEEE802154_SUPPORTED) # Does not work!
380380
#if(CONFIG_OPENTHREAD_ENABLED) # Does not work!
381-
if(IDF_TARGET STREQUAL "esp32c6" OR IDF_TARGET STREQUAL "esp32h2" OR IDF_TARGET STREQUAL "esp32c5") # Sadly only this works
381+
if(IDF_TARGET STREQUAL "esp32c6" OR IDF_TARGET STREQUAL "esp32h2" OR IDF_TARGET STREQUAL "esp32c5" OR IDF_TARGET STREQUAL "esp32c61") # Sadly only this works
382382
list(APPEND requires openthread)
383383
endif()
384384
endif()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Here are the ESP32 series supported by the Arduino-ESP32 project:
7676
| ESP32-S3 | Yes | Yes | [ESP32-S3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) |
7777

7878
> [!NOTE]
79-
> ESP32-C2 is also supported by Arduino-ESP32 but requires using Arduino as an ESP-IDF component or rebuilding the static libraries.
79+
> ESP32-C2 and ESP32-C61 are also supported by Arduino-ESP32 but require using Arduino as an ESP-IDF component or rebuilding the static libraries.
8080
> For more information, see the [Arduino as an ESP-IDF component documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html) or the
8181
> [Lib Builder documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html), respectively.
8282

boards.txt

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,176 @@ esp32c6.menu.ZigbeeMode.zczr_debug.build.zigbee_libs=-lesp_zb_api.zczr.debug -lz
983983

984984
##############################################################
985985

986+
esp32c61.name=ESP32C61 Dev Module
987+
esp32c61.hide=true
988+
989+
esp32c61.bootloader.tool=esptool_py
990+
esp32c61.bootloader.tool.default=esptool_py
991+
992+
esp32c61.upload.tool=esptool_py
993+
esp32c61.upload.tool.default=esptool_py
994+
esp32c61.upload.tool.network=esp_ota
995+
996+
esp32c61.upload.maximum_size=1310720
997+
esp32c61.upload.maximum_data_size=327680
998+
esp32c61.upload.flags=
999+
esp32c61.upload.extra_flags=
1000+
esp32c61.upload.use_1200bps_touch=false
1001+
esp32c61.upload.wait_for_upload_port=false
1002+
1003+
esp32c61.serial.disableDTR=false
1004+
esp32c61.serial.disableRTS=false
1005+
1006+
esp32c61.build.tarch=riscv32
1007+
esp32c61.build.target=esp
1008+
esp32c61.build.mcu=esp32c61
1009+
esp32c61.build.core=esp32
1010+
esp32c61.build.variant=esp32c61
1011+
esp32c61.build.board=ESP32C61_DEV
1012+
esp32c61.build.bootloader_addr=0x0
1013+
1014+
esp32c61.build.cdc_on_boot=0
1015+
esp32c61.build.f_cpu=160000000L
1016+
esp32c61.build.flash_size=4MB
1017+
esp32c61.build.flash_freq=80m
1018+
esp32c61.build.flash_mode=qio
1019+
esp32c61.build.boot=qio
1020+
esp32c61.build.partitions=default
1021+
esp32c61.build.defines=
1022+
1023+
## IDE 2.0 Seems to not update the value
1024+
esp32c61.menu.JTAGAdapter.default=Disabled
1025+
esp32c61.menu.JTAGAdapter.default.build.copy_jtag_files=0
1026+
esp32c61.menu.JTAGAdapter.builtin=Integrated USB JTAG
1027+
esp32c61.menu.JTAGAdapter.builtin.build.openocdscript=esp32c61-builtin.cfg
1028+
esp32c61.menu.JTAGAdapter.builtin.build.copy_jtag_files=1
1029+
esp32c61.menu.JTAGAdapter.external=FTDI Adapter
1030+
esp32c61.menu.JTAGAdapter.external.build.openocdscript=esp32c61-ftdi.cfg
1031+
esp32c61.menu.JTAGAdapter.external.build.copy_jtag_files=1
1032+
esp32c61.menu.JTAGAdapter.bridge=ESP USB Bridge
1033+
esp32c61.menu.JTAGAdapter.bridge.build.openocdscript=esp32c61-bridge.cfg
1034+
esp32c61.menu.JTAGAdapter.bridge.build.copy_jtag_files=1
1035+
1036+
esp32c61.menu.PSRAM.disabled=Disabled
1037+
esp32c61.menu.PSRAM.disabled.build.defines=
1038+
esp32c61.menu.PSRAM.enabled=Enabled
1039+
esp32c61.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
1040+
1041+
esp32c61.menu.CDCOnBoot.default=Disabled
1042+
esp32c61.menu.CDCOnBoot.default.build.cdc_on_boot=0
1043+
esp32c61.menu.CDCOnBoot.cdc=Enabled
1044+
esp32c61.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
1045+
1046+
esp32c61.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
1047+
esp32c61.menu.PartitionScheme.default.build.partitions=default
1048+
esp32c61.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
1049+
esp32c61.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
1050+
esp32c61.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS)
1051+
esp32c61.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
1052+
esp32c61.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
1053+
esp32c61.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
1054+
esp32c61.menu.PartitionScheme.minimal.build.partitions=minimal
1055+
esp32c61.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
1056+
esp32c61.menu.PartitionScheme.no_fs.build.partitions=no_fs
1057+
esp32c61.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
1058+
esp32c61.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
1059+
esp32c61.menu.PartitionScheme.no_ota.build.partitions=no_ota
1060+
esp32c61.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
1061+
esp32c61.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
1062+
esp32c61.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
1063+
esp32c61.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
1064+
esp32c61.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
1065+
esp32c61.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
1066+
esp32c61.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
1067+
esp32c61.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
1068+
esp32c61.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
1069+
esp32c61.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
1070+
esp32c61.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
1071+
esp32c61.menu.PartitionScheme.huge_app.build.partitions=huge_app
1072+
esp32c61.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
1073+
esp32c61.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
1074+
esp32c61.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
1075+
esp32c61.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
1076+
esp32c61.menu.PartitionScheme.rainmaker=RainMaker 4MB
1077+
esp32c61.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
1078+
esp32c61.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080
1079+
esp32c61.menu.PartitionScheme.rainmaker_4MB=RainMaker 4MB No OTA
1080+
esp32c61.menu.PartitionScheme.rainmaker_4MB.build.partitions=rainmaker_4MB_no_ota
1081+
esp32c61.menu.PartitionScheme.rainmaker_4MB.upload.maximum_size=4038656
1082+
esp32c61.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB
1083+
esp32c61.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB
1084+
esp32c61.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4096000
1085+
esp32c61.menu.PartitionScheme.custom=Custom
1086+
esp32c61.menu.PartitionScheme.custom.build.partitions=
1087+
esp32c61.menu.PartitionScheme.custom.upload.maximum_size=8388608
1088+
1089+
esp32c61.menu.CPUFreq.160=160MHz (WiFi)
1090+
esp32c61.menu.CPUFreq.160.build.f_cpu=160000000L
1091+
esp32c61.menu.CPUFreq.120=120MHz (WiFi)
1092+
esp32c61.menu.CPUFreq.120.build.f_cpu=120000000L
1093+
esp32c61.menu.CPUFreq.80=80MHz (WiFi)
1094+
esp32c61.menu.CPUFreq.80.build.f_cpu=80000000L
1095+
esp32c61.menu.CPUFreq.40=40MHz
1096+
esp32c61.menu.CPUFreq.40.build.f_cpu=40000000L
1097+
esp32c61.menu.CPUFreq.20=20MHz
1098+
esp32c61.menu.CPUFreq.20.build.f_cpu=20000000L
1099+
esp32c61.menu.CPUFreq.10=10MHz
1100+
esp32c61.menu.CPUFreq.10.build.f_cpu=10000000L
1101+
1102+
esp32c61.menu.FlashMode.qio=QIO
1103+
esp32c61.menu.FlashMode.qio.build.flash_mode=dio
1104+
esp32c61.menu.FlashMode.qio.build.boot=qio
1105+
esp32c61.menu.FlashMode.dio=DIO
1106+
esp32c61.menu.FlashMode.dio.build.flash_mode=dio
1107+
esp32c61.menu.FlashMode.dio.build.boot=dio
1108+
1109+
esp32c61.menu.FlashFreq.80=80MHz
1110+
esp32c61.menu.FlashFreq.80.build.flash_freq=80m
1111+
esp32c61.menu.FlashFreq.40=40MHz
1112+
esp32c61.menu.FlashFreq.40.build.flash_freq=40m
1113+
1114+
esp32c61.menu.FlashSize.4M=4MB (32Mb)
1115+
esp32c61.menu.FlashSize.4M.build.flash_size=4MB
1116+
esp32c61.menu.FlashSize.8M=8MB (64Mb)
1117+
esp32c61.menu.FlashSize.8M.build.flash_size=8MB
1118+
esp32c61.menu.FlashSize.2M=2MB (16Mb)
1119+
esp32c61.menu.FlashSize.2M.build.flash_size=2MB
1120+
1121+
esp32c61.menu.UploadSpeed.921600=921600
1122+
esp32c61.menu.UploadSpeed.921600.upload.speed=921600
1123+
esp32c61.menu.UploadSpeed.115200=115200
1124+
esp32c61.menu.UploadSpeed.115200.upload.speed=115200
1125+
esp32c61.menu.UploadSpeed.256000.windows=256000
1126+
esp32c61.menu.UploadSpeed.256000.upload.speed=256000
1127+
esp32c61.menu.UploadSpeed.230400.windows.upload.speed=256000
1128+
esp32c61.menu.UploadSpeed.230400=230400
1129+
esp32c61.menu.UploadSpeed.230400.upload.speed=230400
1130+
esp32c61.menu.UploadSpeed.460800.linux=460800
1131+
esp32c61.menu.UploadSpeed.460800.macosx=460800
1132+
esp32c61.menu.UploadSpeed.460800.upload.speed=460800
1133+
esp32c61.menu.UploadSpeed.512000.windows=512000
1134+
esp32c61.menu.UploadSpeed.512000.upload.speed=512000
1135+
1136+
esp32c61.menu.DebugLevel.none=None
1137+
esp32c61.menu.DebugLevel.none.build.code_debug=0
1138+
esp32c61.menu.DebugLevel.error=Error
1139+
esp32c61.menu.DebugLevel.error.build.code_debug=1
1140+
esp32c61.menu.DebugLevel.warn=Warn
1141+
esp32c61.menu.DebugLevel.warn.build.code_debug=2
1142+
esp32c61.menu.DebugLevel.info=Info
1143+
esp32c61.menu.DebugLevel.info.build.code_debug=3
1144+
esp32c61.menu.DebugLevel.debug=Debug
1145+
esp32c61.menu.DebugLevel.debug.build.code_debug=4
1146+
esp32c61.menu.DebugLevel.verbose=Verbose
1147+
esp32c61.menu.DebugLevel.verbose.build.code_debug=5
1148+
1149+
esp32c61.menu.EraseFlash.none=Disabled
1150+
esp32c61.menu.EraseFlash.none.upload.erase_cmd=
1151+
esp32c61.menu.EraseFlash.all=Enabled
1152+
esp32c61.menu.EraseFlash.all.upload.erase_cmd=-e
1153+
1154+
##############################################################
1155+
9861156
esp32s3.name=ESP32S3 Dev Module
9871157

9881158
esp32s3.bootloader.tool=esptool_py

cores/esp32/Esp.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ extern "C" {
8383
#elif CONFIG_IDF_TARGET_ESP32C5
8484
#include "esp32c5/rom/spi_flash.h"
8585
#define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32c5 is located at 0x2000
86+
#elif CONFIG_IDF_TARGET_ESP32C61
87+
#include "esp32c61/rom/spi_flash.h"
88+
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c61 is located at 0x0000
8689
#else
8790
#error Target CONFIG_IDF_TARGET is not supported
8891
#endif
@@ -365,7 +368,7 @@ uint32_t EspClass::getFlashChipSpeed(void) {
365368
}
366369

367370
FlashMode_t EspClass::getFlashChipMode(void) {
368-
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5
371+
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61
369372
uint32_t spi_ctrl = REG_READ(PERIPHS_SPI_FLASH_CTRL);
370373
#elif CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C6
371374
uint32_t spi_ctrl = REG_READ(DR_REG_SPI0_BASE + 0x8);
@@ -449,6 +452,22 @@ uint32_t EspClass::magicFlashChipSpeed(uint8_t flashByte) {
449452
return 0;
450453
}
451454

455+
#elif CONFIG_IDF_TARGET_ESP32C61
456+
/*
457+
FLASH_FREQUENCY = {
458+
"80m": 0xF,
459+
"40m": 0x0,
460+
"20m": 0x2,
461+
}
462+
*/
463+
switch (flashByte & 0x0F) {
464+
case 0xF: return (80_MHz);
465+
case 0x0: return (40_MHz);
466+
case 0x2: return (20_MHz);
467+
default: // fail?
468+
return 0;
469+
}
470+
452471
#elif CONFIG_IDF_TARGET_ESP32H2
453472

454473
/*

cores/esp32/HardwareSerial.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ typedef enum {
164164
#define SOC_RX0 (gpio_num_t)38
165165
#elif CONFIG_IDF_TARGET_ESP32C5
166166
#define SOC_RX0 (gpio_num_t)12
167+
#elif CONFIG_IDF_TARGET_ESP32C61
168+
#define SOC_RX0 (gpio_num_t)10
167169
#endif
168170
#endif
169171

@@ -182,7 +184,7 @@ typedef enum {
182184
#define SOC_TX0 (gpio_num_t)24
183185
#elif CONFIG_IDF_TARGET_ESP32P4
184186
#define SOC_TX0 (gpio_num_t)37
185-
#elif CONFIG_IDF_TARGET_ESP32C5
187+
#elif CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61
186188
#define SOC_TX0 (gpio_num_t)11
187189
#endif
188190
#endif
@@ -209,6 +211,8 @@ typedef enum {
209211
#define RX1 (gpio_num_t)11
210212
#elif CONFIG_IDF_TARGET_ESP32C5
211213
#define RX1 (gpio_num_t)4
214+
#elif CONFIG_IDF_TARGET_ESP32C61
215+
#define RX1 (gpio_num_t)8
212216
#endif
213217
#endif
214218

@@ -231,6 +235,8 @@ typedef enum {
231235
#define TX1 (gpio_num_t)10
232236
#elif CONFIG_IDF_TARGET_ESP32C5
233237
#define TX1 (gpio_num_t)5
238+
#elif CONFIG_IDF_TARGET_ESP32C61
239+
#define TX1 (gpio_num_t)29
234240
#endif
235241
#endif
236242
#endif /* SOC_UART_HP_NUM > 1 */

cores/esp32/chip-debug-report.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ static void printPkgVersion(void) {
6969
#elif CONFIG_IDF_TARGET_ESP32P4
7070
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SYS_2_REG, EFUSE_PKG_VERSION);
7171
chip_report_printf("%lu", pkg_ver);
72-
#elif CONFIG_IDF_TARGET_ESP32C5
73-
// ToDo: Update this line when EFUSE_PKG_VERSION is available again for ESP32-C5
74-
uint32_t pkg_ver = 0; //REG_GET_FIELD(EFUSE_RD_MAC_SYS2_REG, EFUSE_PKG_VERSION);
72+
#elif CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61
73+
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SYS2_REG, EFUSE_PKG_VERSION);
7574
chip_report_printf("%lu", pkg_ver);
7675
#else
7776
chip_report_printf("Unknown");

0 commit comments

Comments
 (0)