esptool_py: fix passing arguments to cmake -P

Fixes WORKING_DIRECTORY argument being passed with spaces escaped `\ `
which causes failure in run_cmd.cmake, since the WORKING_DIRECTORY is
interpreted as having a literal backslash character in it.
This commit is contained in:
Ivan Grokhotkov 2020-10-09 17:01:01 +02:00
parent 8da98b864d
commit 50799e3026

View File

@ -148,23 +148,25 @@ endif()
add_custom_target(erase_flash add_custom_target(erase_flash
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-D IDF_PATH="${idf_path}" -D "IDF_PATH=${idf_path}"
-D SERIAL_TOOL="${ESPTOOLPY}" -D "SERIAL_TOOL=${ESPTOOLPY}"
-D SERIAL_TOOL_ARGS="erase_flash" -D "SERIAL_TOOL_ARGS=erase_flash"
-P run_serial_tool.cmake -P run_serial_tool.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
USES_TERMINAL USES_TERMINAL
VERBATIM
) )
add_custom_target(monitor add_custom_target(monitor
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-D IDF_PATH="${idf_path}" -D "IDF_PATH=${idf_path}"
-D SERIAL_TOOL="${ESPMONITOR}" -D "SERIAL_TOOL=${ESPMONITOR}"
-D SERIAL_TOOL_ARGS="--target;${target};${monitor_rev_args};${elf_dir}/${elf}" -D "SERIAL_TOOL_ARGS=--target;${target};${monitor_rev_args};${elf_dir}/${elf}"
-D WORKING_DIRECTORY="${build_dir}" -D "WORKING_DIRECTORY=${build_dir}"
-P run_serial_tool.cmake -P run_serial_tool.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
USES_TERMINAL USES_TERMINAL
VERBATIM
) )
set(esptool_flash_main_args "--before=${CONFIG_ESPTOOLPY_BEFORE}") set(esptool_flash_main_args "--before=${CONFIG_ESPTOOLPY_BEFORE}")
@ -347,13 +349,14 @@ function(esptool_py_flash_target target_name main_args sub_args)
add_custom_target(${target_name} add_custom_target(${target_name}
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-D IDF_PATH="${idf_path}" -D "IDF_PATH=${idf_path}"
-D SERIAL_TOOL="${ESPTOOLPY}" -D "SERIAL_TOOL=${ESPTOOLPY}"
-D SERIAL_TOOL_ARGS="${main_args};write_flash;@${target_name}_args" -D "SERIAL_TOOL_ARGS=${main_args};write_flash;@${target_name}_args"
-D WORKING_DIRECTORY="${build_dir}" -D "WORKING_DIRECTORY=${build_dir}"
-P ${esptool_py_dir}/run_serial_tool.cmake -P ${esptool_py_dir}/run_serial_tool.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
USES_TERMINAL USES_TERMINAL
VERBATIM
) )
set_target_properties(${target_name} PROPERTIES SUB_ARGS "${sub_args}") set_target_properties(${target_name} PROPERTIES SUB_ARGS "${sub_args}")
@ -388,13 +391,14 @@ $<JOIN:$<TARGET_PROPERTY:${target_name},IMAGES>,\n>")
if(${encrypted}) if(${encrypted})
add_custom_target(encrypted-${target_name} add_custom_target(encrypted-${target_name}
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-D IDF_PATH="${idf_path}" -D "IDF_PATH=${idf_path}"
-D SERIAL_TOOL="${ESPTOOLPY}" -D "SERIAL_TOOL=${ESPTOOLPY}"
-D SERIAL_TOOL_ARGS="${main_args};write_flash;@encrypted_${target_name}_args" -D "SERIAL_TOOL_ARGS=${main_args};write_flash;@encrypted_${target_name}_args"
-D WORKING_DIRECTORY="${build_dir}" -D "WORKING_DIRECTORY=${build_dir}"
-P ${esptool_py_dir}/run_serial_tool.cmake -P ${esptool_py_dir}/run_serial_tool.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
USES_TERMINAL USES_TERMINAL
VERBATIM
) )
# Generate the parameters for esptool.py command # Generate the parameters for esptool.py command