fix(dfu): retry dfu-util flash on macOS detach failure

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jiang Guang Ming
2026-07-17 11:09:20 +08:00
committed by JiangGuangMing
co-authored by Cursor
parent 729241db7f
commit 5c3306ac04
3 changed files with 9 additions and 2 deletions
+7
View File
@@ -23,6 +23,13 @@ endif()
message("Command list: ${CMD}")
execute_process(COMMAND ${CMD} RESULT_VARIABLE result)
# dfu-util may fail on the first attempt while switching from runtime to DFU mode,
# e.g. with "Lost device after RESET?" on Windows/macOS. Retry once.
if(${result} AND NOT ${ESP_DFU_LIST})
message(WARNING "${TOOL} failed, retrying once...")
execute_process(COMMAND ${CMD} RESULT_VARIABLE result)
endif()
if(${result})
message(FATAL_ERROR "${TOOL} failed")
endif()