Skip to content

Commit 429fb02

Browse files
committed
Add support for ESP32-C61 as target device
1 parent 2b1f018 commit 429fb02

File tree

10 files changed

+72
-17
lines changed

10 files changed

+72
-17
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,24 @@ This library enables you to program Espressif SoCs from various host platforms u
3535

3636
### Supported Target Devices (ESP device being flashed)
3737

38-
| Target | UART | SPI | SDIO | USB CDC ACM |
39-
| :------: | :--: | :-: | :--: | :---------: |
40-
| ESP8266 |||||
41-
| ESP32 ||| 🚧 ||
42-
| ESP32-S2 |||||
43-
| ESP32-S3 |||||
44-
| ESP32-C2 |||||
45-
| ESP32-C3 |||||
46-
| ESP32-H2 |||||
47-
| ESP32-C6 |||||
48-
| ESP32-C5 ||| 🚧 ||
49-
| ESP32-P4 || 🚧 |||
38+
| Target | UART | SPI | SDIO | USB CDC ACM |
39+
| :-------: | :--: | :-: | :--: | :---------: |
40+
| ESP8266 |||||
41+
| ESP32 ||| 🚧 ||
42+
| ESP32-S2 |||||
43+
| ESP32-S3 |||||
44+
| ESP32-C2 |||||
45+
| ESP32-C3 |||||
46+
| ESP32-H2 |||||
47+
| ESP32-C6 |||||
48+
| ESP32-C5 ||| 🚧 ||
49+
| ESP32-P4 || 🚧 |||
50+
| ESP32-C61 |||||
5051

5152
**Legend**: ✅ Supported | ❌ Not supported | 🚧 Under development
5253

5354
> [!NOTE]
54-
> **Stub support**: ESP8266, ESP32-C5, and ESP32-P4 stub support is under development
55+
> **Stub support**: ESP8266, ESP32-C5, ESP32-P4, and ESP32-C61 stub support is under development
5556
5657
### Public API
5758

19.4 KB
Binary file not shown.
62.1 KB
Binary file not shown.
3 KB
Binary file not shown.
62.5 KB
Binary file not shown.

examples/common/example_common.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ extern const uint8_t ESP32_P4_partition_table_bin[];
135135
extern const uint32_t ESP32_P4_partition_table_bin_size;
136136
extern const uint8_t ESP32_P4_partition_table_bin_md5[];
137137

