feat: Propagate arguments when running ninja monitor

This commit is contained in:
Jan Beran 2024-01-15 12:36:11 +01:00
parent b2b84f9b5c
commit b1d9762205

View File

@ -5,6 +5,7 @@ idf_build_get_property(target IDF_TARGET)
idf_build_get_property(python PYTHON)
idf_build_get_property(idf_path IDF_PATH)
set(chip_model ${target})
# TODO: [ESP32C5] remove this 'if' block when esp32C5 beta3 is no longer supported
@ -108,8 +109,6 @@ endif()
list(APPEND esptool_elf2image_args --min-rev-full ${CONFIG_ESP_REV_MIN_FULL})
list(APPEND esptool_elf2image_args --max-rev-full ${CONFIG_ESP_REV_MAX_FULL})
set(monitor_rev_args "--revision;${CONFIG_ESP_REV_MIN_FULL}")
if(CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE)
# Set ESPFLASHSIZE to 'detect' *after* esptool_elf2image_args are generated,
# as elf2image can't have 'detect' as an option...
@ -239,11 +238,30 @@ add_custom_target(uf2-app
VERBATIM
)
set(MONITOR_ARGS "")
list(APPEND MONITOR_ARGS "--toolchain-prefix;${_CMAKE_TOOLCHAIN_PREFIX};")
if(CONFIG_ESP_COREDUMP_DECODE)
list(APPEND MONITOR_ARGS "--decode-coredumps;${CONFIG_ESP_COREDUMP_DECODE};")
endif()
list(APPEND MONITOR_ARGS "--target;${target};")
list(APPEND MONITOR_ARGS "--revision;${CONFIG_ESP_REV_MIN_FULL};")
if(CONFIG_IDF_TARGET_ARCH_RISCV)
list(APPEND MONITOR_ARGS "--decode-panic;backtrace;")
endif()
list(APPEND MONITOR_ARGS "$<TARGET_FILE:$<GENEX_EVAL:${elf}>>")
add_custom_target(monitor
COMMAND ${CMAKE_COMMAND}
-D "IDF_PATH=${idf_path}"
-D "SERIAL_TOOL=${ESPMONITOR}"
-D "SERIAL_TOOL_ARGS=--target;${target};${monitor_rev_args};$<TARGET_FILE:$<GENEX_EVAL:${elf}>>"
-D "SERIAL_TOOL_ARGS=${MONITOR_ARGS}"
-D "WORKING_DIRECTORY=${build_dir}"
-P run_serial_tool.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}