From 4de642ff28260944e6e7d6399bff1fad7b4d6205 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Mon, 31 Jan 2022 07:59:56 +0100 Subject: [PATCH] Bump esp-idf framework version from 4.3.0 to 4.3.2 (#3120) --- esphome/components/esp32/__init__.py | 20 ++++++++++++++------ esphome/components/md5/md5.cpp | 13 +++++++++++++ esphome/components/md5/md5.h | 4 ++-- platformio.ini | 6 +++--- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/esphome/components/esp32/__init__.py b/esphome/components/esp32/__init__.py index cec72e1b7..1229675ad 100644 --- a/esphome/components/esp32/__init__.py +++ b/esphome/components/esp32/__init__.py @@ -18,6 +18,7 @@ from esphome.const import ( KEY_FRAMEWORK_VERSION, KEY_TARGET_FRAMEWORK, KEY_TARGET_PLATFORM, + __version__, ) from esphome.core import CORE, HexInt import esphome.config_validation as cv @@ -106,7 +107,6 @@ def _format_framework_espidf_version(ver: cv.Version) -> str: # The new version needs to be thoroughly validated before changing the # recommended version as otherwise a bunch of devices could be bricked # * For all constants below, update platformio.ini (in this repo) -# and platformio.ini/platformio-lint.ini in the esphome-docker-base repository # The default/recommended arduino framework version # - https://github.com/espressif/arduino-esp32/releases @@ -115,16 +115,16 @@ RECOMMENDED_ARDUINO_FRAMEWORK_VERSION = cv.Version(1, 0, 6) # The platformio/espressif32 version to use for arduino frameworks # - https://github.com/platformio/platform-espressif32/releases # - https://api.registry.platformio.org/v3/packages/platformio/platform/espressif32 -ARDUINO_PLATFORM_VERSION = cv.Version(3, 3, 2) +ARDUINO_PLATFORM_VERSION = cv.Version(3, 5, 0) # The default/recommended esp-idf framework version # - https://github.com/espressif/esp-idf/releases # - https://api.registry.platformio.org/v3/packages/platformio/tool/framework-espidf -RECOMMENDED_ESP_IDF_FRAMEWORK_VERSION = cv.Version(4, 3, 0) +RECOMMENDED_ESP_IDF_FRAMEWORK_VERSION = cv.Version(4, 3, 2) # The platformio/espressif32 version to use for esp-idf frameworks # - https://github.com/platformio/platform-espressif32/releases # - https://api.registry.platformio.org/v3/packages/platformio/platform/espressif32 -ESP_IDF_PLATFORM_VERSION = cv.Version(3, 3, 2) +ESP_IDF_PLATFORM_VERSION = cv.Version(3, 5, 0) def _arduino_check_versions(value): @@ -165,8 +165,8 @@ def _arduino_check_versions(value): def _esp_idf_check_versions(value): value = value.copy() lookups = { - "dev": (cv.Version(4, 3, 1), "https://github.com/espressif/esp-idf.git"), - "latest": (cv.Version(4, 3, 0), None), + "dev": (cv.Version(5, 0, 0), "https://github.com/espressif/esp-idf.git"), + "latest": (cv.Version(4, 3, 2), None), "recommended": (RECOMMENDED_ESP_IDF_FRAMEWORK_VERSION, None), } @@ -431,6 +431,14 @@ def copy_files(): CORE.relative_build_path("partitions.csv"), IDF_PARTITIONS_CSV, ) + # IDF build scripts look for version string to put in the build. + # However, if the build path does not have an initialized git repo, + # and no version.txt file exists, the CMake script fails for some setups. + # Fix by manually pasting a version.txt file, containing the ESPHome version + write_file_if_changed( + CORE.relative_build_path("version.txt"), + __version__, + ) dir = os.path.dirname(__file__) post_build_file = os.path.join(dir, "post_build.py.script") diff --git a/esphome/components/md5/md5.cpp b/esphome/components/md5/md5.cpp index 0528a87d0..8d4bac1fd 100644 --- a/esphome/components/md5/md5.cpp +++ b/esphome/components/md5/md5.cpp @@ -6,6 +6,7 @@ namespace esphome { namespace md5 { +#ifdef USE_ARDUINO void MD5Digest::init() { memset(this->digest_, 0, 16); MD5Init(&this->ctx_); @@ -14,6 +15,18 @@ void MD5Digest::init() { void MD5Digest::add(const uint8_t *data, size_t len) { MD5Update(&this->ctx_, data, len); } void MD5Digest::calculate() { MD5Final(this->digest_, &this->ctx_); } +#endif // USE_ARDUINO + +#ifdef USE_ESP_IDF +void MD5Digest::init() { + memset(this->digest_, 0, 16); + esp_rom_md5_init(&this->ctx_); +} + +void MD5Digest::add(const uint8_t *data, size_t len) { esp_rom_md5_update(&this->ctx_, data, len); } + +void MD5Digest::calculate() { esp_rom_md5_final(this->digest_, &this->ctx_); } +#endif // USE_ESP_IDF void MD5Digest::get_bytes(uint8_t *output) { memcpy(output, this->digest_, 16); } diff --git a/esphome/components/md5/md5.h b/esphome/components/md5/md5.h index 1c15c9e57..a9628c924 100644 --- a/esphome/components/md5/md5.h +++ b/esphome/components/md5/md5.h @@ -3,8 +3,8 @@ #include "esphome/core/defines.h" #ifdef USE_ESP_IDF -#include "esp32/rom/md5_hash.h" -#define MD5_CTX_TYPE MD5Context +#include "esp_rom_md5.h" +#define MD5_CTX_TYPE md5_context_t #endif #if defined(USE_ARDUINO) && defined(USE_ESP32) diff --git a/platformio.ini b/platformio.ini index bac248690..d63f28d05 100644 --- a/platformio.ini +++ b/platformio.ini @@ -100,7 +100,7 @@ extra_scripts = post:esphome/components/esp8266/post_build.py.script ; This are common settings for the ESP32 (all variants) using Arduino. [common:esp32-arduino] extends = common:arduino -platform = platformio/espressif32 @ 3.3.2 +platform = platformio/espressif32 @ 3.5.0 platform_packages = platformio/framework-arduinoespressif32 @ ~3.10006.0 @@ -127,9 +127,9 @@ extra_scripts = post:esphome/components/esp32/post_build.py.script ; This are common settings for the ESP32 (all variants) using IDF. [common:esp32-idf] extends = common:idf -platform = platformio/espressif32 @ 3.3.2 +platform = platformio/espressif32 @ 3.5.0 platform_packages = - platformio/framework-espidf @ ~3.40300.0 + platformio/framework-espidf @ ~3.40302.0 framework = espidf lib_deps =