From 173a93a60020d869c46edafa0ae8b0b809ae678e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:17:38 +0100 Subject: [PATCH 01/99] Rename examples.yml to examples.yml.off --- .github/workflows/{examples.yml => examples.yml.off} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{examples.yml => examples.yml.off} (100%) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml.off similarity index 100% rename from .github/workflows/examples.yml rename to .github/workflows/examples.yml.off From 02582bde0043128d38f257fc8d8c68a9096dd114 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:35:05 +0100 Subject: [PATCH 02/99] Update platform.py --- platform.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/platform.py b/platform.py index 11f190b85..970dbe23b 100644 --- a/platform.py +++ b/platform.py @@ -37,11 +37,12 @@ def configure_default_packages(self, variables, targets): board_config = self.board_config(variables.get("board")) mcu = variables.get("board_build.mcu", board_config.get("build.mcu", "esp32")) + board_sdkconfig = variables.get("board_espidf.custom_sdkconfig", board_config.get("espidf.custom_sdkconfig", "")) + core_variant_board = ''.join(variables.get("board_build.extra_flags", board_config.get("build.extra_flags", ""))) + core_variant_board = core_variant_board.replace("-D", " ") + core_variant_build = (''.join(variables.get("build_flags", []))).replace("-D", " ") frameworks = variables.get("pioframework", []) - if variables.get("custom_sdkconfig") is not None: - frameworks.append("espidf") - if "arduino" in frameworks: self.packages["framework-arduinoespressif32"]["optional"] = False self.packages["framework-arduinoespressif32-libs"]["optional"] = False @@ -51,6 +52,10 @@ def configure_default_packages(self, variables, targets): dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url'] self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url + if variables.get("custom_sdkconfig") is not None or len(str(board_sdkconfig)) > 3: + frameworks.append("espidf") + self.packages["framework-espidf"]["optional"] = False + if "buildfs" in targets: filesystem = variables.get("board_build.filesystem", "littlefs") if filesystem == "littlefs": @@ -90,10 +95,10 @@ def configure_default_packages(self, variables, targets): if "espidf" in frameworks: self.packages["toolchain-esp32ulp"]["optional"] = False for p in self.packages: - if p in ("tool-cmake", "tool-ninja"): + if p in ("tool-scons", "tool-cmake", "tool-ninja"): self.packages[p]["optional"] = False -# elif p in ("tool-mconf", "tool-idf") and IS_WINDOWS: -# self.packages[p]["optional"] = False + # elif p in ("tool-mconf", "tool-idf") and IS_WINDOWS: + # self.packages[p]["optional"] = False if mcu in ("esp32", "esp32s2", "esp32s3"): self.packages["toolchain-xtensa-esp-elf"]["optional"] = False From 366a4b432f47ac0905cedebf2870dfedd1e5c81b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:42:30 +0100 Subject: [PATCH 03/99] Update main.py --- builder/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/builder/main.py b/builder/main.py index 32ea2c95d..01cf07216 100644 --- a/builder/main.py +++ b/builder/main.py @@ -298,6 +298,7 @@ def __fetch_fs_size(target, source, env): ), ESP32_APP_OFFSET=env.get("INTEGRATION_EXTRA_DATA").get("application_offset"), + ARDUINO_LIB_COMPILE_FLAG="Inactive", PROGSUFFIX=".elf" ) From d32b3aaf29e60a3f02d59813dfdc71cc3f509d6a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:58:36 +0100 Subject: [PATCH 04/99] Update arduino.py --- builder/frameworks/arduino.py | 166 ++++++++++++++++++++++++++++++++-- 1 file changed, 160 insertions(+), 6 deletions(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 4af76df8b..cd1ce4150 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -1,3 +1,4 @@ + # Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,17 +23,170 @@ http://arduino.cc/en/Reference/HomePage """ +import subprocess +import json +import semantic_version +import os +import shutil from os.path import join -from SCons.Script import DefaultEnvironment, SConscript +from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, SConscript +from platformio.package.version import pepver_to_semver +from platformio.project.config import ProjectConfig +from platformio.package.manager.tool import ToolPackageManager env = DefaultEnvironment() +pm = ToolPackageManager() +platform = env.PioPlatform() +config = env.GetProjectConfig() board = env.BoardConfig() -build_core = board.get("build.core", "").lower() +mcu = board.get("build.mcu", "esp32") +board_sdkconfig = board.get("espidf.custom_sdkconfig", "") +entry_custom_sdkconfig = "\n" +flag_custom_sdkconfig = False + +if config.has_option("env:"+env["PIOENV"], "custom_sdkconfig"): + entry_custom_sdkconfig = env.GetProjectOption("custom_sdkconfig") + flag_custom_sdkconfig = True + +if len(str(board_sdkconfig)) > 2: + flag_custom_sdkconfig = True + +extra_flags = (''.join([element for element in board.get("build.extra_flags", "")])).replace("-D", " ") +framework_reinstall = False +flag_any_custom_sdkconfig = False SConscript("_embed_files.py", exports="env") -if "espidf" not in env.subst("$PIOFRAMEWORK"): - SConscript( - join(DefaultEnvironment().PioPlatform().get_package_dir( - "framework-arduinoespressif32"), "tools", "platformio-build.py")) +flag_any_custom_sdkconfig = os.path.exists(join(platform.get_package_dir("framework-arduinoespressif32-libs"),"tools","esp32-arduino-libs","sdkconfig")) + +# Esp32-solo1 libs needs adopted settings +if flag_custom_sdkconfig == True and "CORE32SOLO1" in extra_flags and ("CONFIG_FREERTOS_UNICORE=y" in entry_custom_sdkconfig or "CONFIG_FREERTOS_UNICORE=y" in board_sdkconfig): + if len(str(env.GetProjectOption("build_unflags"))) == 2: # No valid env, needs init + env['BUILD_UNFLAGS'] = {} + build_unflags = " ".join(env['BUILD_UNFLAGS']) + build_unflags = build_unflags + " -mdisable-hardware-atomics -ustart_app_other_cores" + new_build_unflags = build_unflags.split() + env.Replace( + BUILD_UNFLAGS=new_build_unflags + ) + +def install_python_deps(): + def _get_installed_pip_packages(): + result = {} + packages = {} + pip_output = subprocess.check_output( + [ + env.subst("$PYTHONEXE"), + "-m", + "pip", + "list", + "--format=json", + "--disable-pip-version-check", + ] + ) + try: + packages = json.loads(pip_output) + except: + print("Warning! Couldn't extract the list of installed Python packages.") + return {} + for p in packages: + result[p["name"]] = pepver_to_semver(p["version"]) + + return result + + deps = { + "wheel": ">=0.35.1", + "PyYAML": ">=6.0.2", + "intelhex": ">=2.3.0" + } + + installed_packages = _get_installed_pip_packages() + packages_to_install = [] + for package, spec in deps.items(): + if package not in installed_packages: + packages_to_install.append(package) + else: + version_spec = semantic_version.Spec(spec) + if not version_spec.match(installed_packages[package]): + packages_to_install.append(package) + + if packages_to_install: + env.Execute( + env.VerboseAction( + ( + '"$PYTHONEXE" -m pip install -U ' + + " ".join( + [ + '"%s%s"' % (p, deps[p]) + for p in packages_to_install + ] + ) + ), + "Installing Arduino Python dependencies", + ) + ) + return + +install_python_deps() + +def get_MD5_hash(phrase): + import hashlib + return hashlib.md5((phrase).encode('utf-8')).hexdigest()[:16] + + +def matching_custom_sdkconfig(): + # check if current env is matching to existing sdkconfig + cust_sdk_is_present = False + matching_sdkconfig = False + last_sdkconfig_path = join(env.subst("$PROJECT_DIR"),"sdkconfig.defaults") + if flag_any_custom_sdkconfig == False: + matching_sdkconfig = True + return matching_sdkconfig, cust_sdk_is_present + if os.path.exists(last_sdkconfig_path) == False: + return matching_sdkconfig, cust_sdk_is_present + if flag_custom_sdkconfig == False: + matching_sdkconfig = False + return matching_sdkconfig, cust_sdk_is_present + with open(last_sdkconfig_path) as src: + line = src.readline() + if line.startswith("# TASMOTA__"): + cust_sdk_is_present = True; + costum_options = entry_custom_sdkconfig + if (line.split("__")[1]).strip() == get_MD5_hash((costum_options).strip() + mcu): + matching_sdkconfig = True + + return matching_sdkconfig, cust_sdk_is_present + +def check_reinstall_frwrk(): + framework_reinstall = False + cust_sdk_is_present = False + matching_sdkconfig = False + if flag_custom_sdkconfig == True: + matching_sdkconfig, cust_sdk_is_present = matching_custom_sdkconfig() + if flag_custom_sdkconfig == False and flag_any_custom_sdkconfig == True: + # case custom sdkconfig exists and a env without "custom_sdkconfig" + framework_reinstall = True + if flag_custom_sdkconfig == True and matching_sdkconfig == False: + # check if current custom sdkconfig is different from existing + framework_reinstall = True + return framework_reinstall + +def call_compile_libs(): + print("*** Compile Arduino IDF libs for %s ***" % env["PIOENV"]) + SConscript("espidf.py") + +if check_reinstall_frwrk() == True: + print("*** Reinstall Arduino framework libs ***") + shutil.rmtree(platform.get_package_dir("framework-arduinoespressif32-libs")) + ARDUINO_FRMWRK_LIB_URL = str(platform.get_package_spec("framework-arduinoespressif32-libs")).split("uri=",1)[1][:-1] + pm.install(ARDUINO_FRMWRK_LIB_URL) + if flag_custom_sdkconfig == True: + call_compile_libs() + flag_custom_sdkconfig = False + +if flag_custom_sdkconfig == True and flag_any_custom_sdkconfig == False: + call_compile_libs() + +if "arduino" in env.subst("$PIOFRAMEWORK") and "espidf" not in env.subst("$PIOFRAMEWORK") and env.subst("$ARDUINO_LIB_COMPILE_FLAG") in ("Inactive", "True"): + SConscript(join(FRAMEWORK_DIR, "tools", "platformio-build.py")) From b82581b146d8eb4818955308ed50dfed1a72d618 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:04:07 +0100 Subject: [PATCH 05/99] Update arduino.py --- builder/frameworks/arduino.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index cd1ce4150..5f496ade1 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -1,4 +1,3 @@ - # Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -189,4 +188,4 @@ def call_compile_libs(): call_compile_libs() if "arduino" in env.subst("$PIOFRAMEWORK") and "espidf" not in env.subst("$PIOFRAMEWORK") and env.subst("$ARDUINO_LIB_COMPILE_FLAG") in ("Inactive", "True"): - SConscript(join(FRAMEWORK_DIR, "tools", "platformio-build.py")) + SConscript(join(platform.get_package_dir("framework-arduinoespressif32"), "tools", "platformio-build.py"))) From 43428937ee35571501546f1ea595802b6b36020a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:19:37 +0100 Subject: [PATCH 06/99] Update espidf.py --- builder/frameworks/espidf.py | 377 ++++++++++++++++++++++++++++++++++- 1 file changed, 367 insertions(+), 10 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index fe3c0dd8f..cc8fb13f8 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -26,6 +26,7 @@ import sys import shutil import os +from os.path import join import re import platform as sys_platform @@ -53,13 +54,78 @@ env = DefaultEnvironment() env.SConscript("_embed_files.py", exports="env") +def install_standard_python_deps(): + def _get_installed_standard_pip_packages(): + result = {} + packages = {} + pip_output = subprocess.check_output( + [ + env.subst("$PYTHONEXE"), + "-m", + "pip", + "list", + "--format=json", + "--disable-pip-version-check", + ] + ) + try: + packages = json.loads(pip_output) + except: + print("Warning! Couldn't extract the list of installed Python packages.") + return {} + for p in packages: + result[p["name"]] = pepver_to_semver(p["version"]) + + return result + + deps = { + "wheel": ">=0.35.1", + "PyYAML": ">=6.0.2" + } + + installed_packages = _get_installed_standard_pip_packages() + packages_to_install = [] + for package, spec in deps.items(): + if package not in installed_packages: + packages_to_install.append(package) + else: + version_spec = semantic_version.Spec(spec) + if not version_spec.match(installed_packages[package]): + packages_to_install.append(package) + + if packages_to_install: + env.Execute( + env.VerboseAction( + ( + '"$PYTHONEXE" -m pip install -U ' + + " ".join( + [ + '"%s%s"' % (p, deps[p]) + for p in packages_to_install + ] + ) + ), + "Installing standard Python dependencies", + ) + ) + return + +install_standard_python_deps() + # Allow changes in folders of managed components os.environ["IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS"] = "1" platform = env.PioPlatform() +config = env.GetProjectConfig() board = env.BoardConfig() mcu = board.get("build.mcu", "esp32") +flash_speed = board.get("build.f_flash", "40000000L") +flash_frequency = str(flash_speed.replace("000000L", "m")) +flash_mode = board.get("build.flash_mode", "dio") idf_variant = mcu.lower() +flag_custom_sdkonfig = False +flag_custom_component_add = False +flag_custom_component_remove = False IDF5 = ( platform.get_package_version("framework-espidf") @@ -78,7 +144,6 @@ assert os.path.isdir(FRAMEWORK_DIR) assert os.path.isdir(TOOLCHAIN_DIR) -# The latest IDF uses a standalone GDB package which requires at least PlatformIO 6.1.11 if ( ["espidf"] == env.get("PIOFRAMEWORK") and semantic_version.Version.coerce(__version__) @@ -87,9 +152,10 @@ ): print("Warning! Debugging an IDF project requires PlatformIO Core >= 6.1.11!") -# Arduino framework as a component is not compatible with ESP-IDF >5.2 +# Arduino framework as a component is not compatible with ESP-IDF >5.3 if "arduino" in env.subst("$PIOFRAMEWORK"): ARDUINO_FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") + ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs")) # Possible package names in 'package@version' format is not compatible with CMake if "@" in os.path.basename(ARDUINO_FRAMEWORK_DIR): new_path = os.path.join( @@ -109,6 +175,177 @@ os.path.join(PROJECT_DIR, "sdkconfig.%s" % env.subst("$PIOENV")), )) +# +# generate modified Arduino IDF sdkconfig, applying settings from "custom_sdkconfig" +# +if config.has_option("env:"+env["PIOENV"], "custom_component_add"): + flag_custom_component_add = True +if config.has_option("env:"+env["PIOENV"], "custom_component_remove"): + flag_custom_component_remove = True + +if config.has_option("env:"+env["PIOENV"], "custom_sdkconfig"): + flag_custom_sdkonfig = True +if "espidf.custom_sdkconfig" in board: + flag_custom_sdkonfig = True + +def HandleArduinoIDFsettings(env): + def get_MD5_hash(phrase): + import hashlib + return hashlib.md5((phrase).encode('utf-8')).hexdigest()[:16] + + custom_sdk_config_flags = "" + board_idf_config_flags = "" + + if config.has_option("env:"+env["PIOENV"], "custom_sdkconfig"): + flag_custom_sdkonfig = True + custom_sdk_config_flags = (env.GetProjectOption("custom_sdkconfig").rstrip("\n")) + "\n" + + if "espidf.custom_sdkconfig" in board: + board_idf_config_flags = ('\n'.join([element for element in board.get("espidf.custom_sdkconfig", "")])).rstrip("\n") + "\n" + flag_custom_sdkonfig = True + + if flag_custom_sdkonfig == True: # TDOO duplicated + print("*** Add \"custom_sdkconfig\" settings to IDF sdkconfig.defaults ***") + idf_config_flags = custom_sdk_config_flags + idf_config_flags = idf_config_flags + board_idf_config_flags + if flash_frequency != "80m": + idf_config_flags = idf_config_flags + "# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set\n" + esptool_flashfreq_y = "CONFIG_ESPTOOLPY_FLASHFREQ_%s=y\n" % flash_frequency.upper() + esptool_flashfreq_M = "CONFIG_ESPTOOLPY_FLASHFREQ=\"%s\"\n" % flash_frequency + idf_config_flags = idf_config_flags + esptool_flashfreq_y + esptool_flashfreq_M + if flash_mode != "qio": + idf_config_flags = idf_config_flags + "# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set\n" + esptool_flashmode = "CONFIG_ESPTOOLPY_FLASHMODE_%s=y\n" % flash_mode.upper() + if esptool_flashmode not in idf_config_flags: + idf_config_flags = idf_config_flags + esptool_flashmode + if mcu in ("esp32") and "CONFIG_FREERTOS_UNICORE=y" in idf_config_flags: + idf_config_flags = idf_config_flags + "# CONFIG_SPIRAM is not set\n" + + idf_config_flags = idf_config_flags.splitlines() + sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,"tools","esp32-arduino-libs",mcu,"sdkconfig") + + def get_flag(line): + if line.startswith("#") and "is not set" in line: + return line.split(" ")[1] + elif not line.startswith("#") and len(line.split("=")) > 1: + return line.split("=")[0] + else: + return None + + with open(sdkconfig_src) as src: + sdkconfig_dst = os.path.join(PROJECT_DIR, "sdkconfig.defaults") + dst = open(sdkconfig_dst,"w") + dst.write("# TASMOTA__"+ get_MD5_hash(''.join(custom_sdk_config_flags).strip() + mcu) +"\n") + while line := src.readline(): + flag = get_flag(line) + if flag is None: + dst.write(line) + else: + no_match = True + for item in idf_config_flags: + if flag == get_flag(item.replace("\'", "")): + dst.write(item.replace("\'", "")+"\n") + no_match = False + print("Replace:",line,"with:",item.replace("\'", "")) + idf_config_flags.remove(item) + if no_match: + dst.write(line) + for item in idf_config_flags: # are there new flags? + print("Add:",item.replace("\'", "")) + dst.write(item.replace("\'", "")+"\n") + dst.close() + return + else: + return + +def HandleCOMPONENTsettings(env): + if flag_custom_component_add == True or flag_custom_component_remove == True: # todo remove duplicated + import yaml + from yaml import SafeLoader + print("*** \"custom_component\" is used to select managed idf components ***") + if flag_custom_component_remove == True: + idf_custom_component_remove = env.GetProjectOption("custom_component_remove").splitlines() + else: + idf_custom_component_remove = "" + if flag_custom_component_add == True: + idf_custom_component_add = env.GetProjectOption("custom_component_add").splitlines() + else: + idf_custom_component_add = "" + + # search "idf_component.yml" file + try: # 1.st in Arduino framework + idf_component_yml_src = os.path.join(ARDUINO_FRAMEWORK_DIR, "idf_component.yml") + shutil.copy(join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml"),join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml.orig")) + yml_file_dir = idf_component_yml_src + except: # 2.nd Project source + try: + idf_component_yml_src = os.path.join(PROJECT_SRC_DIR, "idf_component.yml") + shutil.copy(join(PROJECT_SRC_DIR,"idf_component.yml"),join(PROJECT_SRC_DIR,"idf_component.yml.orig")) + yml_file_dir = idf_component_yml_src + except: # no idf_component.yml in Project source -> create + idf_component_yml_src = os.path.join(PROJECT_SRC_DIR, "idf_component.yml") + yml_file_dir = idf_component_yml_src + idf_component_yml_str = """ + dependencies: + idf: \">=5.1\" + """ + idf_component_yml = yaml.safe_load(idf_component_yml_str) + with open(idf_component_yml_src, 'w',) as f : + yaml.dump(idf_component_yml,f) + + yaml_file=open(idf_component_yml_src,"r") + idf_component=yaml.load(yaml_file, Loader=SafeLoader) + idf_component_str=json.dumps(idf_component) # convert to json string + idf_component_json=json.loads(idf_component_str) # convert string to json dict + + if idf_custom_component_remove != "": + for entry in idf_custom_component_remove: + # checking if the entry exists before removing + if entry in idf_component_json["dependencies"]: + print("*** Removing component:",entry) + del idf_component_json["dependencies"][entry] + + if idf_custom_component_add != "": + for entry in idf_custom_component_add: + if len(str(entry)) > 4: # too short or empty entry + # add new entrys to json + if "@" in entry: + idf_comp_entry = str(entry.split("@")[0]).replace(" ", "") + idf_comp_vers = str(entry.split("@")[1]).replace(" ", "") + else: + idf_comp_entry = str(entry).replace(" ", "") + idf_comp_vers = "*" + if idf_comp_entry not in idf_component_json["dependencies"]: + print("*** Adding component:", idf_comp_entry, idf_comp_vers) + new_entry = {idf_comp_entry: {"version": idf_comp_vers}} + idf_component_json["dependencies"].update(new_entry) + + idf_component_yml_file = open(yml_file_dir,"w") + yaml.dump(idf_component_json, idf_component_yml_file) + idf_component_yml_file.close() + # print("JSON from modified idf_component.yml:") + # print(json.dumps(idf_component_json)) + return + return + +if flag_custom_component_add == True or flag_custom_component_remove == True: + HandleCOMPONENTsettings(env) + +if flag_custom_sdkonfig == True and "arduino" in env.subst("$PIOFRAMEWORK"): + HandleArduinoIDFsettings(env) + LIB_SOURCE = os.path.join(env.subst("$PROJECT_CORE_DIR"), "platforms", "espressif32", "builder", "build_lib") + if not bool(os.path.exists(os.path.join(PROJECT_DIR, ".dummy"))): + shutil.copytree(LIB_SOURCE, os.path.join(PROJECT_DIR, ".dummy")) + PROJECT_SRC_DIR = os.path.join(PROJECT_DIR, ".dummy") + env.Replace( + PROJECT_SRC_DIR=PROJECT_SRC_DIR, + BUILD_FLAGS="", + BUILD_UNFLAGS="", + LINKFLAGS="", + PIOFRAMEWORK="arduino", + ARDUINO_LIB_COMPILE_FLAG="Build", + ) + env["INTEGRATION_EXTRA_DATA"].update({"arduino_lib_compile_flag": env.subst("$ARDUINO_LIB_COMPILE_FLAG")}) def get_project_lib_includes(env): project = ProjectAsLibBuilder(env, "$PROJECT_DIR") @@ -1060,7 +1297,8 @@ def generate_empty_partition_image(binary_path, image_size): ), ) - env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", empty_partition) + if flag_custom_sdkonfig == False: + env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", empty_partition) def get_partition_info(pt_path, pt_offset, pt_params): @@ -1557,7 +1795,8 @@ def get_python_exe(): # Compile bootloader # -env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", build_bootloader(sdk_config)) +if flag_custom_sdkonfig == False: + env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", build_bootloader(sdk_config)) # # Target: ESP-IDF menuconfig @@ -1773,6 +2012,78 @@ def _skip_prj_source_files(node): env.SConscript("ulp.py", exports="env sdk_config project_config app_includes idf_variant") # +# Compile Arduino IDF sources +# + +if "arduino" in env.get("PIOFRAMEWORK") and "espidf" not in env.get("PIOFRAMEWORK"): + def idf_lib_copy(source, target, env): + env_build = join(env["PROJECT_BUILD_DIR"],env["PIOENV"]) + sdkconfig_h_path = join(env_build,"config","sdkconfig.h") + arduino_libs = join(ARDUINO_FRMWRK_LIB_DIR,"tools","esp32-arduino-libs") + lib_src = join(env_build,"esp-idf") + lib_dst = join(arduino_libs,mcu,"lib") + ld_dst = join(arduino_libs,mcu,"ld") + mem_var = join(arduino_libs,mcu,board.get("build.arduino.memory_type", (board.get("build.flash_mode", "dio") + "_qspi"))) + src = [join(lib_src,x) for x in os.listdir(lib_src)] + src = [folder for folder in src if not os.path.isfile(folder)] # folders only + for folder in src: + files = [join(folder,x) for x in os.listdir(folder)] + for file in files: + if file.strip().endswith(".a"): + shutil.copyfile(file,join(lib_dst,file.split(os.path.sep)[-1])) + + shutil.move(join(lib_dst,"libspi_flash.a"),join(mem_var,"libspi_flash.a")) + shutil.move(join(env_build,"memory.ld"),join(ld_dst,"memory.ld")) + if mcu == "esp32s3": + shutil.move(join(lib_dst,"libesp_psram.a"),join(mem_var,"libesp_psram.a")) + shutil.move(join(lib_dst,"libesp_system.a"),join(mem_var,"libesp_system.a")) + shutil.move(join(lib_dst,"libfreertos.a"),join(mem_var,"libfreertos.a")) + shutil.move(join(lib_dst,"libbootloader_support.a"),join(mem_var,"libbootloader_support.a")) + shutil.move(join(lib_dst,"libesp_hw_support.a"),join(mem_var,"libesp_hw_support.a")) + + shutil.copyfile(sdkconfig_h_path,join(mem_var,"include","sdkconfig.h")) + if not bool(os.path.isfile(join(arduino_libs,mcu,"sdkconfig.orig"))): + shutil.move(join(arduino_libs,mcu,"sdkconfig"),join(arduino_libs,mcu,"sdkconfig.orig")) + shutil.copyfile(join(env.subst("$PROJECT_DIR"),"sdkconfig."+env["PIOENV"]),join(arduino_libs,mcu,"sdkconfig")) + shutil.copyfile(join(env.subst("$PROJECT_DIR"),"sdkconfig."+env["PIOENV"]),join(arduino_libs,"sdkconfig")) + print("*** Copied compiled %s IDF libraries to Arduino framework ***" % idf_variant) + + pio_exe_path = shutil.which("platformio"+(".exe" if IS_WINDOWS else "")) + pio_cmd = env["PIOENV"] + env.Execute( + env.VerboseAction( + ( + '"%s" run -e ' % pio_exe_path + + " ".join(['"%s"' % pio_cmd]) + ), + "*** Starting Arduino compile %s with custom libraries ***" % pio_cmd, + ) + ) + if flag_custom_component_add == True or flag_custom_component_remove == True: + try: + shutil.copy(join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml.orig"),join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml")) + print("*** Original Arduino \"idf_component.yml\" restored ***") + except: + print("*** Original Arduino \"idf_component.yml\" couldnt be restored ***") + env.AddPostAction("checkprogsize", idf_lib_copy) + +if "espidf" in env.get("PIOFRAMEWORK") and (flag_custom_component_add == True or flag_custom_component_remove == True): + def idf_custom_component(source, target, env): + try: + shutil.copy(join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml.orig"),join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml")) + print("*** Original Arduino \"idf_component.yml\" restored ***") + except: + try: + shutil.copy(join(PROJECT_SRC_DIR,"idf_component.yml.orig"),join(PROJECT_SRC_DIR,"idf_component.yml")) + print("*** Original \"idf_component.yml\" restored ***") + except: # no "idf_component.yml" in source folder + try: + os.remove(join(PROJECT_SRC_DIR,"idf_component.yml")) + print("*** pioarduino generated \"idf_component.yml\" removed ***") + except: + print("*** \"idf_component.yml\" couldnt be removed ***") + env.AddPostAction("checkprogsize", idf_custom_component) +# # Process OTA partition and image # @@ -1785,7 +2096,10 @@ def _skip_prj_source_files(node): if ota_partition_params["size"] and ota_partition_params["offset"]: # Generate an empty image if OTA is enabled in partition table ota_partition_image = os.path.join("$BUILD_DIR", "ota_data_initial.bin") - generate_empty_partition_image(ota_partition_image, ota_partition_params["size"]) + if "arduino" in env.subst("$PIOFRAMEWORK"): + ota_partition_image = os.path.join(ARDUINO_FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin") + else: + generate_empty_partition_image(ota_partition_image, ota_partition_params["size"]) env.Append( FLASH_EXTRA_IMAGES=[ @@ -1797,18 +2111,61 @@ def _skip_prj_source_files(node): ) ] ) + EXTRA_IMG_DIR = join(env.subst("$PROJECT_DIR"), "variants", "tasmota") + env.Append( + FLASH_EXTRA_IMAGES=[ + (offset, join(EXTRA_IMG_DIR, img)) for offset, img in board.get("upload.arduino.flash_extra_images", []) + ] + ) + +def _parse_size(value): + if isinstance(value, int): + return value + elif value.isdigit(): + return int(value) + elif value.startswith("0x"): + return int(value, 16) + elif value[-1].upper() in ("K", "M"): + base = 1024 if value[-1].upper() == "K" else 1024 * 1024 + return int(value[:-1]) * base + return value # # Configure application partition offset # -env.Replace( - ESP32_APP_OFFSET=get_app_partition_offset( - env.subst("$PARTITIONS_TABLE_CSV"), partition_table_offset - ) -) +partitions_csv = env.subst("$PARTITIONS_TABLE_CSV") +result = [] +next_offset = 0 +bound = int(board.get("upload.offset_address", "0x10000"), 16) # default 0x10000 +with open(partitions_csv) as fp: + for line in fp.readlines(): + line = line.strip() + if not line or line.startswith("#"): + continue + tokens = [t.strip() for t in line.split(",")] + if len(tokens) < 5: + continue + partition = { + "name": tokens[0], + "type": tokens[1], + "subtype": tokens[2], + "offset": tokens[3] or next_offset, + "size": tokens[4], + "flags": tokens[5] if len(tokens) > 5 else None + } + result.append(partition) + next_offset = _parse_size(partition["offset"]) + if (partition["subtype"] == "ota_0"): + bound = next_offset + next_offset = (next_offset + bound - 1) & ~(bound - 1) + +env.Replace(ESP32_APP_OFFSET=str(hex(bound))) +# # Propagate application offset to debug configurations +# + env["INTEGRATION_EXTRA_DATA"].update( {"application_offset": env.subst("$ESP32_APP_OFFSET")} ) From 808f2f8a7e0d137e907bb660e4a946e481031341 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:31:53 +0100 Subject: [PATCH 07/99] fix lib path --- builder/frameworks/espidf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index cc8fb13f8..6339f0c9e 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -222,7 +222,7 @@ def get_MD5_hash(phrase): idf_config_flags = idf_config_flags + "# CONFIG_SPIRAM is not set\n" idf_config_flags = idf_config_flags.splitlines() - sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,"tools","esp32-arduino-libs",mcu,"sdkconfig") + sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,"esp32-arduino-libs",mcu,"sdkconfig") def get_flag(line): if line.startswith("#") and "is not set" in line: @@ -2019,7 +2019,7 @@ def _skip_prj_source_files(node): def idf_lib_copy(source, target, env): env_build = join(env["PROJECT_BUILD_DIR"],env["PIOENV"]) sdkconfig_h_path = join(env_build,"config","sdkconfig.h") - arduino_libs = join(ARDUINO_FRMWRK_LIB_DIR,"tools","esp32-arduino-libs") + arduino_libs = join(ARDUINO_FRMWRK_LIB_DIR,"esp32-arduino-libs") lib_src = join(env_build,"esp-idf") lib_dst = join(arduino_libs,mcu,"lib") ld_dst = join(arduino_libs,mcu,"ld") From f6830ecedb9770b78e77746539487375ca41994d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:35:40 +0100 Subject: [PATCH 08/99] Update esp32-solo1.json --- boards/esp32-solo1.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/boards/esp32-solo1.json b/boards/esp32-solo1.json index e87b7e13d..906772ba4 100644 --- a/boards/esp32-solo1.json +++ b/boards/esp32-solo1.json @@ -1,11 +1,8 @@ { "build": { - "arduino":{ - "ldscript": "esp32_out.ld" - }, "core": "esp32", "extra_flags": "-DARDUINO_ESP32_DEV -DARDUINO_USB_CDC_ON_BOOT=0 -DCORE32SOLO1", - "f_cpu": "80000000L", + "f_cpu": "160000000L", "f_flash": "40000000L", "flash_mode": "dio", "mcu": "esp32", @@ -32,6 +29,11 @@ "require_upload_port": true, "speed": 460800 }, + "espidf": { + "custom_sdkconfig": [ + "CONFIG_FREERTOS_UNICORE=y" + ] + }, "url": "https://en.wikipedia.org/wiki/ESP32", "vendor": "Espressif" } From 816f19c6eefbf8b1c93823ae13996a293e8adab7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:41:02 +0100 Subject: [PATCH 09/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 63 ++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 03eaf2cbd..404c73667 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -7,22 +7,75 @@ ; Please visit documentation for the other options and examples ; http://docs.platformio.org/page/projectconf.html -[env:esp-wrover-kit] +[env:esp32solo1] platform = espressif32 framework = arduino -board = esp-wrover-kit +board = esp32-solo1 +build_flags = -DLED_BUILTIN=2 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp32-camera + +[env:esp32-c2-devkitm-1] +platform = espressif32 +framework = arduino +board = esp32-c2-devkitm-1 +monitor_speed = 115200 +custom_sdkconfig = '# CONFIG_BT_ENABLED is not set' + '# CONFIG_LWIP_PPP_SUPPORT is not set' +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera + +[env:esp32-s3-120] +platform = espressif32 +framework = arduino +board = esp32s3_120_16_8-qio_opi monitor_speed = 115200 -build_flags = - -DLED_BUILTIN=2 - +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp32-camera + [env:esp32-c6-devkitc-1] platform = espressif32 framework = arduino board = esp32-c6-devkitc-1 monitor_speed = 115200 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera [env:esp32-h2-devkitm-1] platform = espressif32 framework = arduino board = esp32-h2-devkitm-1 monitor_speed = 115200 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera + +[env:esp32-p4] +platform = espressif32 +framework = arduino +board = esp32-p4 +build_flags = -DLED_BUILTIN=2 +monitor_speed = 115200 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera From bf4bd9725debbf1ad0728b65b870f7a07ba1a91f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:42:46 +0100 Subject: [PATCH 10/99] Create dummy --- builder/build_lib/dummy | 1 + 1 file changed, 1 insertion(+) create mode 100644 builder/build_lib/dummy diff --git a/builder/build_lib/dummy b/builder/build_lib/dummy new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/builder/build_lib/dummy @@ -0,0 +1 @@ + From 66913163556db4ae207193500206270e6878a480 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:43:43 +0100 Subject: [PATCH 11/99] Add files via upload --- builder/build_lib/CMakeLists.txt | 1 + builder/build_lib/arduino-lib-builder-as.S | 0 builder/build_lib/arduino-lib-builder-cpp.cpp | 0 builder/build_lib/arduino-lib-builder-gcc.c | 0 builder/build_lib/idf_component.yml | 12 ++++++++++++ builder/build_lib/sketch.cpp | 10 ++++++++++ 6 files changed, 23 insertions(+) create mode 100644 builder/build_lib/CMakeLists.txt create mode 100644 builder/build_lib/arduino-lib-builder-as.S create mode 100644 builder/build_lib/arduino-lib-builder-cpp.cpp create mode 100644 builder/build_lib/arduino-lib-builder-gcc.c create mode 100644 builder/build_lib/idf_component.yml create mode 100644 builder/build_lib/sketch.cpp diff --git a/builder/build_lib/CMakeLists.txt b/builder/build_lib/CMakeLists.txt new file mode 100644 index 000000000..1ab83d39a --- /dev/null +++ b/builder/build_lib/CMakeLists.txt @@ -0,0 +1 @@ +idf_component_register(SRCS "sketch.cpp" "arduino-lib-builder-gcc.c" "arduino-lib-builder-cpp.cpp" "arduino-lib-builder-as.S" INCLUDE_DIRS ".") diff --git a/builder/build_lib/arduino-lib-builder-as.S b/builder/build_lib/arduino-lib-builder-as.S new file mode 100644 index 000000000..e69de29bb diff --git a/builder/build_lib/arduino-lib-builder-cpp.cpp b/builder/build_lib/arduino-lib-builder-cpp.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/builder/build_lib/arduino-lib-builder-gcc.c b/builder/build_lib/arduino-lib-builder-gcc.c new file mode 100644 index 000000000..e69de29bb diff --git a/builder/build_lib/idf_component.yml b/builder/build_lib/idf_component.yml new file mode 100644 index 000000000..94024598e --- /dev/null +++ b/builder/build_lib/idf_component.yml @@ -0,0 +1,12 @@ +dependencies: + # Required IDF version + idf: ">=5.1" + espressif/cmake_utilities: + version: "0.*" + espressif/fb_gfx: + version: "master" + path: components/fb_gfx + git: https://github.com/espressif/esp32-arduino-lib-builder.git + require: public + rules: + - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" diff --git a/builder/build_lib/sketch.cpp b/builder/build_lib/sketch.cpp new file mode 100644 index 000000000..10a17a8f2 --- /dev/null +++ b/builder/build_lib/sketch.cpp @@ -0,0 +1,10 @@ +#include "Arduino.h" + +void setup() { + Serial.begin(115200); +} + +void loop() { + Serial.println("Hello World!"); + delay(1000); +} From 2f8068ac2fa5905f9a6692e0e3cae437981fa5fa Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:44:04 +0100 Subject: [PATCH 12/99] Delete builder/build_lib/dummy --- builder/build_lib/dummy | 1 - 1 file changed, 1 deletion(-) delete mode 100644 builder/build_lib/dummy diff --git a/builder/build_lib/dummy b/builder/build_lib/dummy deleted file mode 100644 index 8b1378917..000000000 --- a/builder/build_lib/dummy +++ /dev/null @@ -1 +0,0 @@ - From efb31e886a0d6ffae1c952858024719183bd13c0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:45:47 +0100 Subject: [PATCH 13/99] Rename examples.yml.off to examples.yml --- .github/workflows/{examples.yml.off => examples.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{examples.yml.off => examples.yml} (100%) diff --git a/.github/workflows/examples.yml.off b/.github/workflows/examples.yml similarity index 100% rename from .github/workflows/examples.yml.off rename to .github/workflows/examples.yml From 3dfcbeec98a5943668a53778aeebe6a8de401787 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:49:47 +0100 Subject: [PATCH 14/99] Update arduino.py --- builder/frameworks/arduino.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 5f496ade1..9c79c5ca3 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -188,4 +188,4 @@ def call_compile_libs(): call_compile_libs() if "arduino" in env.subst("$PIOFRAMEWORK") and "espidf" not in env.subst("$PIOFRAMEWORK") and env.subst("$ARDUINO_LIB_COMPILE_FLAG") in ("Inactive", "True"): - SConscript(join(platform.get_package_dir("framework-arduinoespressif32"), "tools", "platformio-build.py"))) + SConscript(join(platform.get_package_dir("framework-arduinoespressif32"), "tools", "platformio-build.py")) From 04d3e93f949f3ac3d8a613bfbae622c3365c578c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:52:12 +0100 Subject: [PATCH 15/99] Update espidf.py --- builder/frameworks/espidf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 6339f0c9e..c5e83f15b 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -155,7 +155,7 @@ def _get_installed_standard_pip_packages(): # Arduino framework as a component is not compatible with ESP-IDF >5.3 if "arduino" in env.subst("$PIOFRAMEWORK"): ARDUINO_FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") - ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs")) + ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") # Possible package names in 'package@version' format is not compatible with CMake if "@" in os.path.basename(ARDUINO_FRAMEWORK_DIR): new_path = os.path.join( From 27e6cf438ac3bf5f32434ad365b3fec18d35b695 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:01:45 +0100 Subject: [PATCH 16/99] Update espidf.py --- builder/frameworks/espidf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index c5e83f15b..a76559327 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -26,6 +26,7 @@ import sys import shutil import os +from os import listdir from os.path import join import re import platform as sys_platform @@ -156,6 +157,8 @@ def _get_installed_standard_pip_packages(): if "arduino" in env.subst("$PIOFRAMEWORK"): ARDUINO_FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") + print("****++ Arduino Libs dir:", ARDUINO_FRMWRK_LIB_DIR) + print("dir list:", os.listdir(ARDUINO_FRMWRK_LIB_DIR)) # Possible package names in 'package@version' format is not compatible with CMake if "@" in os.path.basename(ARDUINO_FRAMEWORK_DIR): new_path = os.path.join( From 757a9f81bc0a41b7029b98e80340c9aec781d992 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:26:00 +0100 Subject: [PATCH 17/99] Update espidf.py --- builder/frameworks/espidf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index a76559327..1f02f1e49 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -225,7 +225,7 @@ def get_MD5_hash(phrase): idf_config_flags = idf_config_flags + "# CONFIG_SPIRAM is not set\n" idf_config_flags = idf_config_flags.splitlines() - sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,"esp32-arduino-libs",mcu,"sdkconfig") + sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"sdkconfig") def get_flag(line): if line.startswith("#") and "is not set" in line: @@ -2022,7 +2022,7 @@ def _skip_prj_source_files(node): def idf_lib_copy(source, target, env): env_build = join(env["PROJECT_BUILD_DIR"],env["PIOENV"]) sdkconfig_h_path = join(env_build,"config","sdkconfig.h") - arduino_libs = join(ARDUINO_FRMWRK_LIB_DIR,"esp32-arduino-libs") + arduino_libs = ARDUINO_FRMWRK_LIB_DIR lib_src = join(env_build,"esp-idf") lib_dst = join(arduino_libs,mcu,"lib") ld_dst = join(arduino_libs,mcu,"ld") From c6a036979da6988dc7f1a89d9efb1cd4f985d5a7 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:38:11 +0100 Subject: [PATCH 18/99] symlink is not working --- .github/workflows/examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 9b7540098..cdfa5006a 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -49,7 +49,7 @@ jobs: python -m pip install --upgrade pip pip install wheel pip install -U https://github.com/platformio/platformio/archive/develop.zip - pio pkg install --global --platform symlink://. + pio pkg install --global --platform file://. if: "matrix.os == 'windows-2022'" env: PLATFORMIO_CORE_DIR: C:\plat @@ -67,7 +67,7 @@ jobs: python -m pip install --upgrade pip pip install wheel pip install -U https://github.com/platformio/platformio/archive/develop.zip - pio pkg install --global --platform symlink://. + pio pkg install --global --platform file://. if: "matrix.os != 'windows-2022'" - name: Build Ubuntu Mac examples run: pio run -d ${{ matrix.example }} From bca7f7685ff3224e5f327d77407b275e39d58d5c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:50:06 +0100 Subject: [PATCH 19/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 404c73667..075b59963 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -12,11 +12,17 @@ platform = espressif32 framework = arduino board = esp32-solo1 build_flags = -DLED_BUILTIN=2 -custom_component_remove = espressif/esp_hosted - espressif/esp_wifi_remote - espressif/mdns - espressif/esp-dsp - espressif/esp32-camera +custom_component_remove = + espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp32-camera + espressif/libsodium + espressif/qrcode + espressif/esp_insights + espressif/esp_rainmaker + espressif/rmaker_common [env:esp32-c2-devkitm-1] platform = espressif32 From 56e38c3160579e81e9b7f148e3aaac9d8be7d959 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:57:32 +0100 Subject: [PATCH 20/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 075b59963..3961c7856 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -15,12 +15,14 @@ build_flags = -DLED_BUILTIN=2 custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote - espressif/mdns espressif/esp-dsp espressif/esp32-camera espressif/libsodium + espressif/esp-modbus espressif/qrcode espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics espressif/esp_rainmaker espressif/rmaker_common From 4bd2401e5ca3e153a744261f7cbc589983a715c4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:12:37 +0100 Subject: [PATCH 21/99] fix path --- builder/frameworks/arduino.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 9c79c5ca3..088ba2c8d 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -57,7 +57,7 @@ SConscript("_embed_files.py", exports="env") -flag_any_custom_sdkconfig = os.path.exists(join(platform.get_package_dir("framework-arduinoespressif32-libs"),"tools","esp32-arduino-libs","sdkconfig")) +flag_any_custom_sdkconfig = os.path.exists(join(platform.get_package_dir("framework-arduinoespressif32-libs"),"sdkconfig")) # Esp32-solo1 libs needs adopted settings if flag_custom_sdkconfig == True and "CORE32SOLO1" in extra_flags and ("CONFIG_FREERTOS_UNICORE=y" in entry_custom_sdkconfig or "CONFIG_FREERTOS_UNICORE=y" in board_sdkconfig): From b3065cac72b60796ebb7f5f3d820ad3bf3957d36 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:57:44 +0100 Subject: [PATCH 22/99] Update espidf.py --- builder/frameworks/espidf.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 1f02f1e49..51bebe51c 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -29,6 +29,7 @@ from os import listdir from os.path import join import re +from urllib import request import platform as sys_platform import click @@ -226,6 +227,13 @@ def get_MD5_hash(phrase): idf_config_flags = idf_config_flags.splitlines() sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"sdkconfig") + if not bool(os.path.isfile(sdkconfig_src)): + print("***** lib directory does not exists, fetching sdkonfig from Arduino lib builder ****") + os.makedirs(join(ARDUINO_FRMWRK_LIB_DIR,mcu)) + sdkconfig_common_url= "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig.common" + response = request.urlretrieve(sdkconfig_common_url, "defconfig.common") + sdkconfig_common_url= "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig." + mcu + response = request.urlretrieve(sdkconfig_common_url, "defconfig." + mcu) def get_flag(line): if line.startswith("#") and "is not set" in line: From 4c18aad5a52377b8add8d168ca0da6e9af60aa60 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:10:37 +0100 Subject: [PATCH 23/99] Update espidf.py --- builder/frameworks/espidf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 51bebe51c..fefbf0e72 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -231,9 +231,14 @@ def get_MD5_hash(phrase): print("***** lib directory does not exists, fetching sdkonfig from Arduino lib builder ****") os.makedirs(join(ARDUINO_FRMWRK_LIB_DIR,mcu)) sdkconfig_common_url= "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig.common" - response = request.urlretrieve(sdkconfig_common_url, "defconfig.common") + response = request.urlretrieve(sdkconfig_common_url, sdkconfig_src) sdkconfig_common_url= "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig." + mcu - response = request.urlretrieve(sdkconfig_common_url, "defconfig." + mcu) + defconfig = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) + response = request.urlretrieve(sdkconfig_common_url, defconfig) + # opening file1 in reading mode and file2 in writing mode + with open(defconfig, 'r') as f1, open(sdkconfig_src, 'w') as f2: + f2.write(f1.read()) + def get_flag(line): if line.startswith("#") and "is not set" in line: From bcc51007c3ba884b8302649e848271518789ded3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:32:54 +0100 Subject: [PATCH 24/99] Update espidf.py --- builder/frameworks/espidf.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index fefbf0e72..21366b6c8 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -158,8 +158,6 @@ def _get_installed_standard_pip_packages(): if "arduino" in env.subst("$PIOFRAMEWORK"): ARDUINO_FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") - print("****++ Arduino Libs dir:", ARDUINO_FRMWRK_LIB_DIR) - print("dir list:", os.listdir(ARDUINO_FRMWRK_LIB_DIR)) # Possible package names in 'package@version' format is not compatible with CMake if "@" in os.path.basename(ARDUINO_FRAMEWORK_DIR): new_path = os.path.join( @@ -228,17 +226,15 @@ def get_MD5_hash(phrase): idf_config_flags = idf_config_flags.splitlines() sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"sdkconfig") if not bool(os.path.isfile(sdkconfig_src)): - print("***** lib directory does not exists, fetching sdkonfig from Arduino lib builder ****") + print("***** sdkconfig not existing, fetching from Arduino lib builder repo ****") os.makedirs(join(ARDUINO_FRMWRK_LIB_DIR,mcu)) - sdkconfig_common_url= "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig.common" + sdkconfig_common_url = "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig.common" response = request.urlretrieve(sdkconfig_common_url, sdkconfig_src) - sdkconfig_common_url= "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig." + mcu - defconfig = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) - response = request.urlretrieve(sdkconfig_common_url, defconfig) - # opening file1 in reading mode and file2 in writing mode - with open(defconfig, 'r') as f1, open(sdkconfig_src, 'w') as f2: - f2.write(f1.read()) - + sdkconfig_defconfig_url = "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig." + mcu + defconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) + response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) + with open(defconfig_mcu, 'r') as f1, open(sdkconfig_src, 'w') as f2: + f2.write(f1.read()) def get_flag(line): if line.startswith("#") and "is not set" in line: From c758cad9f5cbe6d53bcf70b93c5ab0b7dd7f1769 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:37:13 +0100 Subject: [PATCH 25/99] Update espidf.py --- builder/frameworks/espidf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 21366b6c8..78df16e76 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -235,6 +235,10 @@ def get_MD5_hash(phrase): response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_src, 'w') as f2: f2.write(f1.read()) + with open(sdkconfig_src, 'r') as file: + file_lines = file.readlines() + for line in file_lines: + print(line.strip()) def get_flag(line): if line.startswith("#") and "is not set" in line: From 720fbbb9dcb93d545f1719a1a3ce22bc57c9e0ce Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:41:50 +0100 Subject: [PATCH 26/99] Update espidf.py --- builder/frameworks/espidf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 78df16e76..e98feb64e 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -234,7 +234,7 @@ def get_MD5_hash(phrase): defconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_src, 'w') as f2: - f2.write(f1.read()) + f2.write(f1.read()) with open(sdkconfig_src, 'r') as file: file_lines = file.readlines() for line in file_lines: From 3116595fc740b7f249c4ec9461ae126c81696088 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:46:29 +0100 Subject: [PATCH 27/99] Update espidf.py --- builder/frameworks/espidf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index e98feb64e..683bd2dbf 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -234,11 +234,11 @@ def get_MD5_hash(phrase): defconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_src, 'w') as f2: - f2.write(f1.read()) + f2.write(f1.read()) with open(sdkconfig_src, 'r') as file: - file_lines = file.readlines() - for line in file_lines: - print(line.strip()) + file_lines = file.readlines() + for line in file_lines: + print(line.strip()) def get_flag(line): if line.startswith("#") and "is not set" in line: From a427675e90fba4fbe189f63471bde2adb9ca60e3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:57:59 +0100 Subject: [PATCH 28/99] Update espidf.py --- builder/frameworks/espidf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 683bd2dbf..26e851115 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -234,11 +234,11 @@ def get_MD5_hash(phrase): defconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_src, 'w') as f2: - f2.write(f1.read()) + f2.write(f1.read()) with open(sdkconfig_src, 'r') as file: - file_lines = file.readlines() - for line in file_lines: - print(line.strip()) + file_lines = file.readlines() + for line in file_lines: + print(line.strip()) def get_flag(line): if line.startswith("#") and "is not set" in line: From ed75ecc1c7eba92e606d071f7e68a8f9599e4cfc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:06:40 +0100 Subject: [PATCH 29/99] Update espidf.py --- builder/frameworks/espidf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 26e851115..c505d085b 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -234,7 +234,7 @@ def get_MD5_hash(phrase): defconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_src, 'w') as f2: - f2.write(f1.read()) + f2.write(f1.read()) with open(sdkconfig_src, 'r') as file: file_lines = file.readlines() for line in file_lines: From 6d2e6fb5722cf7c34747e132f69b33b3e0176945 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:12:30 +0100 Subject: [PATCH 30/99] Update espidf.py --- builder/frameworks/espidf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index c505d085b..9f0cc74c0 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -235,9 +235,9 @@ def get_MD5_hash(phrase): response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_src, 'w') as f2: f2.write(f1.read()) - with open(sdkconfig_src, 'r') as file: - file_lines = file.readlines() - for line in file_lines: + with open(sdkconfig_src, 'r') as file: + file_lines = file.readlines() + for line in file_lines: print(line.strip()) def get_flag(line): From 68b2cee51e2936efbd0ffce1e6134555054bc689 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:27:14 +0100 Subject: [PATCH 31/99] Update espidf.py --- builder/frameworks/espidf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 9f0cc74c0..235b5de30 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -229,11 +229,12 @@ def get_MD5_hash(phrase): print("***** sdkconfig not existing, fetching from Arduino lib builder repo ****") os.makedirs(join(ARDUINO_FRMWRK_LIB_DIR,mcu)) sdkconfig_common_url = "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig.common" - response = request.urlretrieve(sdkconfig_common_url, sdkconfig_src) + sdkconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"sdkconfig") + response = request.urlretrieve(sdkconfig_common_url, sdkconfig_mcu) sdkconfig_defconfig_url = "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig." + mcu defconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) - with open(defconfig_mcu, 'r') as f1, open(sdkconfig_src, 'w') as f2: + with open(defconfig_mcu, 'r') as f1, open(sdkconfig_mcu, 'w') as f2: f2.write(f1.read()) with open(sdkconfig_src, 'r') as file: file_lines = file.readlines() From dc37c4a5b7eed3f55a5320219411750319650b3c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:51:52 +0100 Subject: [PATCH 32/99] Update espidf.py --- builder/frameworks/espidf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 235b5de30..d9c5ddf18 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -234,7 +234,7 @@ def get_MD5_hash(phrase): sdkconfig_defconfig_url = "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig." + mcu defconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) - with open(defconfig_mcu, 'r') as f1, open(sdkconfig_mcu, 'w') as f2: + with open(defconfig_mcu, 'r') as f1, open(sdkconfig_mcu, 'a') as f2: f2.write(f1.read()) with open(sdkconfig_src, 'r') as file: file_lines = file.readlines() From 2c2d643d52f17dc65170e1abbe34c50cc1079702 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:58:36 +0100 Subject: [PATCH 33/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 3961c7856..9e1e4e8ef 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -35,7 +35,6 @@ custom_sdkconfig = '# CONFIG_BT_ENABLED is not set' '# CONFIG_LWIP_PPP_SUPPORT is not set' custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote - espressif/mdns espressif/esp-dsp espressif/esp_modem espressif/esp32-camera From 3db8ecf365c492eeda9bd5dda86a4723b61720b4 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 19:23:02 +0100 Subject: [PATCH 34/99] Update espidf.py --- builder/frameworks/espidf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index d9c5ddf18..550853b02 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -2046,6 +2046,7 @@ def idf_lib_copy(source, target, env): for folder in src: files = [join(folder,x) for x in os.listdir(folder)] for file in files: + print("new lib file to copy:", file) if file.strip().endswith(".a"): shutil.copyfile(file,join(lib_dst,file.split(os.path.sep)[-1])) From 224ea383854caa6d7eda9b3aadcd311a85f50c68 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:16:04 +0100 Subject: [PATCH 35/99] Update espidf.py --- builder/frameworks/espidf.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 550853b02..383e6ad23 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -236,10 +236,6 @@ def get_MD5_hash(phrase): response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_mcu, 'a') as f2: f2.write(f1.read()) - with open(sdkconfig_src, 'r') as file: - file_lines = file.readlines() - for line in file_lines: - print(line.strip()) def get_flag(line): if line.startswith("#") and "is not set" in line: @@ -2046,8 +2042,8 @@ def idf_lib_copy(source, target, env): for folder in src: files = [join(folder,x) for x in os.listdir(folder)] for file in files: - print("new lib file to copy:", file) if file.strip().endswith(".a"): + print("new lib file to copy:", file) shutil.copyfile(file,join(lib_dst,file.split(os.path.sep)[-1])) shutil.move(join(lib_dst,"libspi_flash.a"),join(mem_var,"libspi_flash.a")) From 8594dd478d6a84ee65df403e01427756007ca145 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:46:25 +0100 Subject: [PATCH 36/99] S3 on steriods --- examples/arduino-blink/platformio.ini | 59 ++++++++++++++++++--------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 9e1e4e8ef..3494d727f 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -26,29 +26,50 @@ custom_component_remove = espressif/esp_rainmaker espressif/rmaker_common -[env:esp32-c2-devkitm-1] -platform = espressif32 -framework = arduino -board = esp32-c2-devkitm-1 -monitor_speed = 115200 -custom_sdkconfig = '# CONFIG_BT_ENABLED is not set' - '# CONFIG_LWIP_PPP_SUPPORT is not set' -custom_component_remove = espressif/esp_hosted - espressif/esp_wifi_remote - espressif/esp-dsp - espressif/esp_modem - espressif/esp32-camera +; TODO C2 Hybrid Compile +;[env:esp32-c2-devkitm-1] +;platform = espressif32 +;framework = arduino +;board = esp32-c2-devkitm-1 +;monitor_speed = 115200 +;custom_sdkconfig = '# CONFIG_BT_ENABLED is not set' +; '# CONFIG_LWIP_PPP_SUPPORT is not set' +;custom_component_remove = espressif/esp_hosted +; espressif/esp_wifi_remote +; espressif/esp-dsp +; espressif/esp_modem +; espressif/esp32-camera -[env:esp32-s3-120] +[env:esp32s3-qio_opi_per] +; OPI Performance settings -> Display use platform = espressif32 framework = arduino board = esp32s3_120_16_8-qio_opi -monitor_speed = 115200 -custom_component_remove = espressif/esp_hosted - espressif/esp_wifi_remote - espressif/mdns - espressif/esp-dsp - espressif/esp32-camera +build_unflags = -Os + -ffunction-sections +build_flags = -Ofast + -mtext-section-literals +custom_sdkconfig = '# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set' + CONFIG_COMPILER_OPTIMIZATION_PERF=y + '# CONFIG_ESP_DEBUG_INCLUDE_OCD_STUB_BINS is not set' + '# CONFIG_LWIP_PPP_SUPPORT is not set' + '# SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE is not set' + CONFIG_SPIRAM_MODE_OCT=y + CONFIG_SPIRAM_SPEED_120M=y + CONFIG_SPIRAM_IGNORE_NOTFOUND=y + '# CONFIG_SPIRAM_MEMTEST is not set' + CONFIG_LCD_RGB_ISR_IRAM_SAFE=y + CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y + CONFIG_I2S_ISR_IRAM_SAFE=y + CONFIG_GDMA_ISR_IRAM_SAFE=y + CONFIG_SPIRAM_XIP_FROM_PSRAM=y + CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y + CONFIG_SPIRAM_RODATA=y + CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y + CONFIG_ESP32S3_DATA_CACHE_64KB=y + CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote [env:esp32-c6-devkitc-1] platform = espressif32 From 832a843be2a6043f86adbbab4fdd148f8f64e61f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:53:11 +0100 Subject: [PATCH 37/99] Create esp32s3_120_16_8-qio_opi.json --- boards/esp32s3_120_16_8-qio_opi.json | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 boards/esp32s3_120_16_8-qio_opi.json diff --git a/boards/esp32s3_120_16_8-qio_opi.json b/boards/esp32s3_120_16_8-qio_opi.json new file mode 100644 index 000000000..e4d20f47b --- /dev/null +++ b/boards/esp32s3_120_16_8-qio_opi.json @@ -0,0 +1,50 @@ +{ + "build": { + "arduino": { + "memory_type": "qio_opi", + "partitions": "default_16MB.csv" + }, + "core": "esp32", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "f_boot": "120000000L", + "boot": "qio", + "flash_mode": "qio", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_MODE=1", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "hwids": [ + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32s3", + "variant": "esp32s3" + }, + "connectivity": [ + "bluetooth", + "wifi" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "ESP32-S3 16MB QIO, 8MB OPI PSRAM", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf", + "vendor": "espressif" +} From 9b5148584b979940698eb7325abb51853ea72eff Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 21:02:16 +0100 Subject: [PATCH 38/99] Create esp32-p4.json --- boards/esp32-p4.json | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 boards/esp32-p4.json diff --git a/boards/esp32-p4.json b/boards/esp32-p4.json new file mode 100644 index 000000000..0a05148b0 --- /dev/null +++ b/boards/esp32-p4.json @@ -0,0 +1,34 @@ +{ + "build": { + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM" + ], + "f_cpu": "360000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32p4", + "variant": "esp32p4" + }, + "connectivity": [ + "bluetooth", + "openthread" + ], + "debug": { + "openocd_target": "esp32p4.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif ESP32-P4 generic", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com", + "vendor": "Espressif" +} From fa993b7584b843b04a43ea2ff2ee785bef88ca8c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 21:13:01 +0100 Subject: [PATCH 39/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 3494d727f..f5d0bd60b 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -70,6 +70,11 @@ custom_sdkconfig = '# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set' CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote +board_build.embed_txtfiles = + managed_components/espressif__esp_insights/server_certs/https_server.crt + managed_components/espressif__esp_rainmaker/server_certs/rmaker_mqtt_server.crt + managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt + managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt [env:esp32-c6-devkitc-1] platform = espressif32 From 83d1f6cb37d4f324220913c0dde294d4cd9683bd Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 21:42:42 +0100 Subject: [PATCH 40/99] remove rainmaker --- examples/arduino-blink/platformio.ini | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index f5d0bd60b..fe01c0bb6 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -70,11 +70,12 @@ custom_sdkconfig = '# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set' CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote -board_build.embed_txtfiles = - managed_components/espressif__esp_insights/server_certs/https_server.crt - managed_components/espressif__esp_rainmaker/server_certs/rmaker_mqtt_server.crt - managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt - managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt + espressif/qrcode + espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics + espressif/esp_rainmaker + espressif/rmaker_common [env:esp32-c6-devkitc-1] platform = espressif32 From 1d42983418ba29dfdab384c953e12d62849c3fe1 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:12:34 +0100 Subject: [PATCH 41/99] use interim Arduino branch `idf-release/v5.3` --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index bf2529880..9804737a3 100644 --- a/platform.json +++ b/platform.json @@ -33,7 +33,7 @@ "type": "framework", "optional": true, "owner": "espressif", - "version": "https://github.com/espressif/arduino-esp32/archive/refs/heads/release/v3.1.x.zip" + "version": "https://github.com/espressif/arduino-esp32/archive/refs/heads/idf-release/v5.3/.zip" }, "framework-arduinoespressif32-libs": { "type": "framework", From 39e233fa494729eadb02d0c63cfa849c2f02c259 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:20:51 +0100 Subject: [PATCH 42/99] Update Zigbee_On_Off_Light.ino --- examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino b/examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino index 2f13357a1..30e3cd2d1 100644 --- a/examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino +++ b/examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino @@ -30,8 +30,7 @@ #error "Zigbee end device mode is not selected in Tools->Zigbee mode" #endif -#include "ZigbeeCore.h" -#include "ep/ZigbeeLight.h" +#include "Zigbee.h" #define LED_PIN RGB_BUILTIN #define BUTTON_PIN 9 // ESP32-C6/H2 Boot button @@ -51,7 +50,7 @@ void setup() { digitalWrite(LED_PIN, LOW); // Init button for factory reset - pinMode(BUTTON_PIN, INPUT); + pinMode(BUTTON_PIN, INPUT_PULLUP); //Optional: set Zigbee device name and model zbLight.setManufacturerAndModel("Espressif", "ZBLightBulb"); From 9f8d2e4f1cb17d94b2cd26bb7db66987b2ab2980 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:21:54 +0100 Subject: [PATCH 43/99] Update Zigbee_On_Off_Switch.ino --- examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino b/examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino index 09487dea0..69cf6654a 100644 --- a/examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino +++ b/examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino @@ -31,8 +31,7 @@ #error "Zigbee coordinator mode is not selected in Tools->Zigbee mode" #endif -#include "ZigbeeCore.h" -#include "ep/ZigbeeSwitch.h" +#include "Zigbee.h" #define SWITCH_ENDPOINT_NUMBER 5 From 93960df30a9a2d20c9e9fc9a562a04bcf5fcb0ae Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:37:06 +0100 Subject: [PATCH 44/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index fe01c0bb6..ea516ee79 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -51,13 +51,8 @@ build_flags = -Ofast -mtext-section-literals custom_sdkconfig = '# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set' CONFIG_COMPILER_OPTIMIZATION_PERF=y - '# CONFIG_ESP_DEBUG_INCLUDE_OCD_STUB_BINS is not set' - '# CONFIG_LWIP_PPP_SUPPORT is not set' - '# SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE is not set' CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_SPEED_120M=y - CONFIG_SPIRAM_IGNORE_NOTFOUND=y - '# CONFIG_SPIRAM_MEMTEST is not set' CONFIG_LCD_RGB_ISR_IRAM_SAFE=y CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y CONFIG_I2S_ISR_IRAM_SAFE=y From cef857aa81d2f811321ce6e7ef15093d2204daa6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:46:33 +0100 Subject: [PATCH 45/99] Update espidf.py --- builder/frameworks/espidf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 383e6ad23..6c29aab44 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -2043,7 +2043,6 @@ def idf_lib_copy(source, target, env): files = [join(folder,x) for x in os.listdir(folder)] for file in files: if file.strip().endswith(".a"): - print("new lib file to copy:", file) shutil.copyfile(file,join(lib_dst,file.split(os.path.sep)[-1])) shutil.move(join(lib_dst,"libspi_flash.a"),join(mem_var,"libspi_flash.a")) From 681ac5caf1708386e90c5dc8f602ac9cfe78208c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:54:33 +0100 Subject: [PATCH 46/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index ea516ee79..c723936ba 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -45,13 +45,7 @@ custom_component_remove = platform = espressif32 framework = arduino board = esp32s3_120_16_8-qio_opi -build_unflags = -Os - -ffunction-sections -build_flags = -Ofast - -mtext-section-literals -custom_sdkconfig = '# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set' - CONFIG_COMPILER_OPTIMIZATION_PERF=y - CONFIG_SPIRAM_MODE_OCT=y +custom_sdkconfig = CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_SPEED_120M=y CONFIG_LCD_RGB_ISR_IRAM_SAFE=y CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y From 58577598633cdc543625aa133bf2e2cd441080cb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 23:14:29 +0100 Subject: [PATCH 47/99] Update platform.json --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index 9804737a3..bf2529880 100644 --- a/platform.json +++ b/platform.json @@ -33,7 +33,7 @@ "type": "framework", "optional": true, "owner": "espressif", - "version": "https://github.com/espressif/arduino-esp32/archive/refs/heads/idf-release/v5.3/.zip" + "version": "https://github.com/espressif/arduino-esp32/archive/refs/heads/release/v3.1.x.zip" }, "framework-arduinoespressif32-libs": { "type": "framework", From 6d52b2b4886ff75151944459522fbd0b6d4f416f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 10 Nov 2024 23:30:28 +0100 Subject: [PATCH 48/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index c723936ba..7f77816c1 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -65,6 +65,7 @@ custom_component_remove = espressif/esp_hosted espressif/esp_diagnostics espressif/esp_rainmaker espressif/rmaker_common +custom_component_add = lvgl/lvgl @ ^9.2.2 [env:esp32-c6-devkitc-1] platform = espressif32 From 763ab751df77f062514cbd7e569571384a244983 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:15:44 +0100 Subject: [PATCH 49/99] Update platform.json --- platform.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform.json b/platform.json index bf2529880..5cda7854b 100644 --- a/platform.json +++ b/platform.json @@ -41,6 +41,12 @@ "owner": "espressif", "version": "" }, + "framework-arduino-c2-skeleton-lib": { + "type": "framework", + "optional": true, + "owner": "espressif", + "version": "https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10-rc2/c2_arduino_compile_skeleton.zip" + }, "framework-espidf": { "type": "framework", "optional": true, From b939c527e358cb460ee053149a64e1ff8ad49e36 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:18:33 +0100 Subject: [PATCH 50/99] Update platform.py --- platform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform.py b/platform.py index 970dbe23b..b220baa87 100644 --- a/platform.py +++ b/platform.py @@ -55,6 +55,8 @@ def configure_default_packages(self, variables, targets): if variables.get("custom_sdkconfig") is not None or len(str(board_sdkconfig)) > 3: frameworks.append("espidf") self.packages["framework-espidf"]["optional"] = False + if mcu == "esp32c2": + self.packages["framework-arduino-c2-skeleton-lib"]["optional"] = False if "buildfs" in targets: filesystem = variables.get("board_build.filesystem", "littlefs") From 112d3c319d8b15e3e56945222a1004e63a18e045 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:29:01 +0100 Subject: [PATCH 51/99] Update espidf.py --- builder/frameworks/espidf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 6c29aab44..436834e3f 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -236,7 +236,10 @@ def get_MD5_hash(phrase): response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_mcu, 'a') as f2: f2.write(f1.read()) - + if mcu = "esp32c2": + ARDUINO_C2_LIB_DIR = platform.get_package_dir("framework-arduino-c2-skeleton-lib") + shutil.copytree(ARDUINO_C2_LIB_DIR, ARDUINO_FRMWRK_LIB_DIR, dirs_exist_ok=True) + def get_flag(line): if line.startswith("#") and "is not set" in line: return line.split(" ")[1] From 271c6d9bd259972e28c9ac9c2dfb1b1450cc493f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:32:35 +0100 Subject: [PATCH 52/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 7f77816c1..37e49f084 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -26,19 +26,17 @@ custom_component_remove = espressif/esp_rainmaker espressif/rmaker_common -; TODO C2 Hybrid Compile -;[env:esp32-c2-devkitm-1] -;platform = espressif32 -;framework = arduino -;board = esp32-c2-devkitm-1 -;monitor_speed = 115200 -;custom_sdkconfig = '# CONFIG_BT_ENABLED is not set' -; '# CONFIG_LWIP_PPP_SUPPORT is not set' -;custom_component_remove = espressif/esp_hosted -; espressif/esp_wifi_remote -; espressif/esp-dsp -; espressif/esp_modem -; espressif/esp32-camera +[env:esp32-c2-devkitm-1] +platform = espressif32 +framework = arduino +board = esp32-c2-devkitm-1 +monitor_speed = 115200 +custom_sdkconfig = 'CONFIG_IDF_TARGET="esp32c2"' +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera [env:esp32s3-qio_opi_per] ; OPI Performance settings -> Display use From b5c5c014fea9453ccbc477ac19bc9e1cd46aff30 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:33:41 +0100 Subject: [PATCH 53/99] Update espidf.py --- builder/frameworks/espidf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 436834e3f..bbc3e3e71 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -236,7 +236,7 @@ def get_MD5_hash(phrase): response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) with open(defconfig_mcu, 'r') as f1, open(sdkconfig_mcu, 'a') as f2: f2.write(f1.read()) - if mcu = "esp32c2": + if mcu == "esp32c2": ARDUINO_C2_LIB_DIR = platform.get_package_dir("framework-arduino-c2-skeleton-lib") shutil.copytree(ARDUINO_C2_LIB_DIR, ARDUINO_FRMWRK_LIB_DIR, dirs_exist_ok=True) From b82a5293c05c53116b68f21212f04aac9c616931 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:43:06 +0100 Subject: [PATCH 54/99] Update platformio.ini --- examples/arduino-blink/platformio.ini | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 37e49f084..bd12d5530 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -35,8 +35,15 @@ custom_sdkconfig = 'CONFIG_IDF_TARGET="esp32c2"' custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote espressif/esp-dsp - espressif/esp_modem espressif/esp32-camera + espressif/libsodium + espressif/esp-modbus + espressif/qrcode + espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics + espressif/esp_rainmaker + espressif/rmaker_common [env:esp32s3-qio_opi_per] ; OPI Performance settings -> Display use From 8af3d9020413b9c02c96ad3bfa8307eb360d10a2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:54:00 +0100 Subject: [PATCH 55/99] Update espidf.py --- builder/frameworks/espidf.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index bbc3e3e71..81ab5c6f7 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -225,21 +225,7 @@ def get_MD5_hash(phrase): idf_config_flags = idf_config_flags.splitlines() sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"sdkconfig") - if not bool(os.path.isfile(sdkconfig_src)): - print("***** sdkconfig not existing, fetching from Arduino lib builder repo ****") - os.makedirs(join(ARDUINO_FRMWRK_LIB_DIR,mcu)) - sdkconfig_common_url = "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig.common" - sdkconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"sdkconfig") - response = request.urlretrieve(sdkconfig_common_url, sdkconfig_mcu) - sdkconfig_defconfig_url = "https://github.com/pioarduino/esp32-arduino-lib-builder/raw/refs/heads/release/v5.3/configs/defconfig." + mcu - defconfig_mcu = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"defconfig." + mcu) - response = request.urlretrieve(sdkconfig_defconfig_url, defconfig_mcu) - with open(defconfig_mcu, 'r') as f1, open(sdkconfig_mcu, 'a') as f2: - f2.write(f1.read()) - if mcu == "esp32c2": - ARDUINO_C2_LIB_DIR = platform.get_package_dir("framework-arduino-c2-skeleton-lib") - shutil.copytree(ARDUINO_C2_LIB_DIR, ARDUINO_FRMWRK_LIB_DIR, dirs_exist_ok=True) - + def get_flag(line): if line.startswith("#") and "is not set" in line: return line.split(" ")[1] From 8fa8efe074a9f7917eb86784a86ce4ae4b99f713 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:58:33 +0100 Subject: [PATCH 56/99] copy c2 skeleton in Arduino libs dir --- builder/frameworks/arduino.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 088ba2c8d..6efc27f7d 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -70,6 +70,11 @@ BUILD_UNFLAGS=new_build_unflags ) +if mcu == "esp32c2": + ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") + ARDUINO_C2_LIB_DIR = platform.get_package_dir("framework-arduino-c2-skeleton-lib") + shutil.copytree(ARDUINO_C2_LIB_DIR, ARDUINO_FRMWRK_LIB_DIR, dirs_exist_ok=True) + def install_python_deps(): def _get_installed_pip_packages(): result = {} From 818b227f8bbcf7a6c613317069fc0eab6cf4445c Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:05:39 +0100 Subject: [PATCH 57/99] remove not needed import --- builder/frameworks/espidf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 81ab5c6f7..bb5414ad8 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -26,7 +26,6 @@ import sys import shutil import os -from os import listdir from os.path import join import re from urllib import request From 472d38760e60b8f7a6432cdcc0fa11e8cb119fa3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:08:39 +0100 Subject: [PATCH 58/99] Update arduino.py --- builder/frameworks/arduino.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 6efc27f7d..9987787ed 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -73,6 +73,8 @@ if mcu == "esp32c2": ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") ARDUINO_C2_LIB_DIR = platform.get_package_dir("framework-arduino-c2-skeleton-lib") + print("Arduino Lib Dir:", ARDUINO_FRMWRK_LIB_DIR) + print("Arduino C2 Lib Dir:", ARDUINO_C2_LIB_DIR) shutil.copytree(ARDUINO_C2_LIB_DIR, ARDUINO_FRMWRK_LIB_DIR, dirs_exist_ok=True) def install_python_deps(): From 8fbb13b13e654befd9aa47320874835db321e01e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:39:30 +0100 Subject: [PATCH 59/99] Update arduino.py --- builder/frameworks/arduino.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 9987787ed..1436b6126 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -72,10 +72,10 @@ if mcu == "esp32c2": ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") - ARDUINO_C2_LIB_DIR = platform.get_package_dir("framework-arduino-c2-skeleton-lib") + ARDUINO_C2_DIR = join(platform.get_package_dir("framework-arduino-c2-skeleton-lib"),mcu) print("Arduino Lib Dir:", ARDUINO_FRMWRK_LIB_DIR) - print("Arduino C2 Lib Dir:", ARDUINO_C2_LIB_DIR) - shutil.copytree(ARDUINO_C2_LIB_DIR, ARDUINO_FRMWRK_LIB_DIR, dirs_exist_ok=True) + print("Arduino C2 Lib Dir:", ARDUINO_C2_DIR) + shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_LIB_DIR, dirs_exist_ok=True) def install_python_deps(): def _get_installed_pip_packages(): From 7d1950096f2580f1b8a1c035cee12b8435e8e893 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:52:42 +0100 Subject: [PATCH 60/99] Update arduino.py --- builder/frameworks/arduino.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 1436b6126..f0683348a 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -71,11 +71,11 @@ ) if mcu == "esp32c2": - ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") + ARDUINO_FRMWRK_C2_LIB_DIR = join(platform.get_package_dir("framework-arduinoespressif32-libs"),mcu) ARDUINO_C2_DIR = join(platform.get_package_dir("framework-arduino-c2-skeleton-lib"),mcu) - print("Arduino Lib Dir:", ARDUINO_FRMWRK_LIB_DIR) - print("Arduino C2 Lib Dir:", ARDUINO_C2_DIR) - shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_LIB_DIR, dirs_exist_ok=True) + print("Arduino Framework C2 Lib Dir:", ARDUINO_FRMWRK_C2_LIB_DIR) + print("Arduino Skeleton C2 Lib Dir:", ARDUINO_C2_DIR) + shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_C2_LIB_DIR, dirs_exist_ok=True) def install_python_deps(): def _get_installed_pip_packages(): From 820070dd49e35851d06467609aecc96c96a8e8e6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 14:37:02 +0100 Subject: [PATCH 61/99] Update arduino.py --- builder/frameworks/arduino.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index f0683348a..9be2de48c 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -70,13 +70,6 @@ BUILD_UNFLAGS=new_build_unflags ) -if mcu == "esp32c2": - ARDUINO_FRMWRK_C2_LIB_DIR = join(platform.get_package_dir("framework-arduinoespressif32-libs"),mcu) - ARDUINO_C2_DIR = join(platform.get_package_dir("framework-arduino-c2-skeleton-lib"),mcu) - print("Arduino Framework C2 Lib Dir:", ARDUINO_FRMWRK_C2_LIB_DIR) - print("Arduino Skeleton C2 Lib Dir:", ARDUINO_C2_DIR) - shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_C2_LIB_DIR, dirs_exist_ok=True) - def install_python_deps(): def _get_installed_pip_packages(): result = {} @@ -179,6 +172,12 @@ def check_reinstall_frwrk(): return framework_reinstall def call_compile_libs(): + if mcu == "esp32c2": + ARDUINO_FRMWRK_C2_LIB_DIR = join(platform.get_package_dir("framework-arduinoespressif32-libs"),mcu) + ARDUINO_C2_DIR = join(platform.get_package_dir("framework-arduino-c2-skeleton-lib"),mcu) + print("Arduino Framework C2 Lib Dir:", ARDUINO_FRMWRK_C2_LIB_DIR) + print("Arduino Skeleton C2 Lib Dir:", ARDUINO_C2_DIR) + shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_C2_LIB_DIR, dirs_exist_ok=True) print("*** Compile Arduino IDF libs for %s ***" % env["PIOENV"]) SConscript("espidf.py") From fd36cb5c3e152d7de04b410ae9bf506c98f7432a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 14:58:53 +0100 Subject: [PATCH 62/99] remove debug print --- builder/frameworks/arduino.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 9be2de48c..8780fd8fb 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -175,8 +175,6 @@ def call_compile_libs(): if mcu == "esp32c2": ARDUINO_FRMWRK_C2_LIB_DIR = join(platform.get_package_dir("framework-arduinoespressif32-libs"),mcu) ARDUINO_C2_DIR = join(platform.get_package_dir("framework-arduino-c2-skeleton-lib"),mcu) - print("Arduino Framework C2 Lib Dir:", ARDUINO_FRMWRK_C2_LIB_DIR) - print("Arduino Skeleton C2 Lib Dir:", ARDUINO_C2_DIR) shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_C2_LIB_DIR, dirs_exist_ok=True) print("*** Compile Arduino IDF libs for %s ***" % env["PIOENV"]) SConscript("espidf.py") From e50993c4c003c2830c7b72ec1a56222f188b3b2a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 15:22:49 +0100 Subject: [PATCH 63/99] Update sdkconfig.defaults --- examples/espidf-arduino-blink/sdkconfig.defaults | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/espidf-arduino-blink/sdkconfig.defaults b/examples/espidf-arduino-blink/sdkconfig.defaults index 54ef4be5d..0ca1833bb 100644 --- a/examples/espidf-arduino-blink/sdkconfig.defaults +++ b/examples/espidf-arduino-blink/sdkconfig.defaults @@ -155,3 +155,11 @@ CONFIG_EN_SPEECH_COMMAND_ID28="" CONFIG_EN_SPEECH_COMMAND_ID29="" CONFIG_EN_SPEECH_COMMAND_ID30="" CONFIG_EN_SPEECH_COMMAND_ID31="" + +# +# Zigbee +# +CONFIG_ZB_ENABLED=y +CONFIG_ZB_ZED=y +CONFIG_ZB_RADIO_NATIVE=y +# end of Zigbee From 3bf62c02f01f9ffddc96ea3824ed2f53821923eb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 15:28:27 +0100 Subject: [PATCH 64/99] Update platformio.ini --- examples/espidf-arduino-blink/platformio.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/espidf-arduino-blink/platformio.ini b/examples/espidf-arduino-blink/platformio.ini index 0399901d7..815b07891 100644 --- a/examples/espidf-arduino-blink/platformio.ini +++ b/examples/espidf-arduino-blink/platformio.ini @@ -27,3 +27,5 @@ build_flags = [env:esp32-c6-devkitm-1] board = esp32-c6-devkitm-1 +custom_component_remove = espressif/esp-zigbee-lib +custom_component_add = espressif/esp-zigbee-lib @ ==1.6.0 From 6ada863d146c2c6a4dc1071d2b477303e38dd239 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 15:30:51 +0100 Subject: [PATCH 65/99] Update platformio.ini --- examples/espidf-arduino-blink/platformio.ini | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/espidf-arduino-blink/platformio.ini b/examples/espidf-arduino-blink/platformio.ini index 815b07891..152401b9e 100644 --- a/examples/espidf-arduino-blink/platformio.ini +++ b/examples/espidf-arduino-blink/platformio.ini @@ -27,5 +27,10 @@ build_flags = [env:esp32-c6-devkitm-1] board = esp32-c6-devkitm-1 -custom_component_remove = espressif/esp-zigbee-lib -custom_component_add = espressif/esp-zigbee-lib @ ==1.6.0 +custom_component_remove = + espressif/esp-zigbee-lib + espressif/esp-zboss-lib +custom_component_add = + espressif/esp-zigbee-lib @ ==1.6.0 + espressif/esp-zboss-lib @ ==1.6.0 + From a5488a35395b71453bc9e10844371cdcd5ce325b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:48:04 +0100 Subject: [PATCH 66/99] Disable C6 example --- examples/espidf-arduino-blink/platformio.ini | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/espidf-arduino-blink/platformio.ini b/examples/espidf-arduino-blink/platformio.ini index 152401b9e..822a2ad08 100644 --- a/examples/espidf-arduino-blink/platformio.ini +++ b/examples/espidf-arduino-blink/platformio.ini @@ -25,12 +25,13 @@ build_flags = -DCONFIG_BLINK_GPIO=2 -DARDUINO_PARTITION_esp_sr_16 -[env:esp32-c6-devkitm-1] -board = esp32-c6-devkitm-1 -custom_component_remove = - espressif/esp-zigbee-lib - espressif/esp-zboss-lib -custom_component_add = - espressif/esp-zigbee-lib @ ==1.6.0 - espressif/esp-zboss-lib @ ==1.6.0 +; Disable until upstream fix is "in" +;[env:esp32-c6-devkitm-1] +;board = esp32-c6-devkitm-1 +;custom_component_remove = +; espressif/esp-zigbee-lib +; espressif/esp-zboss-lib +;custom_component_add = +; espressif/esp-zigbee-lib @ ==1.6.0 +; espressif/esp-zboss-lib @ ==1.6.0 From 9f72c086e9bf0f8caf566a8526a16029ee1865ce Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:56:09 +0100 Subject: [PATCH 67/99] remove import --- builder/frameworks/espidf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index bb5414ad8..dba7c9df2 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -28,7 +28,6 @@ import os from os.path import join import re -from urllib import request import platform as sys_platform import click From 2725f9e233bb48332c4a0a4db9055f52342e327a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:57:15 +0100 Subject: [PATCH 68/99] remove zigbee from sdkconfig default --- examples/espidf-arduino-blink/sdkconfig.defaults | 8 -------- 1 file changed, 8 deletions(-) diff --git a/examples/espidf-arduino-blink/sdkconfig.defaults b/examples/espidf-arduino-blink/sdkconfig.defaults index 0ca1833bb..54ef4be5d 100644 --- a/examples/espidf-arduino-blink/sdkconfig.defaults +++ b/examples/espidf-arduino-blink/sdkconfig.defaults @@ -155,11 +155,3 @@ CONFIG_EN_SPEECH_COMMAND_ID28="" CONFIG_EN_SPEECH_COMMAND_ID29="" CONFIG_EN_SPEECH_COMMAND_ID30="" CONFIG_EN_SPEECH_COMMAND_ID31="" - -# -# Zigbee -# -CONFIG_ZB_ENABLED=y -CONFIG_ZB_ZED=y -CONFIG_ZB_RADIO_NATIVE=y -# end of Zigbee From dc4bd63839d96fdfabb93a47626e277b6770859f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:07:43 +0100 Subject: [PATCH 69/99] Update platformio.ini --- examples/espidf-arduino-blink/platformio.ini | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/examples/espidf-arduino-blink/platformio.ini b/examples/espidf-arduino-blink/platformio.ini index 822a2ad08..0399901d7 100644 --- a/examples/espidf-arduino-blink/platformio.ini +++ b/examples/espidf-arduino-blink/platformio.ini @@ -25,13 +25,5 @@ build_flags = -DCONFIG_BLINK_GPIO=2 -DARDUINO_PARTITION_esp_sr_16 -; Disable until upstream fix is "in" -;[env:esp32-c6-devkitm-1] -;board = esp32-c6-devkitm-1 -;custom_component_remove = -; espressif/esp-zigbee-lib -; espressif/esp-zboss-lib -;custom_component_add = -; espressif/esp-zigbee-lib @ ==1.6.0 -; espressif/esp-zboss-lib @ ==1.6.0 - +[env:esp32-c6-devkitm-1] +board = esp32-c6-devkitm-1 From 9c4ad03fe1ad3f64f55c8c7a27169abf73ad2062 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:39:25 +0100 Subject: [PATCH 70/99] add debug path var --- builder/frameworks/espidf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index dba7c9df2..2171dd72e 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -333,7 +333,10 @@ def HandleCOMPONENTsettings(env): if flag_custom_sdkonfig == True and "arduino" in env.subst("$PIOFRAMEWORK"): HandleArduinoIDFsettings(env) + print("***** $PROJECT_LIBDEPS_DIR:", env.subst("$PROJECT_LIBDEPS_DIR")) + print("***** $PROJECT_CORE_DIR:", env.subst("$PROJECT_CORE_DIR")) LIB_SOURCE = os.path.join(env.subst("$PROJECT_CORE_DIR"), "platforms", "espressif32", "builder", "build_lib") + print("***** Dummy Source path:", LIB_SOURCE) if not bool(os.path.exists(os.path.join(PROJECT_DIR, ".dummy"))): shutil.copytree(LIB_SOURCE, os.path.join(PROJECT_DIR, ".dummy")) PROJECT_SRC_DIR = os.path.join(PROJECT_DIR, ".dummy") From 6ba82769dd5c424734c613c8105dc3eb8e8c5d57 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:46:25 +0100 Subject: [PATCH 71/99] Update espidf.py --- builder/frameworks/espidf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 2171dd72e..a53c2d958 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -333,7 +333,7 @@ def HandleCOMPONENTsettings(env): if flag_custom_sdkonfig == True and "arduino" in env.subst("$PIOFRAMEWORK"): HandleArduinoIDFsettings(env) - print("***** $PROJECT_LIBDEPS_DIR:", env.subst("$PROJECT_LIBDEPS_DIR")) + print("***** $PROJECT_PLATFORMS_DIR:", env.subst("$PROJECT_PLATFORMS_DIR")) print("***** $PROJECT_CORE_DIR:", env.subst("$PROJECT_CORE_DIR")) LIB_SOURCE = os.path.join(env.subst("$PROJECT_CORE_DIR"), "platforms", "espressif32", "builder", "build_lib") print("***** Dummy Source path:", LIB_SOURCE) From b0d7d923cc6b3aae2c42098a34e0f0e1abe7e651 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:57:51 +0100 Subject: [PATCH 72/99] Update espidf.py --- builder/frameworks/espidf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index a53c2d958..c0752d18a 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -43,6 +43,7 @@ from platformio.compat import IS_WINDOWS from platformio.proc import exec_command from platformio.builder.tools.piolib import ProjectAsLibBuilder +from platformio.project.config import ProjectConfig from platformio.package.version import get_original_version, pepver_to_semver # Added to avoid conflicts between installed Python packages from @@ -333,7 +334,8 @@ def HandleCOMPONENTsettings(env): if flag_custom_sdkonfig == True and "arduino" in env.subst("$PIOFRAMEWORK"): HandleArduinoIDFsettings(env) - print("***** $PROJECT_PLATFORMS_DIR:", env.subst("$PROJECT_PLATFORMS_DIR")) + print("***** Project Config get Platforms dir:", os.path.join(ProjectConfig.get_instance().get("platformio", "platforms_dir"))) + print("***** $PLATFORMIO_PLATFORMS_DIR:", env.subst("$PLATFORMIO_PLATFORMS_DIR")) print("***** $PROJECT_CORE_DIR:", env.subst("$PROJECT_CORE_DIR")) LIB_SOURCE = os.path.join(env.subst("$PROJECT_CORE_DIR"), "platforms", "espressif32", "builder", "build_lib") print("***** Dummy Source path:", LIB_SOURCE) From 12cc8314355e5dacaf179612ec522e89e365ff78 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:21:19 +0100 Subject: [PATCH 73/99] Fix path platforms dir --- builder/frameworks/espidf.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index c0752d18a..36dfe3093 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -335,9 +335,7 @@ def HandleCOMPONENTsettings(env): if flag_custom_sdkonfig == True and "arduino" in env.subst("$PIOFRAMEWORK"): HandleArduinoIDFsettings(env) print("***** Project Config get Platforms dir:", os.path.join(ProjectConfig.get_instance().get("platformio", "platforms_dir"))) - print("***** $PLATFORMIO_PLATFORMS_DIR:", env.subst("$PLATFORMIO_PLATFORMS_DIR")) - print("***** $PROJECT_CORE_DIR:", env.subst("$PROJECT_CORE_DIR")) - LIB_SOURCE = os.path.join(env.subst("$PROJECT_CORE_DIR"), "platforms", "espressif32", "builder", "build_lib") + LIB_SOURCE = os.path.join(ProjectConfig.get_instance().get("platformio", "platforms_dir"), "espressif32", "builder", "build_lib") print("***** Dummy Source path:", LIB_SOURCE) if not bool(os.path.exists(os.path.join(PROJECT_DIR, ".dummy"))): shutil.copytree(LIB_SOURCE, os.path.join(PROJECT_DIR, ".dummy")) From b68e709b9ad9a009943bb51ad5ee08f163f8ce0a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:40:15 +0100 Subject: [PATCH 74/99] remove debug print --- builder/frameworks/espidf.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 36dfe3093..ca6bab2ae 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -334,9 +334,7 @@ def HandleCOMPONENTsettings(env): if flag_custom_sdkonfig == True and "arduino" in env.subst("$PIOFRAMEWORK"): HandleArduinoIDFsettings(env) - print("***** Project Config get Platforms dir:", os.path.join(ProjectConfig.get_instance().get("platformio", "platforms_dir"))) LIB_SOURCE = os.path.join(ProjectConfig.get_instance().get("platformio", "platforms_dir"), "espressif32", "builder", "build_lib") - print("***** Dummy Source path:", LIB_SOURCE) if not bool(os.path.exists(os.path.join(PROJECT_DIR, ".dummy"))): shutil.copytree(LIB_SOURCE, os.path.join(PROJECT_DIR, ".dummy")) PROJECT_SRC_DIR = os.path.join(PROJECT_DIR, ".dummy") From 9c41bd1e82299777a7a4a40ef59e4b698603315f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:32:49 +0100 Subject: [PATCH 75/99] add `http(s)` and `file` as source for custom sdkconfig --- builder/frameworks/espidf.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index ca6bab2ae..7207b1711 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -28,6 +28,7 @@ import os from os.path import join import re +import requests import platform as sys_platform import click @@ -194,12 +195,40 @@ def get_MD5_hash(phrase): import hashlib return hashlib.md5((phrase).encode('utf-8')).hexdigest()[:16] + def custom_sdkconfig_file(string): + if not config.has_option("env:"+env["PIOENV"], "custom_sdkconfig"): + return "" + sdkconfig_entrys = env.GetProjectOption("custom_sdkconfig").splitlines() + for file in sdkconfig_entrys: + if "http" in file and "://" in file: + response = requests.get(file.split(" ")[0]) + if response.ok: + target = str(response.content.decode('utf-8')) + else: + print("Failed to download:", file) + return "" + return target + if "file://" in file: + file_path = join(PROJECT_DIR,file.lstrip("file://").split(os.path.sep)[-1]) + if os.path.exists(file_path): + with open(file_path, 'r') as file: + target = file.read() + else: + print("File not found:", file_path) + return "" + return target + return "" + + custom_sdk_config_flags = "" board_idf_config_flags = "" + sdkconfig_file_flags = "" + custom_sdkconfig_file_str = "" if config.has_option("env:"+env["PIOENV"], "custom_sdkconfig"): flag_custom_sdkonfig = True custom_sdk_config_flags = (env.GetProjectOption("custom_sdkconfig").rstrip("\n")) + "\n" + custom_sdkconfig_file_str = custom_sdkconfig_file(sdkconfig_file_flags) if "espidf.custom_sdkconfig" in board: board_idf_config_flags = ('\n'.join([element for element in board.get("espidf.custom_sdkconfig", "")])).rstrip("\n") + "\n" @@ -208,6 +237,9 @@ def get_MD5_hash(phrase): if flag_custom_sdkonfig == True: # TDOO duplicated print("*** Add \"custom_sdkconfig\" settings to IDF sdkconfig.defaults ***") idf_config_flags = custom_sdk_config_flags + if custom_sdkconfig_file_str != "": + sdkconfig_file_flags = custom_sdkconfig_file_str + "\n" + idf_config_flags = idf_config_flags + sdkconfig_file_flags idf_config_flags = idf_config_flags + board_idf_config_flags if flash_frequency != "80m": idf_config_flags = idf_config_flags + "# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set\n" @@ -224,7 +256,7 @@ def get_MD5_hash(phrase): idf_config_flags = idf_config_flags.splitlines() sdkconfig_src = join(ARDUINO_FRMWRK_LIB_DIR,mcu,"sdkconfig") - + def get_flag(line): if line.startswith("#") and "is not set" in line: return line.split(" ")[1] From 120d7ed75f9435ff465a53e0577fdd37770858d2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:35:54 +0100 Subject: [PATCH 76/99] Hybrid compile: fix solo1 if check --- builder/frameworks/arduino.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 8780fd8fb..b885eb80e 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -60,7 +60,7 @@ flag_any_custom_sdkconfig = os.path.exists(join(platform.get_package_dir("framework-arduinoespressif32-libs"),"sdkconfig")) # Esp32-solo1 libs needs adopted settings -if flag_custom_sdkconfig == True and "CORE32SOLO1" in extra_flags and ("CONFIG_FREERTOS_UNICORE=y" in entry_custom_sdkconfig or "CONFIG_FREERTOS_UNICORE=y" in board_sdkconfig): +if flag_custom_sdkconfig == True and ("CORE32SOLO1" in extra_flags or "CONFIG_FREERTOS_UNICORE=y" in entry_custom_sdkconfig or "CONFIG_FREERTOS_UNICORE=y" in board_sdkconfig): if len(str(env.GetProjectOption("build_unflags"))) == 2: # No valid env, needs init env['BUILD_UNFLAGS'] = {} build_unflags = " ".join(env['BUILD_UNFLAGS']) From ff43b05e3959f8f4ad4327ae103400227657220e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:24:19 +0100 Subject: [PATCH 77/99] fix custom partiton table offset calculation --- builder/main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/builder/main.py b/builder/main.py index 01cf07216..4c770f0c9 100644 --- a/builder/main.py +++ b/builder/main.py @@ -131,7 +131,7 @@ def _parse_partitions(env): result = [] next_offset = 0 - bound = int(board.get("upload.offset_address", "0x10000"), 16) # default 0x10000 + app_offset = int(board.get("upload.offset_address", "0x10000"), 16) # default 0x10000 with open(partitions_csv) as fp: for line in fp.readlines(): line = line.strip() @@ -140,23 +140,25 @@ def _parse_partitions(env): tokens = [t.strip() for t in line.split(",")] if len(tokens) < 5: continue + bound = 0x10000 if tokens[1] in ("0", "app") else 4 + calculated_offset = (next_offset + bound - 1) & ~(bound - 1) partition = { "name": tokens[0], "type": tokens[1], "subtype": tokens[2], - "offset": tokens[3] or next_offset, + "offset": tokens[3] or calculated_offset, "size": tokens[4], "flags": tokens[5] if len(tokens) > 5 else None } result.append(partition) next_offset = _parse_size(partition["offset"]) if (partition["subtype"] == "ota_0"): - bound = next_offset - next_offset = (next_offset + bound - 1) & ~(bound - 1) + app_offset = next_offset + next_offset = next_offset + _parse_size(partition["size"]) # Configure application partition offset - env.Replace(ESP32_APP_OFFSET=str(hex(bound))) + env.Replace(ESP32_APP_OFFSET=str(hex(app_offset))) # Propagate application offset to debug configurations - env["INTEGRATION_EXTRA_DATA"].update({"application_offset": str(hex(bound))}) + env["INTEGRATION_EXTRA_DATA"].update({"application_offset": str(hex(app_offset))}) return result From cc0698efa2eda60df7af049ab1f275f0f7197e78 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:57:19 +0100 Subject: [PATCH 78/99] Create tasmota_platformio_override.ini --- examples/tasmota_platformio_override.ini | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 examples/tasmota_platformio_override.ini diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini new file mode 100644 index 000000000..30be1d921 --- /dev/null +++ b/examples/tasmota_platformio_override.ini @@ -0,0 +1,6 @@ +[platformio] +default_envs = + tasmota32 + +[env:tasmota32_base] +platform = file://. From 8a6c7778eb56c081a758cf39a62efdee9275de37 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 18:09:53 +0100 Subject: [PATCH 79/99] add Tasmota as example for Hybrid compile --- .github/workflows/examples.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index cdfa5006a..cb51828f0 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -1,4 +1,4 @@ -name: Examples +name: CI Examples on: workflow_dispatch: # Manually start a workflow @@ -20,6 +20,7 @@ jobs: - "examples/arduino-wifiscan" - "examples/arduino-zigbee-light" - "examples/arduino-zigbee-switch" + - "examples/tasmota" - "examples/espidf-arduino-h2zero-BLE_scan" - "examples/espidf-arduino-matter-light" - "examples/espidf-arduino-blink" @@ -57,7 +58,7 @@ jobs: PLATFORMIO_PLATFORMS_DIR: C:\plat\plat - name: Build Windows examples run: pio run -d ${{ matrix.example }} - if: "matrix.os == 'windows-2022'" + if: "matrix.example != 'examples/tasmota' && matrix.os == 'windows-2022'" env: PLATFORMIO_CORE_DIR: C:\plat PLATFORMIO_PACKAGES_DIR: C:\plat\pack @@ -68,7 +69,13 @@ jobs: pip install wheel pip install -U https://github.com/platformio/platformio/archive/develop.zip pio pkg install --global --platform file://. - if: "matrix.os != 'windows-2022'" + - name: git clone Tasmota and add to examples + if: "matrix.example == 'examples/tasmota' && matrix.os != 'windows-2022'" + run: | + git clone -b development --depth 1 https://github.com/arendst/Tasmota.git examples/tasmota + cp examples/tasmota_platformio_override.ini examples/tasmota/platformio_override.ini - name: Build Ubuntu Mac examples - run: pio run -d ${{ matrix.example }} - if: "matrix.os != 'windows-2022'" + if: "matrix.example != 'examples/tasmota' || matrix.os != 'windows-2022'" + run: | + pio run -d ${{ matrix.example }} + From 1460e337331e04dbc5a111f68e0ad936ba1e1853 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 18:34:57 +0100 Subject: [PATCH 80/99] add tasmota32 hybrid compile example --- examples/tasmota_platformio_override.ini | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini index 30be1d921..7de59206b 100644 --- a/examples/tasmota_platformio_override.ini +++ b/examples/tasmota_platformio_override.ini @@ -1,6 +1,19 @@ [platformio] -default_envs = - tasmota32 +default_envs = tasmota32-hybrid [env:tasmota32_base] platform = file://. + +[env:tasmota32-hybrid] +extends = env:tasmota32_base +board = esp32 +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_TASMOTA32 +lib_ignore = ${env:tasmota32_base.lib_ignore} + Micro-RTSP + epdiy +custom_sdkconfig = https://raw.githubusercontent.com/pioarduino/sdkconfig/refs/heads/main/sdkconfig_tasmota_esp32 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/esp-dsp + espressif/esp32-camera From cab77d51cdf07e8cf95e750cd1818f9bf1c5f4fc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:47:04 +0100 Subject: [PATCH 81/99] Update tasmota_platformio_override.ini --- examples/tasmota_platformio_override.ini | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini index 7de59206b..e93428059 100644 --- a/examples/tasmota_platformio_override.ini +++ b/examples/tasmota_platformio_override.ini @@ -16,4 +16,15 @@ custom_sdkconfig = https://raw.githubusercontent.com/pioarduino/sdkconfig custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote espressif/esp-dsp + espressif/network_provisioning + espressif/esp-zboss-lib + espressif/esp-zigbee-lib + espressif/esp_rainmaker + espressif/rmaker_common + espressif/esp_insights + espressif/qrcode + espressif/esp-sr + espressif/libsodium + espressif/esp-modbus + chmorgan/esp-libhelix-mp3 espressif/esp32-camera From e82ac538ee8cb8ffed684d0a405fc476cd03f1c2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:56:18 +0100 Subject: [PATCH 82/99] Update tasmota_platformio_override.ini --- examples/tasmota_platformio_override.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini index e93428059..f695562dc 100644 --- a/examples/tasmota_platformio_override.ini +++ b/examples/tasmota_platformio_override.ini @@ -22,6 +22,9 @@ custom_component_remove = espressif/esp_hosted espressif/esp_rainmaker espressif/rmaker_common espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics + espressif/cbor espressif/qrcode espressif/esp-sr espressif/libsodium From 5fb8ffd2990b4f7a1fe7ec91220917309331b666 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 20:11:25 +0100 Subject: [PATCH 83/99] Update tasmota_platformio_override.ini --- examples/tasmota_platformio_override.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini index f695562dc..050712a22 100644 --- a/examples/tasmota_platformio_override.ini +++ b/examples/tasmota_platformio_override.ini @@ -9,6 +9,8 @@ extends = env:tasmota32_base board = esp32 build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_TASMOTA32 + -DESP32_STAGE + -DHTTPCLIENT_NOSECURE lib_ignore = ${env:tasmota32_base.lib_ignore} Micro-RTSP epdiy From 62b6f902b9d14c0f5205a7fdb51470b0e2464971 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 20:41:16 +0100 Subject: [PATCH 84/99] change override order for custom sdkconfig settings low to High - file - board manifest - pio entry --- builder/frameworks/espidf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 7207b1711..d9b2c339a 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -239,8 +239,8 @@ def custom_sdkconfig_file(string): idf_config_flags = custom_sdk_config_flags if custom_sdkconfig_file_str != "": sdkconfig_file_flags = custom_sdkconfig_file_str + "\n" - idf_config_flags = idf_config_flags + sdkconfig_file_flags - idf_config_flags = idf_config_flags + board_idf_config_flags + idf_config_flags = sdkconfig_file_flags + idf_config_flags + idf_config_flags = board_idf_config_flags + idf_config_flags if flash_frequency != "80m": idf_config_flags = idf_config_flags + "# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set\n" esptool_flashfreq_y = "CONFIG_ESPTOOLPY_FLASHFREQ_%s=y\n" % flash_frequency.upper() From 502bb4fb6bae6e7afe8ff33030fd49fa39b1ff11 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:01:45 +0100 Subject: [PATCH 85/99] switch off Ethernet in IDF --- examples/tasmota_platformio_override.ini | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini index 050712a22..8f92c8bb5 100644 --- a/examples/tasmota_platformio_override.ini +++ b/examples/tasmota_platformio_override.ini @@ -15,6 +15,15 @@ lib_ignore = ${env:tasmota32_base.lib_ignore} Micro-RTSP epdiy custom_sdkconfig = https://raw.githubusercontent.com/pioarduino/sdkconfig/refs/heads/main/sdkconfig_tasmota_esp32 + '# CONFIG_ETH_ENABLED is not set' + '# CONFIG_ETH_USE_ESP32_EMAC is not set' + '# CONFIG_ETH_PHY_INTERFACE_RMII is not set' + '# CONFIG_ETH_RMII_CLK_INPUT is not set' + '# CONFIG_ETH_RMII_CLK_IN_GPIO is not set' + '# CONFIG_ETH_USE_SPI_ETHERNET is not set' + '# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set' + '# CONFIG_ETH_SPI_ETHERNET_W5500 is not set' + '# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set' custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote espressif/esp-dsp From ed237b21396695bf4b886afc2152ea1475518704 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:10:10 +0100 Subject: [PATCH 86/99] Update examples.yml --- .github/workflows/examples.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index cb51828f0..0689e69e3 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -46,24 +46,25 @@ jobs: with: python-version: "3.11" - name: Install Windows dependencies + if: "matrix.os == 'windows-2022'" run: | python -m pip install --upgrade pip pip install wheel pip install -U https://github.com/platformio/platformio/archive/develop.zip pio pkg install --global --platform file://. - if: "matrix.os == 'windows-2022'" env: PLATFORMIO_CORE_DIR: C:\plat PLATFORMIO_PACKAGES_DIR: C:\plat\pack PLATFORMIO_PLATFORMS_DIR: C:\plat\plat - name: Build Windows examples - run: pio run -d ${{ matrix.example }} if: "matrix.example != 'examples/tasmota' && matrix.os == 'windows-2022'" + run: pio run -d ${{ matrix.example }} env: PLATFORMIO_CORE_DIR: C:\plat PLATFORMIO_PACKAGES_DIR: C:\plat\pack PLATFORMIO_PLATFORMS_DIR: C:\plat\plat - name: Install Ubuntu Mac dependencies + if: "matrix.os != 'windows-2022'" run: | python -m pip install --upgrade pip pip install wheel @@ -75,7 +76,7 @@ jobs: git clone -b development --depth 1 https://github.com/arendst/Tasmota.git examples/tasmota cp examples/tasmota_platformio_override.ini examples/tasmota/platformio_override.ini - name: Build Ubuntu Mac examples - if: "matrix.example != 'examples/tasmota' || matrix.os != 'windows-2022'" + if: "matrix.os != 'windows-2022'" run: | pio run -d ${{ matrix.example }} From 6b67dee5674701ab276b1d72f74fb1320fd1bc95 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:21:18 +0100 Subject: [PATCH 87/99] switch off Tasmota example Tasmota needs a change to compile with pioarduino --- .github/workflows/examples.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 0689e69e3..cdfa5006a 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -1,4 +1,4 @@ -name: CI Examples +name: Examples on: workflow_dispatch: # Manually start a workflow @@ -20,7 +20,6 @@ jobs: - "examples/arduino-wifiscan" - "examples/arduino-zigbee-light" - "examples/arduino-zigbee-switch" - - "examples/tasmota" - "examples/espidf-arduino-h2zero-BLE_scan" - "examples/espidf-arduino-matter-light" - "examples/espidf-arduino-blink" @@ -46,37 +45,30 @@ jobs: with: python-version: "3.11" - name: Install Windows dependencies - if: "matrix.os == 'windows-2022'" run: | python -m pip install --upgrade pip pip install wheel pip install -U https://github.com/platformio/platformio/archive/develop.zip pio pkg install --global --platform file://. + if: "matrix.os == 'windows-2022'" env: PLATFORMIO_CORE_DIR: C:\plat PLATFORMIO_PACKAGES_DIR: C:\plat\pack PLATFORMIO_PLATFORMS_DIR: C:\plat\plat - name: Build Windows examples - if: "matrix.example != 'examples/tasmota' && matrix.os == 'windows-2022'" run: pio run -d ${{ matrix.example }} + if: "matrix.os == 'windows-2022'" env: PLATFORMIO_CORE_DIR: C:\plat PLATFORMIO_PACKAGES_DIR: C:\plat\pack PLATFORMIO_PLATFORMS_DIR: C:\plat\plat - name: Install Ubuntu Mac dependencies - if: "matrix.os != 'windows-2022'" run: | python -m pip install --upgrade pip pip install wheel pip install -U https://github.com/platformio/platformio/archive/develop.zip pio pkg install --global --platform file://. - - name: git clone Tasmota and add to examples - if: "matrix.example == 'examples/tasmota' && matrix.os != 'windows-2022'" - run: | - git clone -b development --depth 1 https://github.com/arendst/Tasmota.git examples/tasmota - cp examples/tasmota_platformio_override.ini examples/tasmota/platformio_override.ini + if: "matrix.os != 'windows-2022'" - name: Build Ubuntu Mac examples + run: pio run -d ${{ matrix.example }} if: "matrix.os != 'windows-2022'" - run: | - pio run -d ${{ matrix.example }} - From 821c188b8a580178673e6d98058719da69973c33 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:08:36 +0100 Subject: [PATCH 88/99] Update tasmota_platformio_override.ini --- examples/tasmota_platformio_override.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini index 8f92c8bb5..d11b1a28f 100644 --- a/examples/tasmota_platformio_override.ini +++ b/examples/tasmota_platformio_override.ini @@ -15,15 +15,10 @@ lib_ignore = ${env:tasmota32_base.lib_ignore} Micro-RTSP epdiy custom_sdkconfig = https://raw.githubusercontent.com/pioarduino/sdkconfig/refs/heads/main/sdkconfig_tasmota_esp32 - '# CONFIG_ETH_ENABLED is not set' '# CONFIG_ETH_USE_ESP32_EMAC is not set' '# CONFIG_ETH_PHY_INTERFACE_RMII is not set' '# CONFIG_ETH_RMII_CLK_INPUT is not set' '# CONFIG_ETH_RMII_CLK_IN_GPIO is not set' - '# CONFIG_ETH_USE_SPI_ETHERNET is not set' - '# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set' - '# CONFIG_ETH_SPI_ETHERNET_W5500 is not set' - '# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set' custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote espressif/esp-dsp From 0305320613eeed9a9fd6d23bbd3000f82f78bc93 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:25:28 +0100 Subject: [PATCH 89/99] add example tasmota again --- .github/workflows/examples.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index cdfa5006a..901393b26 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -20,6 +20,7 @@ jobs: - "examples/arduino-wifiscan" - "examples/arduino-zigbee-light" - "examples/arduino-zigbee-switch" + - "examples/tasmota" - "examples/espidf-arduino-h2zero-BLE_scan" - "examples/espidf-arduino-matter-light" - "examples/espidf-arduino-blink" @@ -57,7 +58,7 @@ jobs: PLATFORMIO_PLATFORMS_DIR: C:\plat\plat - name: Build Windows examples run: pio run -d ${{ matrix.example }} - if: "matrix.os == 'windows-2022'" + if: "matrix.example != 'examples/tasmota' && matrix.os == 'windows-2022'" env: PLATFORMIO_CORE_DIR: C:\plat PLATFORMIO_PACKAGES_DIR: C:\plat\pack @@ -69,6 +70,11 @@ jobs: pip install -U https://github.com/platformio/platformio/archive/develop.zip pio pkg install --global --platform file://. if: "matrix.os != 'windows-2022'" + - name: git clone Tasmota and add to examples + run: | + git clone -b development --depth 1 https://github.com/arendst/Tasmota.git examples/tasmota + cp examples/tasmota_platformio_override.ini examples/tasmota/platformio_override.ini + if: "matrix.example == 'examples/tasmota' && matrix.os != 'windows-2022'" - name: Build Ubuntu Mac examples run: pio run -d ${{ matrix.example }} if: "matrix.os != 'windows-2022'" From 1b6bb5a3b2875ed2438c145e2b411fe885801581 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:40:33 +0100 Subject: [PATCH 90/99] base Tasmota32 variant --- examples/tasmota_platformio_override.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini index d11b1a28f..a696f2dc6 100644 --- a/examples/tasmota_platformio_override.ini +++ b/examples/tasmota_platformio_override.ini @@ -8,7 +8,6 @@ platform = file://. extends = env:tasmota32_base board = esp32 build_flags = ${env:tasmota32_base.build_flags} - -DFIRMWARE_TASMOTA32 -DESP32_STAGE -DHTTPCLIENT_NOSECURE lib_ignore = ${env:tasmota32_base.lib_ignore} From 923f3481fa9deea34fb874da2bda152f4510c2af Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:51:05 +0100 Subject: [PATCH 91/99] Update examples.yml --- .github/workflows/examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 901393b26..9abf35350 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -20,7 +20,7 @@ jobs: - "examples/arduino-wifiscan" - "examples/arduino-zigbee-light" - "examples/arduino-zigbee-switch" - - "examples/tasmota" + #- "examples/tasmota" - "examples/espidf-arduino-h2zero-BLE_scan" - "examples/espidf-arduino-matter-light" - "examples/espidf-arduino-blink" From a28a7de9e71c8d0b4acb1ff9299daf7171986858 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 17 Nov 2024 13:23:54 +0100 Subject: [PATCH 92/99] Update examples.yml --- .github/workflows/examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 9abf35350..901393b26 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -20,7 +20,7 @@ jobs: - "examples/arduino-wifiscan" - "examples/arduino-zigbee-light" - "examples/arduino-zigbee-switch" - #- "examples/tasmota" + - "examples/tasmota" - "examples/espidf-arduino-h2zero-BLE_scan" - "examples/espidf-arduino-matter-light" - "examples/espidf-arduino-blink" From 720c3f433f5a754588b63c990ee844b485d4d95d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 17 Nov 2024 13:24:27 +0100 Subject: [PATCH 93/99] Update tasmota_platformio_override.ini --- examples/tasmota_platformio_override.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/tasmota_platformio_override.ini b/examples/tasmota_platformio_override.ini index a696f2dc6..18626bbe9 100644 --- a/examples/tasmota_platformio_override.ini +++ b/examples/tasmota_platformio_override.ini @@ -8,7 +8,6 @@ platform = file://. extends = env:tasmota32_base board = esp32 build_flags = ${env:tasmota32_base.build_flags} - -DESP32_STAGE -DHTTPCLIENT_NOSECURE lib_ignore = ${env:tasmota32_base.lib_ignore} Micro-RTSP From a1e5f2bf4f60fcd45fba8e55ee4274d281b43204 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:01:10 +0100 Subject: [PATCH 94/99] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e03df5510..c43ebe120 100644 --- a/README.md +++ b/README.md @@ -35,13 +35,12 @@ ESP32 is a series of low-cost, low-power system on a chip microcontrollers with 1. Configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file: ### Stable version -espressif Arduino 3.0.4 and IDF 5.1.4+ See `platform` [documentation](https://docs.platformio.org/en/latest/projectconf/sections/env/options/platform/platform.html#projectconf-env-platform) for details. ```ini [env:stable] -platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip +platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip board = ... ... ``` @@ -51,7 +50,7 @@ based on devel branch Arduino 3.1.0 and IDF 5.3.1+ ```ini [env:development] -platform = https://github.com/pioarduino/platform-espressif32.git#Arduino/IDF53 +platform = https://github.com/pioarduino/platform-espressif32.git#Arduino/IDF53_work_hybrid board = ... ... ``` From f2a618c8ce3906232d849ceeeb76d8a58a841153 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:34:47 +0100 Subject: [PATCH 95/99] prep for new script "pioarduino-build.py" --- builder/frameworks/arduino.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index b885eb80e..b58527f70 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -192,4 +192,9 @@ def call_compile_libs(): call_compile_libs() if "arduino" in env.subst("$PIOFRAMEWORK") and "espidf" not in env.subst("$PIOFRAMEWORK") and env.subst("$ARDUINO_LIB_COMPILE_FLAG") in ("Inactive", "True"): - SConscript(join(platform.get_package_dir("framework-arduinoespressif32"), "tools", "platformio-build.py")) + if os.path.exists(join(platform.get_package_dir( + "framework-arduinoespressif32"), "tools", "platformio-build.py")): + PIO_BUILD = "platformio-build.py" + else: + PIO_BUILD = "pioarduino-build.py" + SConscript(join(platform.get_package_dir("framework-arduinoespressif32"), "tools", PIO_BUILD)) From a45b0a4819ba1970bf6c6562e5b60a41e0fd9d9a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:04:16 +0100 Subject: [PATCH 96/99] IDF 5.3.2 release / esptool v4.8.5 --- platform.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.json b/platform.json index 5cda7854b..74192fe13 100644 --- a/platform.json +++ b/platform.json @@ -51,7 +51,7 @@ "type": "framework", "optional": true, "owner": "pioarduino", - "version": "https://github.com/pioarduino/esp-idf/releases/download/v5.3.1.241024/esp-idf-v5.3.1.zip" + "version": "https://github.com/pioarduino/esp-idf/releases/download/v5.3.2/esp-idf-v5.3.2.zip" }, "toolchain-xtensa-esp-elf": { "type": "toolchain", @@ -86,7 +86,7 @@ "tool-esptoolpy": { "type": "uploader", "owner": "pioarduino", - "version": "https://github.com/pioarduino/esptool/releases/download/v4.8.1.1/esptool.zip" + "version": "https://github.com/pioarduino/esptool/releases/download/v4.8.5/esptool.zip" }, "tool-dfuutil-arduino": { "type": "uploader", From cc3800d75bf389046ea562c25efc60aed5b6ff60 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:47:47 +0100 Subject: [PATCH 97/99] Update Zigbee_On_Off_Switch.ino --- .../src/Zigbee_On_Off_Switch.ino | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino b/examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino index 69cf6654a..56d23cdc9 100644 --- a/examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino +++ b/examples/arduino-zigbee-switch/src/Zigbee_On_Off_Switch.ino @@ -33,10 +33,10 @@ #include "Zigbee.h" +/* Zigbee switch configuration */ #define SWITCH_ENDPOINT_NUMBER 5 -/* Switch configuration */ -#define GPIO_INPUT_IO_TOGGLE_SWITCH 9 +#define GPIO_INPUT_IO_TOGGLE_SWITCH BOOT_PIN #define PAIR_SIZE(TYPE_STR_PAIR) (sizeof(TYPE_STR_PAIR) / sizeof(TYPE_STR_PAIR[0])) typedef enum { @@ -70,6 +70,7 @@ ZigbeeSwitch zbSwitch = ZigbeeSwitch(SWITCH_ENDPOINT_NUMBER); static void onZbButton(SwitchData *button_func_pair) { if (button_func_pair->func == SWITCH_ONOFF_TOGGLE_CONTROL) { // Send toggle command to the light + Serial.println("Toggling light"); zbSwitch.lightToggle(); } } @@ -93,11 +94,7 @@ static void enableGpioInterrupt(bool enabled) { /********************* Arduino functions **************************/ void setup() { - Serial.begin(115200); - while (!Serial) { - delay(10); - } //Optional: set Zigbee device name and model zbSwitch.setManufacturerAndModel("Espressif", "ZigbeeSwitch"); @@ -106,7 +103,7 @@ void setup() { zbSwitch.allowMultipleBinding(true); //Add endpoint to Zigbee Core - log_d("Adding ZigbeeSwitch endpoint to Zigbee Core"); + Serial.println("Adding ZigbeeSwitch endpoint to Zigbee Core"); Zigbee.addEndpoint(&zbSwitch); //Open network for 180 seconds after boot @@ -118,34 +115,36 @@ void setup() { /* create a queue to handle gpio event from isr */ gpio_evt_queue = xQueueCreate(10, sizeof(SwitchData)); if (gpio_evt_queue == 0) { - log_e("Queue was not created and must not be used"); - while (1); + Serial.println("Queue creating failed, rebooting..."); + ESP.restart(); } attachInterruptArg(buttonFunctionPair[i].pin, onGpioInterrupt, (void *)(buttonFunctionPair + i), FALLING); } // When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR mode - log_d("Calling Zigbee.begin()"); - Zigbee.begin(ZIGBEE_COORDINATOR); + if (!Zigbee.begin(ZIGBEE_COORDINATOR)) { + Serial.println("Zigbee failed to start!"); + Serial.println("Rebooting..."); + ESP.restart(); + } Serial.println("Waiting for Light to bound to the switch"); //Wait for switch to bound to a light: - while (!zbSwitch.isBound()) { + while (!zbSwitch.bound()) { Serial.printf("."); delay(500); } - // Optional: read manufacturer and model name from the bound light + // Optional: List all bound devices and read manufacturer and model name std::list boundLights = zbSwitch.getBoundDevices(); - //List all bound lights for (const auto &device : boundLights) { - Serial.printf("Device on endpoint %d, short address: 0x%x\n", device->endpoint, device->short_addr); + Serial.printf("Device on endpoint %d, short address: 0x%x\r\n", device->endpoint, device->short_addr); Serial.printf( - "IEEE Address: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", device->ieee_addr[0], device->ieee_addr[1], device->ieee_addr[2], device->ieee_addr[3], - device->ieee_addr[4], device->ieee_addr[5], device->ieee_addr[6], device->ieee_addr[7] + "IEEE Address: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\r\n", device->ieee_addr[7], device->ieee_addr[6], device->ieee_addr[5], device->ieee_addr[4], + device->ieee_addr[3], device->ieee_addr[2], device->ieee_addr[1], device->ieee_addr[0] ); - Serial.printf("Light manufacturer: %s", zbSwitch.readManufacturer(device->endpoint, device->short_addr)); - Serial.printf("Light model: %s", zbSwitch.readModel(device->endpoint, device->short_addr)); + Serial.printf("Light manufacturer: %s\r\n", zbSwitch.readManufacturer(device->endpoint, device->short_addr, device->ieee_addr)); + Serial.printf("Light model: %s\r\n", zbSwitch.readModel(device->endpoint, device->short_addr, device->ieee_addr)); } Serial.println(); @@ -188,6 +187,6 @@ void loop() { static uint32_t lastPrint = 0; if (millis() - lastPrint > 10000) { lastPrint = millis(); - zbSwitch.printBoundDevices(); + zbSwitch.printBoundDevices(Serial); } } From 20c41bd3b6aa252727cf4bcf5fcff48ea455dcef Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:48:38 +0100 Subject: [PATCH 98/99] Update Zigbee_On_Off_Light.ino --- .../src/Zigbee_On_Off_Light.ino | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino b/examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino index 30e3cd2d1..6db8bd7b0 100644 --- a/examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino +++ b/examples/arduino-zigbee-light/src/Zigbee_On_Off_Light.ino @@ -32,25 +32,28 @@ #include "Zigbee.h" -#define LED_PIN RGB_BUILTIN -#define BUTTON_PIN 9 // ESP32-C6/H2 Boot button +/* Zigbee light bulb configuration */ #define ZIGBEE_LIGHT_ENDPOINT 10 +uint8_t led = RGB_BUILTIN; +uint8_t button = BOOT_PIN; ZigbeeLight zbLight = ZigbeeLight(ZIGBEE_LIGHT_ENDPOINT); /********************* RGB LED functions **************************/ void setLED(bool value) { - digitalWrite(LED_PIN, value); + digitalWrite(led, value); } /********************* Arduino functions **************************/ void setup() { + Serial.begin(115200); + // Init LED and turn it OFF (if LED_PIN == RGB_BUILTIN, the rgbLedWrite() will be used under the hood) - pinMode(LED_PIN, OUTPUT); - digitalWrite(LED_PIN, LOW); + pinMode(led, OUTPUT); + digitalWrite(led, LOW); // Init button for factory reset - pinMode(BUTTON_PIN, INPUT_PULLUP); + pinMode(button, INPUT_PULLUP); //Optional: set Zigbee device name and model zbLight.setManufacturerAndModel("Espressif", "ZBLightBulb"); @@ -59,28 +62,40 @@ void setup() { zbLight.onLightChange(setLED); //Add endpoint to Zigbee Core - log_d("Adding ZigbeeLight endpoint to Zigbee Core"); + Serial.println("Adding ZigbeeLight endpoint to Zigbee Core"); Zigbee.addEndpoint(&zbLight); // When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE - log_d("Calling Zigbee.begin()"); - Zigbee.begin(); + if (!Zigbee.begin()) { + Serial.println("Zigbee failed to start!"); + Serial.println("Rebooting..."); + ESP.restart(); + } + Serial.println("Connecting to network"); + while (!Zigbee.connected()) { + Serial.print("."); + delay(100); + } + Serial.println(); } void loop() { // Checking button for factory reset - if (digitalRead(BUTTON_PIN) == LOW) { // Push button pressed + if (digitalRead(button) == LOW) { // Push button pressed // Key debounce handling delay(100); int startTime = millis(); - while (digitalRead(BUTTON_PIN) == LOW) { + while (digitalRead(button) == LOW) { delay(50); if ((millis() - startTime) > 3000) { // If key pressed for more than 3secs, factory reset Zigbee and reboot - Serial.printf("Resetting Zigbee to factory settings, reboot.\n"); + Serial.println("Resetting Zigbee to factory and rebooting in 1s."); + delay(1000); Zigbee.factoryReset(); } } + // Toggle light by pressing the button + zbLight.setLight(!zbLight.getLightState()); } delay(100); } From 62fe998d9cdc4ce15f515b17dcc37d348dd7203f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 14 Dec 2024 12:29:48 +0100 Subject: [PATCH 99/99] Create esp32-p4-evboard.json --- boards/esp32-p4-evboard.json | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 boards/esp32-p4-evboard.json diff --git a/boards/esp32-p4-evboard.json b/boards/esp32-p4-evboard.json new file mode 100644 index 000000000..1ea928367 --- /dev/null +++ b/boards/esp32-p4-evboard.json @@ -0,0 +1,37 @@ +{ + "build": { + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM" + ], + "f_cpu": "360000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32p4", + "variant": "esp32p4" + }, + "arduino": { + "partitions": "default_16MB.csv" + }, + "connectivity": [ + "bluetooth", + "openthread" + ], + "debug": { + "openocd_target": "esp32p4.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif ESP32-P4 Function EV Board", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 512000, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 1500000 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32p4/esp32-p4-function-ev-board/index.html", + "vendor": "Espressif" +}