Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for esp32c6 #976

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/esp32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
gcc g++ zlib1g-dev

- name: Install qemu binary from espressif/qemu
if: matrix.idf-version != '5.1.1'
if: matrix.idf-version != '5.1.2'
run: |
set -eu
QEMU_VER=esp-develop-20220919
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/esp32-mkimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ jobs:

strategy:
matrix:
idf-version: ["4.4.6"]
idf-version: ["4.4.6", "5.1.2"]
cc: ["clang-10"]
cxx: ["clang++-10"]
cflags: ["-O3"]
otp: ["24"]
elixir_version: ["1.11"]
compiler_pkgs: ["clang-10"]
soc: ["esp32", "esp32c3", "esp32s2", "esp32s3"]
soc: ["esp32", "esp32c3", "esp32s2", "esp32s3", "esp32c6"]
exclude:
- soc: "esp32c6"
idf-version: "4.4.6"

env:
CC: ${{ matrix.cc }}
Expand Down
6 changes: 6 additions & 0 deletions src/platforms/esp32/components/avm_builtins/gpio_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ static term nif_gpio_hold_dis(Context *ctx, int argc, term argv[])
return hold_dis(argv[0]);
}

#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
static term nif_gpio_deep_sleep_hold_en(Context *ctx, int argc, term argv[])
{
UNUSED(ctx);
Expand All @@ -570,6 +571,7 @@ static term nif_gpio_deep_sleep_hold_dis(Context *ctx, int argc, term argv[])
gpio_deep_sleep_hold_dis();
return OK_ATOM;
}
#endif

static term nif_gpio_digital_write(Context *ctx, int argc, term argv[])
{
Expand Down Expand Up @@ -605,6 +607,7 @@ static const struct Nif gpio_hold_dis_nif =
.nif_ptr = nif_gpio_hold_dis
};

#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
static const struct Nif gpio_deep_sleep_hold_en_nif =
{
.base.type = NIFFunctionType,
Expand All @@ -616,6 +619,7 @@ static const struct Nif gpio_deep_sleep_hold_dis_nif =
.base.type = NIFFunctionType,
.nif_ptr = nif_gpio_deep_sleep_hold_dis
};
#endif

static const struct Nif gpio_digital_write_nif =
{
Expand Down Expand Up @@ -654,6 +658,7 @@ const struct Nif *gpio_nif_get_nif(const char *nifname)
return &gpio_hold_dis_nif;
}

#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
if (strcmp("gpio:deep_sleep_hold_en/0", nifname) == 0 || strcmp("Elixir.GPIO:deep_sleep_hold_en/0", nifname) == 0) {
TRACE("Resolved platform nif %s ...\n", nifname);
return &gpio_deep_sleep_hold_en_nif;
Expand All @@ -663,6 +668,7 @@ const struct Nif *gpio_nif_get_nif(const char *nifname)
TRACE("Resolved platform nif %s ...\n", nifname);
return &gpio_deep_sleep_hold_dis_nif;
}
#endif

if (strcmp("gpio:digital_write/2", nifname) == 0) {
TRACE("Resolved platform nif %s ...\n", nifname);
Expand Down
20 changes: 17 additions & 3 deletions src/platforms/esp32/components/avm_builtins/spi_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,23 @@ static const AtomStringIntPair spi_cmd_table[] = {
};

static const AtomStringIntPair spi_host_table[] = {
// aliases for different chips, deprecated for the chips after esp32s2
#ifdef SPI_HOST
{ ATOM_STR("\x3", "spi"), SPI_HOST },
#endif
#ifdef HSPI_HOST
{ ATOM_STR("\x4", "hspi"), HSPI_HOST },
#ifndef CONFIG_IDF_TARGET_ESP32C3
#endif
#ifdef VSPI_HOST
{ ATOM_STR("\x4", "vspi"), VSPI_HOST },
#endif
#ifdef FSPI_HOST
{ ATOM_STR("\x4", "fspi"), FSPI_HOST },
#endif
{ ATOM_STR("\x4", "spi1"), SPI1_HOST },
{ ATOM_STR("\x4", "spi2"), SPI2_HOST },
#if SOC_SPI_PERIPH_NUM > 2
{ ATOM_STR("\x4", "spi3"), SPI3_HOST },
#endif
SELECT_INT_DEFAULT(-1)
};
Expand All @@ -125,8 +139,8 @@ static spi_host_device_t get_spi_host_device(term spi_peripheral, GlobalContext
int peripheral = interop_atom_term_select_int(spi_host_table, spi_peripheral, global);

if (peripheral < 0) {
ESP_LOGW(TAG, "Unrecognized SPI peripheral. Must be either hspi or vspi. Defaulting to hspi.");
return HSPI_HOST;
ESP_LOGW(TAG, "Unrecognized SPI peripheral. Defaulting to spi2.");
return SPI2_HOST;
}

return peripheral;
Expand Down
Loading