mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
cmake/partitions: Apply offset to partition table metadata correctly
Also warn if the parttool.py has an error
This commit is contained in:
committed by
Angus Gratton
parent
0743361da3
commit
7cc5888583
@ -23,7 +23,7 @@ if(CONFIG_ESPTOOLPY_FLASHSIZE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT "${unsigned_partition_bin}"
|
add_custom_command(OUTPUT "${unsigned_partition_bin}"
|
||||||
COMMAND "${PYTHON}" "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py" -q ${md5_opt} ${flashsize_opt}
|
COMMAND "${PYTHON}" "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py" -q --offset ${PARTITION_TABLE_OFFSET} ${md5_opt} ${flashsize_opt}
|
||||||
${partition_csv} ${unsigned_partition_bin}
|
${partition_csv} ${unsigned_partition_bin}
|
||||||
DEPENDS ${partition_csv} "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py"
|
DEPENDS ${partition_csv} "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py"
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
|
@ -49,6 +49,8 @@ def main():
|
|||||||
|
|
||||||
parser.add_argument('--quiet', '-q', help="Don't print status messages to stderr", action='store_true')
|
parser.add_argument('--quiet', '-q', help="Don't print status messages to stderr", action='store_true')
|
||||||
|
|
||||||
|
parser.add_argument('--partition-table-offset', help='The offset of the partition table in flash. Only consulted if partition table is in CSV format.', type=str, default='0x8000')
|
||||||
|
|
||||||
search_type = parser.add_mutually_exclusive_group()
|
search_type = parser.add_mutually_exclusive_group()
|
||||||
search_type.add_argument('--partition-name', '-p', help='The name of the required partition', type=str, default=None)
|
search_type.add_argument('--partition-name', '-p', help='The name of the required partition', type=str, default=None)
|
||||||
search_type.add_argument('--type', '-t', help='The type of the required partition', type=str, default=None)
|
search_type.add_argument('--type', '-t', help='The type of the required partition', type=str, default=None)
|
||||||
@ -74,6 +76,8 @@ def main():
|
|||||||
|
|
||||||
quiet = args.quiet
|
quiet = args.quiet
|
||||||
|
|
||||||
|
gen.offset_part_table = int(args.partition_table_offset, 0)
|
||||||
|
|
||||||
input = args.input.read()
|
input = args.input.read()
|
||||||
input_is_binary = input[0:2] == gen.PartitionDefinition.MAGIC_BYTES
|
input_is_binary = input[0:2] == gen.PartitionDefinition.MAGIC_BYTES
|
||||||
if input_is_binary:
|
if input_is_binary:
|
||||||
|
@ -9,7 +9,7 @@ if(CONFIG_PARTITION_TABLE_CUSTOM)
|
|||||||
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}" ABSOLUTE BASE_DIR "${PROJECT_PATH}")
|
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}" ABSOLUTE BASE_DIR "${PROJECT_PATH}")
|
||||||
|
|
||||||
if(NOT EXISTS "${PARTITION_CSV_PATH}")
|
if(NOT EXISTS "${PARTITION_CSV_PATH}")
|
||||||
message(FATAL_ERROR "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
|
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
|
||||||
"Change custom partition CSV path in menuconfig.")
|
"Change custom partition CSV path in menuconfig.")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
@ -28,9 +28,17 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PARTITION_CSV_P
|
|||||||
function(get_partition_info variable get_part_info_args)
|
function(get_partition_info variable get_part_info_args)
|
||||||
separate_arguments(get_part_info_args)
|
separate_arguments(get_part_info_args)
|
||||||
execute_process(COMMAND
|
execute_process(COMMAND
|
||||||
${COMPONENT_PATH}/parttool.py -q ${get_part_info_args} ${PARTITION_CSV_PATH}
|
${COMPONENT_PATH}/parttool.py -q
|
||||||
|
--partition-table-offset ${PARTITION_TABLE_OFFSET}
|
||||||
|
${get_part_info_args}
|
||||||
|
${PARTITION_CSV_PATH}
|
||||||
OUTPUT_VARIABLE result
|
OUTPUT_VARIABLE result
|
||||||
|
RESULT_VARIABLE exit_code
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT ${exit_code} EQUAL 0)
|
||||||
|
# can't fail here as it would prevent the user from running 'menuconfig' again
|
||||||
|
message(WARNING "parttool.py execution failed, problem with partition CSV file (see above)")
|
||||||
|
endif()
|
||||||
set(${variable} ${result} PARENT_SCOPE)
|
set(${variable} ${result} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user