add bootloader flash helper target (jlink_flash_bootloader)

This commit is contained in:
Daniel Agar 2021-03-10 20:01:43 -05:00 committed by Lorenz Meier
parent 8816601efb
commit f725813128
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,9 @@
Device @DEBUG_DEVICE@
eoe 1
si SWD
speed auto
r
h
loadbin @BOARD_BL_FIRMWARE_BIN@,0x08000000
go
qc

View File

@ -81,3 +81,26 @@ if(Ozone_PATH)
USES_TERMINAL
)
endif()
if(bootloader_bin OR (EXISTS "${PX4_BOARD_DIR}/bootloader/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin"))
# jlink_flash_bootloader
find_program(JLinkExe_PATH JLinkExe)
if(JLinkExe_PATH)
if(bootloader_bin)
set(BOARD_BL_FIRMWARE_BIN ${bootloader_bin})
else()
set(BOARD_BL_FIRMWARE_BIN ${PX4_BOARD_DIR}/bootloader/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/flash_bootloader.jlink.in ${PX4_BINARY_DIR}/flash_bootloader.jlink @ONLY)
add_custom_target(jlink_flash_bootloader
COMMAND ${JLinkExe_PATH} -CommandFile ${PX4_BINARY_DIR}/flash_bootloader.jlink
DEPENDS
px4
${CMAKE_CURRENT_SOURCE_DIR}/Debug/flash_bootloader.jlink.in
WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL
)
endif()
endif()