2018-11-11 02:36:10 -05:00
|
|
|
if(NOT BOOTLOADER_BUILD AND IDF_BUILD_ARTIFACTS)
|
2018-08-16 01:01:43 -04:00
|
|
|
|
|
|
|
set(PARTITION_TABLE_OFFSET ${CONFIG_PARTITION_TABLE_OFFSET})
|
|
|
|
|
|
|
|
# Set PARTITION_CSV_PATH to the configured partition CSV file
|
|
|
|
# absolute path
|
|
|
|
if(CONFIG_PARTITION_TABLE_CUSTOM)
|
|
|
|
# Custom filename expands any path relative to the project
|
2018-11-11 02:36:10 -05:00
|
|
|
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
|
|
|
|
ABSOLUTE BASE_DIR "${IDF_PROJECT_PATH}")
|
2018-08-16 01:01:43 -04:00
|
|
|
|
|
|
|
if(NOT EXISTS "${PARTITION_CSV_PATH}")
|
2018-08-20 04:24:18 -04:00
|
|
|
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
|
|
|
|
"Change custom partition CSV path in menuconfig.")
|
2018-08-26 23:55:04 -04:00
|
|
|
# Note: partition_table CMakeLists.txt contains some logic to create a dummy
|
|
|
|
# partition_table target in this case, see comments in that file.
|
2018-08-16 01:01:43 -04:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
# Other .csv files are always in the component directory
|
|
|
|
get_filename_component(PARTITION_CSV_PATH "${COMPONENT_PATH}/${CONFIG_PARTITION_TABLE_FILENAME}" ABSOLUTE)
|
|
|
|
|
|
|
|
if(NOT EXISTS "${PARTITION_CSV_PATH}")
|
|
|
|
message(FATAL_ERROR "Internal error, built-in ${PARTITION_CSV_PATH} not found.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# need to re-run CMake if the partition CSV changes, as the offsets/sizes of partitions may change
|
|
|
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PARTITION_CSV_PATH})
|
|
|
|
|
|
|
|
# Parse the partition table to get variable partition offsets & sizes which must be known at CMake runtime
|
2018-11-15 15:59:37 -05:00
|
|
|
function(get_partition_info variable get_part_info_args part_info)
|
2018-08-19 20:47:42 -04:00
|
|
|
separate_arguments(get_part_info_args)
|
2018-08-27 06:02:30 -04:00
|
|
|
execute_process(COMMAND ${PYTHON}
|
2018-08-20 04:24:18 -04:00
|
|
|
${COMPONENT_PATH}/parttool.py -q
|
|
|
|
--partition-table-offset ${PARTITION_TABLE_OFFSET}
|
2018-11-15 15:59:37 -05:00
|
|
|
--partition-table-file ${PARTITION_CSV_PATH}
|
|
|
|
${get_part_info_args} get_partition_info --info ${part_info}
|
2018-08-19 20:47:42 -04:00
|
|
|
OUTPUT_VARIABLE result
|
2018-08-20 04:24:18 -04:00
|
|
|
RESULT_VARIABLE exit_code
|
2018-08-19 20:47:42 -04:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2018-08-20 04:24:18 -04:00
|
|
|
if(NOT ${exit_code} EQUAL 0 AND NOT ${exit_code} EQUAL 1)
|
|
|
|
# can't fail here as it would prevent the user from running 'menuconfig' again
|
|
|
|
message(WARNING "parttool.py execution failed (${result}), problem with partition CSV file (see above)")
|
|
|
|
endif()
|
2018-08-19 20:47:42 -04:00
|
|
|
set(${variable} ${result} PARENT_SCOPE)
|
|
|
|
endfunction()
|
2018-08-16 01:01:43 -04:00
|
|
|
|
|
|
|
if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION)
|
2018-11-15 15:59:37 -05:00
|
|
|
get_partition_info(PHY_PARTITION_OFFSET
|
|
|
|
"--partition-type data --partition-subtype phy" "offset")
|
2018-11-11 02:36:10 -05:00
|
|
|
set(PHY_PARTITION_BIN_FILE "esp32/phy_init_data.bin")
|
2018-08-16 01:01:43 -04:00
|
|
|
endif()
|
|
|
|
|
2018-11-15 15:59:37 -05:00
|
|
|
get_partition_info(APP_PARTITION_OFFSET
|
|
|
|
"--partition-boot-default" "offset")
|
2018-08-16 01:01:43 -04:00
|
|
|
|
2018-11-15 15:59:37 -05:00
|
|
|
get_partition_info(OTADATA_PARTITION_OFFSET
|
|
|
|
"--partition-type data --partition-subtype ota" "offset")
|
2018-08-16 01:01:43 -04:00
|
|
|
|
2018-11-15 15:59:37 -05:00
|
|
|
get_partition_info(OTADATA_PARTITION_SIZE
|
|
|
|
"--partition-type data --partition-subtype ota" "size")
|
2018-08-16 01:01:43 -04:00
|
|
|
|
2019-02-13 04:32:23 -05:00
|
|
|
get_partition_info(FACTORY_OFFSET
|
|
|
|
"--partition-type app --partition-subtype factory" "offset")
|
|
|
|
|
2018-08-16 01:01:43 -04:00
|
|
|
endif()
|
2018-10-19 15:02:55 -04:00
|
|
|
|
|
|
|
set(BOOTLOADER_OFFSET 0x1000)
|