138+
extern const uint8_t ESP32_C61_bootloader_bin[];
139+
extern const uint32_t ESP32_C61_bootloader_bin_size;
140+
extern const uint8_t ESP32_C61_bootloader_bin_md5[];
141+
extern const uint8_t ESP32_C61_hello_world_bin[];
142+
extern const uint32_t ESP32_C61_hello_world_bin_size;
143+
extern const uint8_t ESP32_C61_hello_world_bin_md5[];
144+
extern const uint8_t ESP32_C61_partition_table_bin[];
145+
extern const uint32_t ESP32_C61_partition_table_bin_size;
146+
extern const uint8_t ESP32_C61_partition_table_bin_md5[];
147+
138148
void get_example_binaries(target_chip_t target, example_binaries_t *bins)
139149
{
140150
if (target == ESP8266_CHIP) {
@@ -267,6 +277,19 @@ void get_example_binaries(target_chip_t target, example_binaries_t *bins)
267277
bins->app.size = ESP32_P4_hello_world_bin_size;
268278
bins->app.md5 = ESP32_P4_hello_world_bin_md5;
269279
bins->app.addr = APPLICATION_ADDRESS;
280+
} else if (target == ESP32C61_CHIP) {
281+
bins->boot.data = ESP32_C61_bootloader_bin;
282+
bins->boot.size = ESP32_C61_bootloader_bin_size;
283+
bins->boot.md5 = ESP32_C61_bootloader_bin_md5;
284+
bins->boot.addr = BOOTLOADER_ADDRESS_V1;
285+
bins->part.data = ESP32_C61_partition_table_bin;
286+
bins->part.size = ESP32_C61_partition_table_bin_size;
287+
bins->part.md5 = ESP32_C61_partition_table_bin_md5;
288+
bins->part.addr = PARTITION_ADDRESS;
289+
bins->app.data = ESP32_C61_hello_world_bin;
290+
bins->app.size = ESP32_C61_hello_world_bin_size;
291+
bins->app.md5 = ESP32_C61_hello_world_bin_md5;
292+
bins->app.addr = APPLICATION_ADDRESS;
270293
} else {
271294
abort();
272295
}
@@ -289,6 +312,8 @@ extern const uint8_t ESP32_C5_app_bin[];
289312
extern const uint32_t ESP32_C5_app_bin_size;
290313
extern const uint8_t ESP32_P4_app_bin[];
291314
extern const uint32_t ESP32_P4_app_bin_size;
315+
extern const uint8_t ESP32_C61_app_bin[];
316+
extern const uint32_t ESP32_C61_app_bin_size;
292317

293318

294319
void get_example_ram_app_binary(target_chip_t target, example_ram_app_binary_t *bin)
@@ -334,6 +359,11 @@ void get_example_ram_app_binary(target_chip_t target, example_ram_app_binary_t *
334359
bin->ram_app.size = ESP32_P4_app_bin_size;
335360
break;
336361
}
362+
case ESP32C61_CHIP: {
363+
bin->ram_app.data = ESP32_C61_app_bin;
364+
bin->ram_app.size = ESP32_C61_app_bin_size;
365+
break;
366+
}
337367
default: {
338368
abort();
339369
}

include/esp_loader.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ typedef enum {
6666
ESP32H2_CHIP = 7,
6767
ESP32C6_CHIP = 8,
6868
ESP32P4_CHIP = 9,
69-
ESP_MAX_CHIP = 10,
70-
ESP_UNKNOWN_CHIP = 10
69+
ESP32C61_CHIP = 10,
70+
ESP_MAX_CHIP = 11,
71+
ESP_UNKNOWN_CHIP = 11
7172
} target_chip_t;
7273

7374
/**

src/esp_loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ esp_loader_error_t esp_loader_connect_with_stub(esp_loader_connect_args_t *conne
120120

121121
RETURN_ON_ERROR(loader_detect_chip(&s_target, &s_reg));
122122

123-
if (s_target == ESP32P4_CHIP || s_target == ESP32C5_CHIP) {
123+
if (s_target == ESP32P4_CHIP || s_target == ESP32C5_CHIP || s_target == ESP32C61_CHIP) {
124124
return ESP_LOADER_ERROR_UNSUPPORTED_CHIP;
125125
}
126126

src/esp_stubs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ _Static_assert(ESP32C5_CHIP == 6, "Stub order matches target_chip_t enumeration"
4242
_Static_assert(ESP32H2_CHIP == 7, "Stub order matches target_chip_t enumeration");
4343
_Static_assert(ESP32C6_CHIP == 8, "Stub order matches target_chip_t enumeration");
4444
_Static_assert(ESP32P4_CHIP == 9, "Stub order matches target_chip_t enumeration");
45-
_Static_assert(ESP_MAX_CHIP == 10, "Stub order matches target_chip_t enumeration");
45+
_Static_assert(ESP32C61_CHIP == 10, "Stub order matches target_chip_t enumeration");
46+
_Static_assert(ESP_MAX_CHIP == 11, "Stub order matches target_chip_t enumeration");
4647
#endif
4748

4849
const esp_stub_t esp_stub[ESP_MAX_CHIP] = {
@@ -188,6 +189,8 @@ const esp_stub_t esp_stub[ESP_MAX_CHIP] = {
188189
// placeholder
189190
{},
190191

192+
// placeholder
193+
{},
191194
};
192195

193196
#endif

src/esp_targets.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ typedef struct {
3838
#define ESP32C5_SPI_REG_BASE 0x60003000
3939
#define ESP32C6_SPI_REG_BASE 0x60003000
4040
#define ESP32P4_SPI_REG_BASE 0x5008d000
41+
#define ESP32C61_SPI_REG_BASE 0x60003000
4142
#define ESP32xx_SPI_REG_BASE 0x60002000
4243
#define ESP32_SPI_REG_BASE 0x3ff42000
4344

@@ -254,6 +255,25 @@ static const esp_target_t esp_target[ESP_MAX_CHIP] = {
254255
.chip_id = 18,
255256
},
256257

258+
// ESP32C61
259+
{
260+
.regs = {
261+
.cmd = ESP32C61_SPI_REG_BASE + 0x00,
262+
.usr = ESP32C61_SPI_REG_BASE + 0x18,
263+
.usr1 = ESP32C61_SPI_REG_BASE + 0x1c,
264+
.usr2 = ESP32C61_SPI_REG_BASE + 0x20,
265+
.w0 = ESP32C61_SPI_REG_BASE + 0x58,
266+
.mosi_dlen = ESP32C61_SPI_REG_BASE + 0x24,
267+
.miso_dlen = ESP32C61_SPI_REG_BASE + 0x28,
268+
},
269+
.efuse_base = 0x600B4800,
270+
.chip_magic_value = (const uint32_t[]){ 0x7211606F },
271+
.magic_values_count = 1,
272+
.read_spi_config = spi_config_unsupported,
273+
.mac_efuse_offset = 0x44,
274+
.encryption_in_begin_flash_cmd = true,
275+
.chip_id = 20,
276+
},
257277
};
258278

259279
const target_registers_t *get_esp_target_data(target_chip_t chip)

0 commit comments

Comments
 (0)