From 33a6fc1d5cee113218f89bfd86922666f5e02483 Mon Sep 17 00:00:00 2001 From: Chun-Chieh Li Date: Fri, 23 Aug 2024 14:35:40 +0800 Subject: [PATCH] Upload: Honor OUTPUT_EXT for flash In upload method flash, if OUTPUT_EXT is defined in targets.json5, use image file with this extension . for flash, or default to .bin. --- tools/cmake/UploadMethodManager.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/cmake/UploadMethodManager.cmake b/tools/cmake/UploadMethodManager.cmake index 4aa336d6f0b1..4e92db5d3b7f 100644 --- a/tools/cmake/UploadMethodManager.cmake +++ b/tools/cmake/UploadMethodManager.cmake @@ -59,8 +59,9 @@ set(MBED_UPLOAD_RESTART_COMMANDS ${UPLOAD_RESTART_COMMANDS} CACHE INTERNAL "" FO function(mbed_generate_upload_target target) # add upload target - gen_upload_target(${target} - ${CMAKE_CURRENT_BINARY_DIR}/$.bin - ${CMAKE_CURRENT_BINARY_DIR}/$.hex - ) + if ("${MBED_OUTPUT_EXT}" STREQUAL "" OR MBED_OUTPUT_EXT STREQUAL "bin") + gen_upload_target(${target} ${CMAKE_CURRENT_BINARY_DIR}/$.bin) + else() + gen_upload_target(${target} ${CMAKE_CURRENT_BINARY_DIR}/$.hex) + endif() endfunction() \ No newline at end of file