From 8818b42b9ee7bb558a3916d5825be83e04ead602 Mon Sep 17 00:00:00 2001 From: valeros Date: Thu, 6 Jun 2024 16:08:36 +0300 Subject: [PATCH 01/14] Properly handle "preserve_source_file_extension" config option --- 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 1fe5873a3..f897cd349 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -752,8 +752,8 @@ def compile_source_files( obj_path = os.path.join(obj_path, os.path.basename(src_path)) preserve_source_file_extension = board.get( - "build.esp-idf.preserve_source_file_extension", True - ) + "build.esp-idf.preserve_source_file_extension", "yes" + ) == "yes" objects.append( build_envs[compile_group_idx].StaticObject( From d394712bbf973adb78e0024d5d4df0bfe01e1692 Mon Sep 17 00:00:00 2001 From: valeros Date: Thu, 6 Jun 2024 16:09:22 +0300 Subject: [PATCH 02/14] Update Arduino core to v2.0.17 Resolves #1385 --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index e425a7def..d0c97824c 100644 --- a/platform.json +++ b/platform.json @@ -82,7 +82,7 @@ "type": "framework", "optional": true, "owner": "platformio", - "version": "~3.20016.0" + "version": "~3.20017.0" }, "framework-espidf": { "type": "framework", From d91a581a0ecc9a3ba5c9b1fc9e0f50221818b7c1 Mon Sep 17 00:00:00 2001 From: valeros Date: Mon, 10 Jun 2024 20:38:28 +0300 Subject: [PATCH 03/14] Fix maximum RAM size for ESP32-C6-DevKitC-1 --- boards/esp32-c6-devkitc-1.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/esp32-c6-devkitc-1.json b/boards/esp32-c6-devkitc-1.json index 6e90aee03..18a76dcc7 100644 --- a/boards/esp32-c6-devkitc-1.json +++ b/boards/esp32-c6-devkitc-1.json @@ -15,7 +15,7 @@ "name": "Espressif ESP32-C6-DevKitC-1", "upload": { "flash_size": "8MB", - "maximum_ram_size": 524288, + "maximum_ram_size": 327680, "maximum_size": 8388608, "require_upload_port": true, "speed": 460800 From 40cf417aa2e2d32b32c5e9540c458e8869c5ec58 Mon Sep 17 00:00:00 2001 From: TheMasterofBlubb Date: Mon, 17 Jun 2024 14:21:49 +0200 Subject: [PATCH 04/14] Added Board definition for M5Stack Core Basic 16MB variant (#1399) According to the documentation (see Version Change) around 2020 the M5Stack Core Basic got upgraded to 16MB Flash. This also covers the newer versions with the SKUs K001-V27 and K001-V26. --- boards/m5stack-core-esp32-16M.json | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 boards/m5stack-core-esp32-16M.json diff --git a/boards/m5stack-core-esp32-16M.json b/boards/m5stack-core-esp32-16M.json new file mode 100644 index 000000000..4c5502dc4 --- /dev/null +++ b/boards/m5stack-core-esp32-16M.json @@ -0,0 +1,34 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_M5Stack_Core_ESP32", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32", + "variant": "m5stack_core_esp32" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "frameworks": [ + "arduino", + "espidf" + ], + "name": "M5Stack Core ESP32 16M", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 532480, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 460800 + }, + "url": "http://www.m5stack.com", + "vendor": "M5Stack" +} From 64608ba2681fa77a5bee571ac535b01cf8ee4249 Mon Sep 17 00:00:00 2001 From: valeros Date: Tue, 18 Jun 2024 14:50:13 +0300 Subject: [PATCH 05/14] Update ESP-IDF to v5.2.2 Resolves #1398 --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index d0c97824c..78cc059cf 100644 --- a/platform.json +++ b/platform.json @@ -88,7 +88,7 @@ "type": "framework", "optional": true, "owner": "platformio", - "version": "~3.50201.0", + "version": "~3.50202.0", "optionalVersions": ["~3.40407.0"] }, "tool-esptoolpy": { From ad7b231ca3bb561eb71febef067c3a0f28787ee9 Mon Sep 17 00:00:00 2001 From: valeros Date: Tue, 18 Jun 2024 20:11:26 +0300 Subject: [PATCH 06/14] Add default sdk config for esp32-c6-devkitc-1 in examples --- examples/espidf-hello-world/platformio.ini | 2 ++ examples/espidf-hello-world/sdkconfig.defaults.esp32c6 | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 examples/espidf-hello-world/sdkconfig.defaults.esp32c6 diff --git a/examples/espidf-hello-world/platformio.ini b/examples/espidf-hello-world/platformio.ini index 8347b1654..44102cc88 100644 --- a/examples/espidf-hello-world/platformio.ini +++ b/examples/espidf-hello-world/platformio.ini @@ -23,3 +23,5 @@ board = esp32-c3-devkitm-1 [env:esp32-c6-devkitc-1] board = esp32-c6-devkitc-1 +board_build.cmake_extra_args = + -DSDKCONFIG_DEFAULTS="sdkconfig.defaults.esp32c6" diff --git a/examples/espidf-hello-world/sdkconfig.defaults.esp32c6 b/examples/espidf-hello-world/sdkconfig.defaults.esp32c6 new file mode 100644 index 000000000..6c73965bc --- /dev/null +++ b/examples/espidf-hello-world/sdkconfig.defaults.esp32c6 @@ -0,0 +1,2 @@ +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="8MB" From 19a2a1e4086d44e9c3b002215d0211f02e0d438c Mon Sep 17 00:00:00 2001 From: Philip Corliss Date: Tue, 2 Jul 2024 03:55:52 -0500 Subject: [PATCH 07/14] Enable PSRAM for adafruit_feather_esp32s3_reversetft (#1414) --- boards/adafruit_feather_esp32s3_reversetft.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/adafruit_feather_esp32s3_reversetft.json b/boards/adafruit_feather_esp32s3_reversetft.json index de9a8e53f..ac478ba78 100644 --- a/boards/adafruit_feather_esp32s3_reversetft.json +++ b/boards/adafruit_feather_esp32s3_reversetft.json @@ -10,7 +10,8 @@ "-DARDUINO_ADAFRUIT_FEATHER_ESP32S3_REVTFT", "-DARDUINO_USB_CDC_ON_BOOT=1", "-DARDUINO_RUNNING_CORE=1", - "-DARDUINO_EVENT_RUNNING_CORE=1" + "-DARDUINO_EVENT_RUNNING_CORE=1", + "-DBOARD_HAS_PSRAM", ], "f_cpu": "240000000L", "f_flash": "80000000L", From f77dd2c993ddbc133412b65b41086db612ab458d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:27:15 +0200 Subject: [PATCH 08/14] Better handling of IDF package version (#1420) Resolves #1418 --- builder/frameworks/espidf.py | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index f897cd349..3b9850039 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -999,12 +999,38 @@ def find_default_component(target_configs): env.Exit(1) +def get_framework_version(): + def _extract_from_cmake_version_file(): + version_cmake_file = os.path.join( + FRAMEWORK_DIR, "tools", "cmake", "version.cmake" + ) + if not os.path.isfile(version_cmake_file): + return + + with open(version_cmake_file, encoding="utf8") as fp: + pattern = r"set\(IDF_VERSION_(MAJOR|MINOR|PATCH) (\d+)\)" + matches = re.findall(pattern, fp.read()) + if len(matches) != 3: + return + # If found all three parts of the version + return ".".join([match[1] for match in matches]) + + pkg = platform.get_package("framework-espidf") + version = get_original_version(str(pkg.metadata.version.truncate())) + if not version: + # Fallback value extracted directly from the cmake version file + version = _extract_from_cmake_version_file() + if not version: + version = "0.0.0" + + return version + + def create_version_file(): version_file = os.path.join(FRAMEWORK_DIR, "version.txt") if not os.path.isfile(version_file): with open(version_file, "w") as fp: - package_version = platform.get_package_version("framework-espidf") - fp.write(get_original_version(package_version) or package_version) + fp.write(get_framework_version()) def generate_empty_partition_image(binary_path, image_size): @@ -1236,7 +1262,7 @@ def get_idf_venv_dir(): # unnecessary reinstallation of Python dependencies in cases when Arduino # as an IDF component requires a different version of the IDF package and # hence a different set of Python deps or their versions - idf_version = get_original_version(platform.get_package_version("framework-espidf")) + idf_version = get_framework_version() return os.path.join( env.subst("$PROJECT_CORE_DIR"), "penv", ".espidf-" + idf_version ) From 68ad40f6df654fe4b8d0a50982b810df5b49b677 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Wed, 10 Jul 2024 19:39:48 +0100 Subject: [PATCH 09/14] Remove floating comma from adafruit_feather_esp32s3_reversetft.json. (#1421) --- boards/adafruit_feather_esp32s3_reversetft.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/adafruit_feather_esp32s3_reversetft.json b/boards/adafruit_feather_esp32s3_reversetft.json index ac478ba78..c9209de57 100644 --- a/boards/adafruit_feather_esp32s3_reversetft.json +++ b/boards/adafruit_feather_esp32s3_reversetft.json @@ -11,7 +11,7 @@ "-DARDUINO_USB_CDC_ON_BOOT=1", "-DARDUINO_RUNNING_CORE=1", "-DARDUINO_EVENT_RUNNING_CORE=1", - "-DBOARD_HAS_PSRAM", + "-DBOARD_HAS_PSRAM" ], "f_cpu": "240000000L", "f_flash": "80000000L", From 3ef6a7a9e43ee5c2f3fa4198bfab626f55c0cc38 Mon Sep 17 00:00:00 2001 From: dariush Date: Thu, 18 Jul 2024 14:48:01 +0200 Subject: [PATCH 10/14] Add littlefs partition subtype (#1426) added littlefs to list of recognised subtypes in _parse_partitions --- builder/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/main.py b/builder/main.py index 98ae15526..2cb21d1ab 100644 --- a/builder/main.py +++ b/builder/main.py @@ -204,7 +204,7 @@ def _to_unix_slashes(path): def fetch_fs_size(env): fs = None for p in _parse_partitions(env): - if p["type"] == "data" and p["subtype"] in ("spiffs", "fat"): + if p["type"] == "data" and p["subtype"] in ("spiffs", "fat", "littlefs"): fs = p if not fs: sys.stderr.write( From b3ef03f08048a8531a624c1b17dae3cad1504725 Mon Sep 17 00:00:00 2001 From: valeros Date: Mon, 29 Jul 2024 12:46:36 +0300 Subject: [PATCH 11/14] Update IDF script --- builder/frameworks/espidf.py | 99 +++++++++++++++++++++++++++++------- builder/frameworks/ulp.py | 12 +++-- 2 files changed, 91 insertions(+), 20 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 3b9850039..c488352c6 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -652,16 +652,30 @@ def generate_project_ld_script(sdk_config, ignore_targets=None): '--objdump "{objdump}"' ).format(**args) + initial_ld_script = os.path.join( + FRAMEWORK_DIR, + "components", + "esp_system", + "ld", + idf_variant, + "sections.ld.in", + ) + + if IDF5: + initial_ld_script = preprocess_linker_file( + initial_ld_script, + os.path.join( + BUILD_DIR, + "esp-idf", + "esp_system", + "ld", + "sections.ld.in", + ) + ) + return env.Command( os.path.join("$BUILD_DIR", "sections.ld"), - os.path.join( - FRAMEWORK_DIR, - "components", - "esp_system", - "ld", - idf_variant, - "sections.ld.in", - ), + initial_ld_script, env.VerboseAction(cmd, "Generating project linker script $TARGET"), ) @@ -1111,6 +1125,46 @@ def get_app_partition_offset(pt_table, pt_offset): return app_params.get("offset", "0x10000") +def preprocess_linker_file(src_ld_script, target_ld_script): + return env.Command( + target_ld_script, + src_ld_script, + env.VerboseAction( + " ".join( + [ + os.path.join( + platform.get_package_dir("tool-cmake"), + "bin", + "cmake", + ), + "-DCC=%s" + % os.path.join( + TOOLCHAIN_DIR, + "bin", + "$CC", + ), + "-DSOURCE=$SOURCE", + "-DTARGET=$TARGET", + "-DCONFIG_DIR=%s" % os.path.join(BUILD_DIR, "config"), + "-DLD_DIR=%s" + % os.path.join( + FRAMEWORK_DIR, "components", "esp_system", "ld" + ), + "-P", + os.path.join( + "$BUILD_DIR", + "esp-idf", + "esp_system", + "ld", + "linker_script_generator.cmake", + ), + ] + ), + "Generating LD script $TARGET", + ), + ) + + def generate_mbedtls_bundle(sdk_config): bundle_path = os.path.join("$BUILD_DIR", "x509_crt_bundle") if os.path.isfile(env.subst(bundle_path)): @@ -1356,19 +1410,30 @@ def get_python_exe(): # if not board.get("build.ldscript", ""): - linker_script = env.Command( - os.path.join("$BUILD_DIR", "memory.ld"), - board.get( - "build.esp-idf.ldscript", + initial_ld_script = board.get("build.esp-idf.ldscript", os.path.join( + FRAMEWORK_DIR, + "components", + "esp_system", + "ld", + idf_variant, + "memory.ld.in", + )) + + if IDF5: + initial_ld_script = preprocess_linker_file( + initial_ld_script, os.path.join( - FRAMEWORK_DIR, - "components", + BUILD_DIR, + "esp-idf", "esp_system", "ld", - idf_variant, "memory.ld.in", - ), - ), + ) + ) + + linker_script = env.Command( + os.path.join("$BUILD_DIR", "memory.ld"), + initial_ld_script, env.VerboseAction( '$CC -I"$BUILD_DIR/config" -I"%s" -C -P -x c -E $SOURCE -o $TARGET' % os.path.join(FRAMEWORK_DIR, "components", "esp_system", "ld"), diff --git a/builder/frameworks/ulp.py b/builder/frameworks/ulp.py index 1a66c2bc9..ad61d8002 100644 --- a/builder/frameworks/ulp.py +++ b/builder/frameworks/ulp.py @@ -13,6 +13,7 @@ # limitations under the License. import os +import sys from platformio import fs from platformio.util import get_systype @@ -60,7 +61,7 @@ def prepare_ulp_env_vars(env): def collect_ulp_sources(): return [ - fs.to_unix_path(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f)) + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f) for f in os.listdir(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp")) if f.endswith((".c", ".S", ".s")) ] @@ -98,7 +99,7 @@ def _generate_ulp_configuration_action(env, target, source): "-riscv" if riscv_ulp_enabled else "", ), ), - "-DULP_S_SOURCES=%s" % ";".join([s.get_abspath() for s in source]), + "-DULP_S_SOURCES=%s" % ";".join([fs.to_unix_path(s.get_abspath()) for s in source]), "-DULP_APP_NAME=ulp_main", "-DCOMPONENT_DIR=" + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"), "-DCOMPONENT_INCLUDES=%s" % ";".join(get_component_includes(target_config)), @@ -113,7 +114,12 @@ def _generate_ulp_configuration_action(env, target, source): os.path.join(FRAMEWORK_DIR, "components", "ulp", "cmake"), ) - exec_command(cmd) + print(555, cmd) + + result = exec_command(cmd) + if result["returncode"] != 0: + sys.stderr.write(result["err"] + "\n") + env.Exit(1) ulp_sources = collect_ulp_sources() ulp_sources.sort() From e519b925e10c7e32eadf89287232cfffdaf82774 Mon Sep 17 00:00:00 2001 From: valeros Date: Mon, 29 Jul 2024 12:47:21 +0300 Subject: [PATCH 12/14] Update packages --- platform.json | 8 ++++---- platform.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform.json b/platform.json index 78cc059cf..e4ff766fb 100644 --- a/platform.json +++ b/platform.json @@ -52,19 +52,19 @@ "optional": true, "owner": "espressif", "version": "8.4.0+2021r2-patch5", - "optionalVersions": ["13.2.0+20230928"] + "optionalVersions": ["13.2.0+20240530"] }, "toolchain-xtensa-esp-elf": { "type": "toolchain", "optional": true, "owner": "platformio", - "version": "13.2.0+20230928" + "version": "13.2.0+20240530" }, "toolchain-esp32ulp": { "type": "toolchain", "optional": true, "owner": "platformio", - "version": "~1.23500.0" + "version": "~1.23800.0" }, "tool-xtensa-esp-elf-gdb": { "type": "debugger", @@ -88,7 +88,7 @@ "type": "framework", "optional": true, "owner": "platformio", - "version": "~3.50202.0", + "version": "~3.50300.0", "optionalVersions": ["~3.40407.0"] }, "tool-esptoolpy": { diff --git a/platform.py b/platform.py index e0537875e..895948e06 100644 --- a/platform.py +++ b/platform.py @@ -137,7 +137,7 @@ def configure_default_packages(self, variables, targets): self.packages["toolchain-riscv32-esp"]["owner"] = "platformio" self.packages["toolchain-riscv32-esp"][ "version" - ] = "13.2.0+20230928" + ] = "13.2.0+20240530" if "arduino" in frameworks: # Disable standalone GDB packages for Arduino and Arduino/IDF projects From cb702f414def21c8da32709a93b51d6a34d05415 Mon Sep 17 00:00:00 2001 From: valeros Date: Mon, 29 Jul 2024 18:04:48 +0300 Subject: [PATCH 13/14] Fix incorrect handling of positional linker flags Resolves #1430 --- 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 c488352c6..9c5158785 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -1595,7 +1595,9 @@ def get_python_exe(): # Extra flags which need to be explicitly specified in LINKFLAGS section because SCons # cannot merge them correctly -extra_flags = filter_args(link_args["LINKFLAGS"], ["-T", "-u"]) +extra_flags = filter_args( + link_args["LINKFLAGS"], ["-T", "-u", "-Wl,--start-group", "-Wl,--end-group"] +) link_args["LINKFLAGS"] = sorted(list(set(link_args["LINKFLAGS"]) - set(extra_flags))) # remove the main linker script flags '-T memory.ld' From 43e1b6253de61561fc7901a13f008c7cba30bbf4 Mon Sep 17 00:00:00 2001 From: valeros Date: Tue, 30 Jul 2024 13:46:18 +0300 Subject: [PATCH 14/14] Bump version to 6.8.0 --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index e4ff766fb..8fcafc4c9 100644 --- a/platform.json +++ b/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/platformio/platform-espressif32.git" }, - "version": "6.7.0", + "version": "6.8.0", "frameworks": { "arduino": { "package": "framework-arduinoespressif32",