feat(cmakev2/build): add idf_check_bootloader_size helper

Add a public API function to check that the bootloader binary does not
overlap the partition table, mirroring the existing idf_check_binary_size
pattern for application binaries.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2026-03-06 17:29:50 +01:00
committed by BOT
parent 43d4fdd4b3
commit 6b8aa157e5
+29
View File
@@ -1227,6 +1227,35 @@ function(idf_check_binary_size binary)
add_dependencies("${binary}" "${binary}_check_size")
endfunction()
#[[
.. cmakev2:function:: idf_check_bootloader_size
.. code-block:: cmake
idf_check_bootloader_size(<binary>)
*binary[in]*
Binary image target to which to add a bootloader size check. The
``binary`` target is created by the :cmakev2:ref:`idf_build_binary` or
:cmakev2:ref:`idf_sign_binary` function.
Ensure that the bootloader binary image does not overlap the partition
table. The file path of the binary image should be stored in the
``BINARY_PATH`` property of the ``binary`` target.
#]]
function(idf_check_bootloader_size binary)
get_target_property(binary_path ${binary} BINARY_PATH)
if(NOT binary_path)
idf_die("Binary target '${binary}' is missing 'BINARY_PATH' property.")
endif()
partition_table_add_check_bootloader_size_target("${binary}_check_size"
DEPENDS "${binary_path}"
BOOTLOADER_BINARY_PATH "${binary_path}")
add_dependencies("${binary}" "${binary}_check_size")
endfunction()
#[[
.. cmakev2:function:: idf_check_binary_signed