esp-idf/tools/cmake/dfu.cmake
Alex Lisitsyn ea6710ce98 soc/hal: add tinyusb support esp32s3
add usb hal/soc, usb_ll files and esp32s3 target for usb
move usb_hal.h into soc common folder
soc/hal: fix soc and periph for usb
tinyusb: fix tinyusb io header
hal: usb_ll fix pull up/down config for esp32s3
soc/hal: fix peripheral addresses
2021-05-06 16:20:54 +08:00

45 lines
1.3 KiB
CMake

# Add DFU build and flashing related targets
#
function(__add_dfu_targets)
idf_build_get_property(target IDF_TARGET)
if("${target}" STREQUAL "esp32")
return()
elseif("${target}" STREQUAL "esp32s2")
set(dfu_pid "2")
elseif("${target}" STREQUAL "esp32s3")
set(dfu_pid "6")
elseif("${target}" STREQUAL "esp32c3")
return()
elseif("${target}" STREQUAL "linux")
return()
else()
message(FATAL_ERROR "DFU PID unknown for ${target}")
endif()
idf_build_get_property(python PYTHON)
idf_build_get_property(idf_path IDF_PATH)
add_custom_target(dfu
COMMAND ${python} ${idf_path}/tools/mkdfu.py write
-o "${CMAKE_CURRENT_BINARY_DIR}/dfu.bin"
--json "${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json"
--pid "${dfu_pid}"
DEPENDS gen_project_binary bootloader
VERBATIM
USES_TERMINAL)
add_custom_target(dfu-list
COMMAND ${CMAKE_COMMAND}
-D ESP_DFU_LIST="1"
-P ${idf_path}/tools/cmake/run_dfu_util.cmake
USES_TERMINAL)
add_custom_target(dfu-flash
COMMAND ${CMAKE_COMMAND}
-D ESP_DFU_BIN="${CMAKE_CURRENT_BINARY_DIR}/dfu.bin"
-D ESP_DFU_PID="${dfu_pid}"
-P ${idf_path}/tools/cmake/run_dfu_util.cmake
USES_TERMINAL)
endfunction()