Allow patching esp-idf with esp-adf files

This commit is contained in:
Jesse Hills 2023-09-01 10:13:00 +12:00
parent bab9c7c70e
commit 3e58ee2130
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
2 changed files with 35 additions and 0 deletions

View file

@ -1,3 +1,5 @@
import os
import esphome.config_validation as cv
import esphome.codegen as cg
@ -59,3 +61,13 @@ async def to_code(config):
"board_build.embed_txtfiles", "components/dueros_service/duer_profile"
)
esp32.add_idf_sdkconfig_option(SUPPORTED_BOARDS[esp32.get_board()], True)
esp32.add_extra_script(
"pre",
"apply_adf_patches.py",
os.path.join(os.path.dirname(__file__), "apply_adf_patches.py.script"),
)
esp32.add_extra_build_file(
"esp_adf_patches/idf_v4.4_freertos.patch",
"https://github.com/espressif/esp-adf/raw/v2.5/idf_patches/idf_v4.4_freertos.patch",
)

View file

@ -0,0 +1,23 @@
from os.path import join, isfile
Import("env")
FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-espidf")
patchflag_path = join(FRAMEWORK_DIR, ".adf-patching-done")
PROJECT_DIR = env.get('PROJECT_DIR')
PATCH_FILE = join(PROJECT_DIR, "esp_adf_patches", "idf_v4.4_freertos.patch")
# patch file only if we didn't do it before
if not isfile(patchflag_path):
print(PATCH_FILE)
assert isfile(PATCH_FILE)
env.Execute("patch -p1 -d %s -i %s" % (FRAMEWORK_DIR, PATCH_FILE))
def _touch(path):
with open(path, "w") as fp:
fp.write("")
env.Execute(lambda *args, **kwargs: _touch(patchflag_path))