From a91500217757d9f7dc9791f014cfb465955f7d42 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 15 Feb 2021 21:00:09 +1100 Subject: [PATCH] esp32: Add support to build with ESP-IDF v4.2. Signed-off-by: Damien George --- ports/esp32/README.md | 2 +- ports/esp32/main/CMakeLists.txt | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ports/esp32/README.md b/ports/esp32/README.md index d8818ccadb..c349f44b27 100644 --- a/ports/esp32/README.md +++ b/ports/esp32/README.md @@ -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 v4.0.2 and v4.1.1, +Currently MicroPython supports v4.0.2, v4.1.1 and v4.2, although other IDF v4 versions may also work. To install the ESP-IDF the full instructions can be found at the diff --git a/ports/esp32/main/CMakeLists.txt b/ports/esp32/main/CMakeLists.txt index 2455a4cdd2..52985383f9 100644 --- a/ports/esp32/main/CMakeLists.txt +++ b/ports/esp32/main/CMakeLists.txt @@ -108,6 +108,11 @@ if(IDF_VERSION_MINOR GREATER_EQUAL 1) list(APPEND IDF_COMPONENTS esp_netif) endif() +if(IDF_VERSION_MINOR GREATER_EQUAL 2) + list(APPEND IDF_COMPONENTS esp_system) + list(APPEND IDF_COMPONENTS esp_timer) +endif() + # Register the main IDF component. idf_component_register( SRCS @@ -169,5 +174,12 @@ foreach(comp ${IDF_COMPONENTS}) endif() endforeach() +if(IDF_VERSION_MINOR GREATER_EQUAL 2) + # These paths cannot currently be found by the IDF_COMPONENTS search loop above, + # so add them explicitly. + list(APPEND MICROPY_CPP_INC_EXTRA ${IDF_PATH}/components/soc/soc/${IDF_TARGET}/include) + list(APPEND MICROPY_CPP_INC_EXTRA ${IDF_PATH}/components/soc/soc/include) +endif() + # Include the main MicroPython cmake rules. include(${MICROPY_DIR}/py/mkrules.cmake)