mirror of
https://github.com/esphome/esphome.git
synced 2025-01-24 13:24:27 +01:00
Allow patching esp-idf with esp-adf files
This commit is contained in:
parent
bab9c7c70e
commit
3e58ee2130
2 changed files with 35 additions and 0 deletions
|
@ -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",
|
||||
)
|
||||
|
|
23
esphome/components/esp_adf/apply_adf_patches.py.script
Normal file
23
esphome/components/esp_adf/apply_adf_patches.py.script
Normal 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))
|
Loading…
Add table
Reference in a new issue