Skip to content

Commit e96da70

Browse files
committed
feat(esptool): merge_bin CMake target
1 parent 5a40bb8 commit e96da70

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

components/esptool_py/project_include.cmake

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ if(NOT CONFIG_APP_BUILD_TYPE_RAM AND CONFIG_APP_BUILD_GENERATE_BINARIES)
9494
endif()
9595
endif()
9696

97-
# We still set "--min-rev" to keep the app compatible with older booloaders where this field is controlled.
97+
# We still set "--min-rev" to keep the app compatible with older bootloaders where this field is controlled.
9898
if(CONFIG_IDF_TARGET_ESP32)
9999
# for this chip min_rev is major revision
100100
math(EXPR min_rev "${CONFIG_ESP_REV_MIN_FULL} / 100")
@@ -241,6 +241,21 @@ add_custom_target(uf2-app
241241
)
242242

243243

244+
set(MERGE_BIN_ARGS merge_bin -o "${CMAKE_CURRENT_BINARY_DIR}/merge.bin" "@${CMAKE_CURRENT_BINARY_DIR}/flash_args")
245+
246+
add_custom_target(merge_bin
247+
COMMAND ${CMAKE_COMMAND}
248+
-D "IDF_PATH=${idf_path}"
249+
-D "SERIAL_TOOL=${ESPTOOLPY}"
250+
-D "SERIAL_TOOL_ARGS=${MERGE_BIN_ARGS}"
251+
-D "WORKING_DIRECTORY=${CMAKE_CURRENT_BINARY_DIR}"
252+
-P run_serial_tool.cmake
253+
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
254+
DEPENDS gen_project_binary bootloader
255+
USES_TERMINAL
256+
VERBATIM
257+
)
258+
244259
set(MONITOR_ARGS "")
245260

246261
list(APPEND MONITOR_ARGS "--toolchain-prefix;${_CMAKE_TOOLCHAIN_PREFIX};")
@@ -348,7 +363,7 @@ endfunction()
348363
# This function takes a fifth optional named parameter: "ALWAYS_PLAINTEXT". As
349364
# its name states, it marks whether the image should be flashed as plain text or
350365
# not. If build macro CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT is set and
351-
# this parameter is provided, then the image will be flahsed as plain text
366+
# this parameter is provided, then the image will be flashed as plain text
352367
# (not encrypted) on the target. This parameter will be ignored if build macro
353368
# CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT is not set.
354369
function(esptool_py_flash_target_image target_name image_name offset image)
@@ -474,7 +489,7 @@ $<JOIN:$<TARGET_PROPERTY:${target_name},IMAGES>,\n>")
474489
# If we only have encrypted images to flash, we must use legacy
475490
# --encrypt parameter.
476491
# As the properties ENCRYPTED_IMAGES and NON_ENCRYPTED_IMAGES have not
477-
# been geenrated yet, we must use CMake expression generator to test
492+
# been generated yet, we must use CMake expression generator to test
478493
# which esptool.py options we can use.
479494

480495
# The variable has_non_encrypted_image will be evaluated to "1" if some
@@ -503,7 +518,7 @@ ${non_encrypted_files}\n\
503518
${if_enc_expr}\
504519
${encrypted_files}")
505520

506-
# The expression is ready to be geenrated, write it to the file which
521+
# The expression is ready to be generated, write it to the file which
507522
# extension is .in
508523
file_generate("${CMAKE_CURRENT_BINARY_DIR}/encrypted_${target_name}_args.in"
509524
CONTENT "${flash_args_content}")

0 commit comments

Comments
 (0)