feat(partition_table): Allow configuration of absolute path for custom partitions.csv file

This commit allows the configuration of an absolute path for the custom
partitions.csv file via the Kconfig option CONFIG_PARTITION_TABLE_CUSTOM_FILENAME.

Closes https://github.com/espressif/esp-idf/issues/12264
This commit is contained in:
Sudeep Mohanty 2023-12-04 16:10:27 +01:00
parent 2eacbbe957
commit 236498b040
2 changed files with 11 additions and 6 deletions

View File

@ -89,8 +89,8 @@ menu "Partition Table"
string "Custom partition CSV file" if PARTITION_TABLE_CUSTOM
default "partitions.csv"
help
Name of the custom partition CSV filename. This path is evaluated
relative to the project root directory.
Name of the custom partition CSV filename. This path is evaluated relative to the project root directory
by default. However, if the abolute path for the CSV file is provided, then the absolute path is configured.
config PARTITION_TABLE_FILENAME
string

View File

@ -9,10 +9,15 @@ if(NOT BOOTLOADER_BUILD)
# Set PARTITION_CSV_PATH to the configured partition CSV file
# absolute path
if(CONFIG_PARTITION_TABLE_CUSTOM)
idf_build_get_property(project_dir PROJECT_DIR)
# Custom filename expands any path relative to the project
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
ABSOLUTE BASE_DIR "${project_dir}")
# If the partition CSV file config already has the absolute path then set PARTITION_CSV_PATH directly
if(IS_ABSOLUTE ${CONFIG_PARTITION_TABLE_FILENAME})
set(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}")
else()
idf_build_get_property(project_dir PROJECT_DIR)
# Custom filename expands any path relative to the project
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
ABSOLUTE BASE_DIR "${project_dir}")
endif()
if(NOT EXISTS "${PARTITION_CSV_PATH}")
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "