Skip to content

Commit bbe4952

Browse files
committed
Merge branch 'feature/i53' into develop
2 parents 3ef6a7a + cb702f4 commit bbe4952

File tree

4 files changed

+99
-26
lines changed

4 files changed

+99
-26
lines changed

builder/frameworks/espidf.py

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -652,16 +652,30 @@ def generate_project_ld_script(sdk_config, ignore_targets=None):
652652
'--objdump "{objdump}"'
653653
).format(**args)
654654

655+
initial_ld_script = os.path.join(
656+
FRAMEWORK_DIR,
657+
"components",
658+
"esp_system",
659+
"ld",
660+
idf_variant,
661+
"sections.ld.in",
662+
)
663+
664+
if IDF5:
665+
initial_ld_script = preprocess_linker_file(
666+
initial_ld_script,
667+
os.path.join(
668+
BUILD_DIR,
669+
"esp-idf",
670+
"esp_system",
671+
"ld",
672+
"sections.ld.in",
673+
)
674+
)
675+
655676
return env.Command(
656677
os.path.join("$BUILD_DIR", "sections.ld"),
657-
os.path.join(
658-
FRAMEWORK_DIR,
659-
"components",
660-
"esp_system",
661-
"ld",
662-
idf_variant,
663-
"sections.ld.in",
664-
),
678+
initial_ld_script,
665679
env.VerboseAction(cmd, "Generating project linker script $TARGET"),
666680
)
667681

@@ -1111,6 +1125,46 @@ def get_app_partition_offset(pt_table, pt_offset):
11111125
return app_params.get("offset", "0x10000")
11121126

11131127

1128+
def preprocess_linker_file(src_ld_script, target_ld_script):
1129+
return env.Command(
1130+
target_ld_script,
1131+
src_ld_script,
1132+
env.VerboseAction(
1133+
" ".join(
1134+
[
1135+
os.path.join(
1136+
platform.get_package_dir("tool-cmake"),
1137+
"bin",
1138+
"cmake",
1139+
),
1140+
"-DCC=%s"
1141+
% os.path.join(
1142+
TOOLCHAIN_DIR,
1143+
"bin",
1144+
"$CC",
1145+
),
1146+
"-DSOURCE=$SOURCE",
1147+
"-DTARGET=$TARGET",
1148+
"-DCONFIG_DIR=%s" % os.path.join(BUILD_DIR, "config"),
1149+
"-DLD_DIR=%s"
1150+
% os.path.join(
1151+
FRAMEWORK_DIR, "components", "esp_system", "ld"
1152+
),
1153+
"-P",
1154+
os.path.join(
1155+
"$BUILD_DIR",
1156+
"esp-idf",
1157+
"esp_system",
1158+
"ld",
1159+
"linker_script_generator.cmake",
1160+
),
1161+
]
1162+
),
1163+
"Generating LD script $TARGET",
1164+
),
1165+
)
1166+
1167+
11141168
def generate_mbedtls_bundle(sdk_config):
11151169
bundle_path = os.path.join("$BUILD_DIR", "x509_crt_bundle")
11161170
if os.path.isfile(env.subst(bundle_path)):
@@ -1356,19 +1410,30 @@ def get_python_exe():
13561410
#
13571411

