forked from Archive/PX4-Autopilot
cmake nuttx skip upload helper without cdcacm
This commit is contained in:
parent
ed95dced0f
commit
7efdec1469
|
@ -157,66 +157,70 @@ if (TARGET parameters_xml AND TARGET airframes_xml)
|
|||
)
|
||||
else()
|
||||
|
||||
# NuttX CDCACM vendor and product strings
|
||||
set(vendorstr_underscore)
|
||||
set(productstr_underscore)
|
||||
string(REPLACE " " "_" vendorstr_underscore ${CONFIG_CDCACM_VENDORSTR})
|
||||
string(REPLACE " " "_" productstr_underscore ${CONFIG_CDCACM_PRODUCTSTR})
|
||||
# create upload target helper if NuttX USB CDCACM is present
|
||||
if (CONFIG_CDCACM)
|
||||
|
||||
set(serial_ports)
|
||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
||||
# NuttX CDCACM vendor and product strings
|
||||
set(vendorstr_underscore)
|
||||
set(productstr_underscore)
|
||||
string(REPLACE " " "_" vendorstr_underscore ${CONFIG_CDCACM_VENDORSTR})
|
||||
string(REPLACE " " "_" productstr_underscore ${CONFIG_CDCACM_PRODUCTSTR})
|
||||
|
||||
set(px4_usb_path "${vendorstr_underscore}_${productstr_underscore}")
|
||||
set(serial_ports)
|
||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
||||
|
||||
list(APPEND serial_ports
|
||||
# NuttX vendor + product string
|
||||
/dev/serial/by-id/*-${px4_usb_path}*
|
||||
set(px4_usb_path "${vendorstr_underscore}_${productstr_underscore}")
|
||||
|
||||
# Bootloader
|
||||
/dev/serial/by-id/*PX4_BL* # typical bootloader USB device string
|
||||
/dev/serial/by-id/*BL_FMU*
|
||||
|
||||
# TODO: handle these per board
|
||||
/dev/serial/by-id/usb-The_Autopilot*
|
||||
/dev/serial/by-id/usb-Bitcraze*
|
||||
/dev/serial/by-id/pci-Bitcraze*
|
||||
/dev/serial/by-id/usb-Gumstix*
|
||||
|
||||
)
|
||||
|
||||
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
list(APPEND serial_ports
|
||||
/dev/tty.usbmodemPX*,/dev/tty.usbmodem*
|
||||
)
|
||||
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "CYGWIN")
|
||||
list(APPEND serial_ports
|
||||
/dev/ttyS*
|
||||
)
|
||||
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
foreach(port RANGE 32 0)
|
||||
list(APPEND serial_ports
|
||||
"COM${port}")
|
||||
endforeach()
|
||||
# NuttX vendor + product string
|
||||
/dev/serial/by-id/*-${px4_usb_path}*
|
||||
|
||||
# Bootloader
|
||||
/dev/serial/by-id/*PX4_BL* # typical bootloader USB device string
|
||||
/dev/serial/by-id/*BL_FMU*
|
||||
|
||||
# TODO: handle these per board
|
||||
/dev/serial/by-id/usb-The_Autopilot*
|
||||
/dev/serial/by-id/usb-Bitcraze*
|
||||
/dev/serial/by-id/pci-Bitcraze*
|
||||
/dev/serial/by-id/usb-Gumstix*
|
||||
|
||||
)
|
||||
|
||||
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
list(APPEND serial_ports
|
||||
/dev/tty.usbmodemPX*,/dev/tty.usbmodem*
|
||||
)
|
||||
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "CYGWIN")
|
||||
list(APPEND serial_ports
|
||||
/dev/ttyS*
|
||||
)
|
||||
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
foreach(port RANGE 32 0)
|
||||
list(APPEND serial_ports
|
||||
"COM${port}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",")
|
||||
|
||||
add_custom_target(upload
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${fw_file}
|
||||
DEPENDS ${fw_file}
|
||||
COMMENT "uploading px4"
|
||||
VERBATIM
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
add_custom_target(force-upload
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_uploader.py --force --port ${serial_ports} ${fw_file}
|
||||
DEPENDS ${fw_file}
|
||||
COMMENT "uploading px4 with --force"
|
||||
VERBATIM
|
||||
USES_TERMINAL
|
||||
)
|
||||
endif()
|
||||
|
||||
px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",")
|
||||
|
||||
add_custom_target(upload
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${fw_file}
|
||||
DEPENDS ${fw_file}
|
||||
COMMENT "uploading px4"
|
||||
VERBATIM
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
add_custom_target(force-upload
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_uploader.py --force --port ${serial_ports} ${fw_file}
|
||||
DEPENDS ${fw_file}
|
||||
COMMENT "uploading px4 with --force"
|
||||
VERBATIM
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue