Skip to content

Commit 0a4478f

Browse files
authored
Update esp8266-rtos-sdk.py
Reading parttool code, it seems when `--partition-table-file` is provided, it doesn't use `--partition-table-offset`. Also `--partition-name` is preferred over `--partition-type` and `--partition-subtype`.
1 parent 1ad34f3 commit 0a4478f

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

builder/frameworks/esp8266-rtos-sdk.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ def _scan_components_from_framework():
467467
return components or _scan_components_from_framework()
468468

469469

470-
470+
471471
def extract_linker_script_fragments(framework_components_dir, sdk_config):
472472
# Hardware-specific components are excluded from search and added manually below
473473
project_components = load_component_paths(
@@ -919,7 +919,7 @@ def generate_empty_partition_image(binary_path, image_size):
919919
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", empty_partition)
920920

921921

922-
def get_partition_info(pt_path, pt_offset, pt_params):
922+
def get_partition_info(pt_path, pt_params):
923923
if not os.path.isfile(pt_path):
924924
sys.stderr.write(
925925
"Missing partition table file `%s`\n" % os.path.basename(pt_path)
@@ -930,8 +930,6 @@ def get_partition_info(pt_path, pt_offset, pt_params):
930930
env.subst("$PYTHONEXE"),
931931
os.path.join(FRAMEWORK_DIR, "components", "partition_table", "parttool.py"),
932932
"-q",
933-
"--partition-table-offset",
934-
hex(pt_offset),
935933
"--partition-table-file",
936934
pt_path,
937935
"get_partition_info",
@@ -940,8 +938,13 @@ def get_partition_info(pt_path, pt_offset, pt_params):
940938
"offset",
941939
]
942940

943-
if pt_params["name"] == "boot":
944-
cmd.append("--partition-boot-default")
941+
if pt_params["name"]:
942+
if pt_params["name"] == "*boot":
943+
cmd.append("--partition-boot-default")
944+
else:
945+
cmd.extend([
946+
"--partition-name", pt_params["name"]
947+
])
945948
else:
946949
cmd.extend(
947950
[
@@ -955,8 +958,8 @@ def get_partition_info(pt_path, pt_offset, pt_params):
955958
result = exec_command(cmd)
956959
if result["returncode"] != 0:
957960
sys.stderr.write(
958-
"Couldn't extract information for %s/%s from the partition table\n"
959-
% (pt_params["type"], pt_params["subtype"])
961+
"Couldn't extract information for {%s} from %s\n"
962+
% (pt_params, pt_path)
960963
)
961964
sys.stderr.write(result["out"] + "\n")
962965
sys.stderr.write(result["err"] + "\n")
@@ -969,12 +972,6 @@ def get_partition_info(pt_path, pt_offset, pt_params):
969972
return {"size": size, "offset": offset}
970973

971974

972-
def get_app_partition_offset(pt_table, pt_offset):
973-
# Get the default boot partition offset
974-
app_params = get_partition_info(pt_table, pt_offset, {"name": "boot"})
975-
return app_params.get("offset", "0x10000")
976-
977-
978975
def install_python_deps():
979976
def _get_installed_pip_packages():
980977
result = {}
@@ -1276,7 +1273,7 @@ def _skip_prj_source_files(node):
12761273
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)
12771274

12781275
# linker needs APP_OFFSE and APP_SIZE
1279-
app_params = get_partition_info(env.subst("$PARTITIONS_TABLE_CSV"), partition_table_offset, {"name": "boot"})
1276+
app_params = get_partition_info(env.subst("$PARTITIONS_TABLE_CSV"), {"name": "*boot"})
12801277
app_offset = app_params.get("offset")
12811278
app_size = app_params.get("size")
12821279
env.Replace(
@@ -1346,7 +1343,6 @@ def _skip_prj_source_files(node):
13461343

13471344
ota_partition_params = get_partition_info(
13481345
env.subst("$PARTITIONS_TABLE_CSV"),
1349-
partition_table_offset,
13501346
{"name": "ota", "type": "data", "subtype": "ota"},
13511347
)
13521348

0 commit comments

Comments
 (0)