13581412
if not board.get("build.ldscript", ""):
1359-
linker_script = env.Command(
1360-
os.path.join("$BUILD_DIR", "memory.ld"),
1361-
board.get(
1362-
"build.esp-idf.ldscript",
1413+
initial_ld_script = board.get("build.esp-idf.ldscript", os.path.join(
1414+
FRAMEWORK_DIR,
1415+
"components",
1416+
"esp_system",
1417+
"ld",
1418+
idf_variant,
1419+
"memory.ld.in",
1420+
))
1421+
1422+
if IDF5:
1423+
initial_ld_script = preprocess_linker_file(
1424+
initial_ld_script,
13631425
os.path.join(
1364-
FRAMEWORK_DIR,
1365-
"components",
1426+
BUILD_DIR,
1427+
"esp-idf",
13661428
"esp_system",
13671429
"ld",
1368-
idf_variant,
13691430
"memory.ld.in",
1370-
),
1371-
),
1431+
)
1432+
)
1433+
1434+
linker_script = env.Command(
1435+
os.path.join("$BUILD_DIR", "memory.ld"),
1436+
initial_ld_script,
13721437
env.VerboseAction(
13731438
'$CC -I"$BUILD_DIR/config" -I"%s" -C -P -x c -E $SOURCE -o $TARGET'
13741439
% os.path.join(FRAMEWORK_DIR, "components", "esp_system", "ld"),
@@ -1530,7 +1595,9 @@ def get_python_exe():
15301595

15311596
# Extra flags which need to be explicitly specified in LINKFLAGS section because SCons
15321597
# cannot merge them correctly
1533-
extra_flags = filter_args(link_args["LINKFLAGS"], ["-T", "-u"])
1598+
extra_flags = filter_args(
1599+
link_args["LINKFLAGS"], ["-T", "-u", "-Wl,--start-group", "-Wl,--end-group"]
1600+
)
15341601
link_args["LINKFLAGS"] = sorted(list(set(link_args["LINKFLAGS"]) - set(extra_flags)))
15351602

15361603
# remove the main linker script flags '-T memory.ld'

builder/frameworks/ulp.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import os
16+
import sys
1617

1718
from platformio import fs
1819
from platformio.util import get_systype
@@ -60,7 +61,7 @@ def prepare_ulp_env_vars(env):
6061

6162
def collect_ulp_sources():
6263
return [
63-
fs.to_unix_path(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f))
64+
os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f)
6465
for f in os.listdir(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"))
6566
if f.endswith((".c", ".S", ".s"))
6667
]
@@ -98,7 +99,7 @@ def _generate_ulp_configuration_action(env, target, source):
9899
"-riscv" if riscv_ulp_enabled else "",
99100
),
100101
),
101-
"-DULP_S_SOURCES=%s" % ";".join([s.get_abspath() for s in source]),
102+
"-DULP_S_SOURCES=%s" % ";".join([fs.to_unix_path(s.get_abspath()) for s in source]),
102103
"-DULP_APP_NAME=ulp_main",
103104
"-DCOMPONENT_DIR=" + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"),
104105
"-DCOMPONENT_INCLUDES=%s" % ";".join(get_component_includes(target_config)),
@@ -113,7 +114,12 @@ def _generate_ulp_configuration_action(env, target, source):
113114
os.path.join(FRAMEWORK_DIR, "components", "ulp", "cmake"),
114115
)
115116

116-
exec_command(cmd)
117+
print(555, cmd)
118+
119+
result = exec_command(cmd)
120+
if result["returncode"] != 0:
121+
sys.stderr.write(result["err"] + "\n")
122+
env.Exit(1)
117123

118124
ulp_sources = collect_ulp_sources()
119125
ulp_sources.sort()

platform.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@
5252
"optional": true,
5353
"owner": "espressif",
5454
"version": "8.4.0+2021r2-patch5",
55-
"optionalVersions": ["13.2.0+20230928"]
55+
"optionalVersions": ["13.2.0+20240530"]
5656
},
5757
"toolchain-xtensa-esp-elf": {
5858
"type": "toolchain",
5959
"optional": true,
6060
"owner": "platformio",
61-
"version": "13.2.0+20230928"
61+
"version": "13.2.0+20240530"
6262
},
6363
"toolchain-esp32ulp": {
6464
"type": "toolchain",
6565
"optional": true,
6666
"owner": "platformio",
67-
"version": "~1.23500.0"
67+
"version": "~1.23800.0"
6868
},
6969
"tool-xtensa-esp-elf-gdb": {
7070
"type": "debugger",
@@ -88,7 +88,7 @@
8888
"type": "framework",
8989
"optional": true,
9090
"owner": "platformio",
91-
"version": "~3.50202.0",
91+
"version": "~3.50300.0",
9292
"optionalVersions": ["~3.40407.0"]
9393
},
9494
"tool-esptoolpy": {

platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def configure_default_packages(self, variables, targets):
137137
self.packages["toolchain-riscv32-esp"]["owner"] = "platformio"
138138
self.packages["toolchain-riscv32-esp"][
139139
"version"
140-
] = "13.2.0+20230928"
140+
] = "13.2.0+20240530"
141141

142142
if "arduino" in frameworks:
143143
# Disable standalone GDB packages for Arduino and Arduino/IDF projects

0 commit comments

Comments
 (0)