Skip to content

Commit

Permalink
feat(partition_table): Allow configuration of absolute path for custo…
Browse files Browse the repository at this point in the history
…m 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 #12264
  • Loading branch information
sudeep-mohanty committed Jan 11, 2024
1 parent 2eacbbe commit 236498b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions components/partition_table/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions components/partition_table/project_include.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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. "
Expand Down

0 comments on commit 236498b

Please sign in to comment.