Skip to content

Commit

Permalink
Merge branch 'release/v6.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jul 30, 2024
2 parents 79b5a07 + 43e1b62 commit e08b419
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 36 deletions.
3 changes: 2 additions & 1 deletion boards/adafruit_feather_esp32s3_reversetft.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion boards/esp32-c6-devkitc-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions boards/m5stack-core-esp32-16M.json
Original file line number Diff line number Diff line change
@@ -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"
}
139 changes: 116 additions & 23 deletions builder/frameworks/espidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)

Expand Down Expand Up @@ -752,8 +766,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(
Expand Down Expand Up @@ -999,12 +1013,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):
Expand Down Expand Up @@ -1085,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)):
Expand Down Expand Up @@ -1236,7 +1316,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
)
Expand Down Expand Up @@ -1330,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"),
Expand Down Expand Up @@ -1504,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'
Expand Down
12 changes: 9 additions & 3 deletions builder/frameworks/ulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import os
import sys

from platformio import fs
from platformio.util import get_systype
Expand Down Expand Up @@ -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"))
]
Expand Down Expand Up @@ -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)),
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions examples/espidf-hello-world/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 2 additions & 0 deletions examples/espidf-hello-world/sdkconfig.defaults.esp32c6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"
12 changes: 6 additions & 6 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -82,13 +82,13 @@
"type": "framework",
"optional": true,
"owner": "platformio",
"version": "~3.20016.0"
"version": "~3.20017.0"
},
"framework-espidf": {
"type": "framework",
"optional": true,
"owner": "platformio",
"version": "~3.50201.0",
"version": "~3.50300.0",
"optionalVersions": ["~3.40407.0"]
},
"tool-esptoolpy": {
Expand Down
2 changes: 1 addition & 1 deletion platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e08b419

Please sign in to comment.