From 236498b04041020dccea4c71fd62d394e25a236b Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 4 Dec 2023 16:10:27 +0100 Subject: [PATCH] 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 --- components/partition_table/Kconfig.projbuild | 4 ++-- components/partition_table/project_include.cmake | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/components/partition_table/Kconfig.projbuild b/components/partition_table/Kconfig.projbuild index efcca14f59..5246e8f1cb 100644 --- a/components/partition_table/Kconfig.projbuild +++ b/components/partition_table/Kconfig.projbuild @@ -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 diff --git a/components/partition_table/project_include.cmake b/components/partition_table/project_include.cmake index d0969ba408..7778af1155 100644 --- a/components/partition_table/project_include.cmake +++ b/components/partition_table/project_include.cmake @@ -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. "