Skip to content

ESP32: Use ESP-IDF v5.0.5. #13364

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

Closed
wants to merge 3 commits into from
Closed
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
8 changes: 4 additions & 4 deletions ports/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ manage the ESP32 microcontroller, as well as a way to manage the required
build environment and toolchains needed to build the firmware.

The ESP-IDF changes quickly and MicroPython only supports certain versions.
Currently MicroPython supports v5.0.4, v5.1.2.
Currently MicroPython supports v5.0.5, v5.1.2.

To install the ESP-IDF the full instructions can be found at the
[Espressif Getting Started guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#installation-step-by-step).
Expand All @@ -46,10 +46,10 @@ The steps to take are summarised below.
To check out a copy of the IDF use git clone:

```bash
$ git clone -b v5.0.4 --recursive https://github.com/espressif/esp-idf.git
$ git clone -b v5.0.5 --recursive https://github.com/espressif/esp-idf.git
```

You can replace `v5.0.4` with any other supported version.
You can replace `v5.0.5` with any other supported version.
(You don't need a full recursive clone; see the `ci_esp32_setup` function in
`tools/ci.sh` in this repository for more detailed set-up commands.)

Expand All @@ -58,7 +58,7 @@ MicroPython and update the submodules using:

```bash
$ cd esp-idf
$ git checkout v5.0.4
$ git checkout v5.0.5
$ git submodule update --init --recursive
```

Expand Down
5 changes: 5 additions & 0 deletions ports/esp32/machine_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// This file is never compiled standalone, it's included directly from
// extmod/machine_uart.c via MICROPY_PY_MACHINE_UART_INCLUDEFILE.

#include "soc/uart_periph.h"
#include "driver/uart.h"
#include "freertos/FreeRTOS.h"

Expand Down Expand Up @@ -306,7 +307,11 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
}
self->flowcontrol = args[ARG_flow].u_int;
}
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
check_esp_err(uart_set_hw_flow_ctrl(self->uart_num, self->flowcontrol, UART_FIFO_LEN - UART_FIFO_LEN / 4));
#else
check_esp_err(uart_set_hw_flow_ctrl(self->uart_num, self->flowcontrol, UART_HW_FIFO_LEN(self->uart_num) - UART_HW_FIFO_LEN(self->uart_num) / 4));
#endif
}

STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
Expand Down
2 changes: 1 addition & 1 deletion ports/esp32/main_esp32/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
dependencies:
espressif/mdns: "~1.1.0"
idf:
version: ">=5.0.4"
version: ">=5.0.5"
2 changes: 1 addition & 1 deletion ports/esp32/main_esp32c3/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
dependencies:
espressif/mdns: "~1.1.0"
idf:
version: ">=5.0.4"
version: ">=5.0.5"
2 changes: 1 addition & 1 deletion ports/esp32/main_esp32s2/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dependencies:
espressif/mdns: "~1.1.0"
espressif/esp_tinyusb: "~1.0.0"
idf:
version: ">=5.0.4"
version: ">=5.0.5"
2 changes: 1 addition & 1 deletion ports/esp32/main_esp32s3/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dependencies:
espressif/mdns: "~1.1.0"
espressif/esp_tinyusb: "~1.0.0"
idf:
version: ">=5.0.4"
version: ">=5.0.5"
5 changes: 4 additions & 1 deletion ports/esp32/modnetwork_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@
{ MP_ROM_QSTR(MP_QSTR_AUTH_WPA2_WPA3_PSK), MP_ROM_INT(WIFI_AUTH_WPA2_WPA3_PSK) },
{ MP_ROM_QSTR(MP_QSTR_AUTH_WAPI_PSK), MP_ROM_INT(WIFI_AUTH_WAPI_PSK) },
{ MP_ROM_QSTR(MP_QSTR_AUTH_OWE), MP_ROM_INT(WIFI_AUTH_OWE) },
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 1, 1)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 5)
{ MP_ROM_QSTR(MP_QSTR_AUTH_WPA3_ENT_192), MP_ROM_INT(WIFI_AUTH_WPA3_ENT_192) },
#endif
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
{ MP_ROM_QSTR(MP_QSTR_AUTH_WPA3_EXT_PSK), MP_ROM_INT(WIFI_AUTH_WPA3_EXT_PSK) },
#endif
{ MP_ROM_QSTR(MP_QSTR_AUTH_MAX), MP_ROM_INT(WIFI_AUTH_MAX) },
#endif

Expand Down
4 changes: 3 additions & 1 deletion ports/esp32/network_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ STATIC mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_network_phy_mode_obj, 0, 1, esp_phy_mode);

#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 1, 1)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
_Static_assert(WIFI_AUTH_MAX == 12, "Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h");
#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 5)
_Static_assert(WIFI_AUTH_MAX == 11, "Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h");
#else
_Static_assert(WIFI_AUTH_MAX == 10, "Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h");
Expand Down
3 changes: 2 additions & 1 deletion ports/esp32/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#if MICROPY_HW_ENABLE_UART_REPL

#include <stdio.h>
#include "soc/uart_periph.h"
#include "driver/uart.h" // For uart_get_sclk_freq()
#include "hal/uart_hal.h"

Expand All @@ -50,7 +51,7 @@ STATIC void uart_irq_handler(void *arg);

void uart_stdout_init(void) {
uart_hal_context_t repl_hal = REPL_HAL_DEFN();
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
uart_sclk_t sclk;
#else
soc_module_clk_t sclk;
Expand Down
2 changes: 1 addition & 1 deletion tools/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function ci_cc3200_build {
# ports/esp32

# GitHub tag of ESP-IDF to use for CI (note: must be a tag or a branch)
IDF_VER=v5.0.4
IDF_VER=v5.0.5

export IDF_CCACHE_ENABLE=1

Expand Down