Skip to content

Commit ae81f22

Browse files
authored
Update esp8266-rtos-sdk.py
Respect per-project custom partition table configuration
1 parent 1ad34f3 commit ae81f22

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

builder/frameworks/esp8266-rtos-sdk.py

Lines changed: 21 additions & 11 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(
@@ -1248,17 +1248,26 @@ def _skip_prj_source_files(node):
12481248
# Generate partition table
12491249
#
12501250

1251-
fwpartitions_dir = os.path.join(FRAMEWORK_DIR, "components", "partition_table")
1252-
partitions_csv = board.get("build.partitions", "partitions_singleapp.csv")
1253-
partition_table_offset = sdk_config.get("PARTITION_TABLE_OFFSET", 0x8000)
1254-
1255-
env.Replace(
1256-
PARTITIONS_TABLE_CSV=os.path.abspath(
1257-
os.path.join(fwpartitions_dir, partitions_csv)
1258-
if os.path.isfile(os.path.join(fwpartitions_dir, partitions_csv))
1259-
else partitions_csv
1251+
custom_partition_table = sdk_config.get("PARTITION_TABLE_CUSTOM", False)
1252+
if custom_partition_table:
1253+
custom_partition_file = sdk_config.get("PARTITION_TABLE_CUSTOM_FILENAME", "unspecified.csv")
1254+
1255+
env.Replace(
1256+
PARTITIONS_TABLE_CSV=os.path.abspath(
1257+
os.path.join(PROJECT_DIR, custom_partition_file)
1258+
)
1259+
)
1260+
else:
1261+
fwpartitions_dir = os.path.join(FRAMEWORK_DIR, "components", "partition_table")
1262+
partitions_csv = board.get("build.partitions", "partitions_singleapp.csv")
1263+
1264+
env.Replace(
1265+
PARTITIONS_TABLE_CSV=os.path.abspath(
1266+
os.path.join(fwpartitions_dir, partitions_csv)
1267+
if os.path.isfile(os.path.join(fwpartitions_dir, partitions_csv))
1268+
else partitions_csv
1269+
)
12601270
)
1261-
)
12621271

12631272
partition_table = env.Command(
12641273
os.path.join("$BUILD_DIR", "partitions.bin"),
@@ -1276,6 +1285,7 @@ def _skip_prj_source_files(node):
12761285
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)
12771286

12781287
# linker needs APP_OFFSE and APP_SIZE
1288+
partition_table_offset = sdk_config.get("PARTITION_TABLE_OFFSET", 0x8000)
12791289
app_params = get_partition_info(env.subst("$PARTITIONS_TABLE_CSV"), partition_table_offset, {"name": "boot"})
12801290
app_offset = app_params.get("offset")
12811291
app_size = app_params.get("size")

0 commit comments

Comments
 (0)