Browse Source

Jenkins: HIL flash bootloaders

- add new jlink_upload_bootloader helper target
master
Daniel Agar 4 years ago committed by GitHub
parent
commit
d79eea0c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 44
      .ci/Jenkinsfile-hardware
  2. 2
      boards/px4/fmu-v5/debug.cmake
  3. 2
      boards/px4/fmu-v5/optimized.cmake
  4. 2
      boards/px4/fmu-v5/stackcheck.cmake
  5. 4
      platforms/nuttx/CMakeLists.txt
  6. 32
      platforms/nuttx/cmake/jlink.cmake
  7. 18
      src/systemcmds/bl_update/CMakeLists.txt

44
.ci/Jenkinsfile-hardware

@ -23,6 +23,7 @@ pipeline { @@ -23,6 +23,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make cubepilot_cubeorange_test'
sh 'make cubepilot_cubeorange_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'cubepilot_cubeorange_test'
}
@ -32,7 +33,7 @@ pipeline { @@ -32,7 +33,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'cubepilot_cubeorange'
}
@ -42,6 +43,7 @@ pipeline { @@ -42,6 +43,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'cubepilot_cubeorange_test'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/cubepilot_cubeorange_test/cubepilot_cubeorange_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/cubepilot_cubeorange_test/cubepilot_cubeorange_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -91,6 +93,7 @@ pipeline { @@ -91,6 +93,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make cuav_x7pro_test'
sh 'make cuav_x7pro_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'cuav_x7pro_test'
}
@ -100,7 +103,7 @@ pipeline { @@ -100,7 +103,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'cuav_x7pro'
}
@ -110,6 +113,7 @@ pipeline { @@ -110,6 +113,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'cuav_x7pro_test'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/cuav_x7pro_test/cuav_x7pro_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/cuav_x7pro_test/cuav_x7pro_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -157,6 +161,7 @@ pipeline { @@ -157,6 +161,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make px4_fmu-v3_test'
sh 'make px4_fmu-v3_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v3_test'
}
@ -166,7 +171,7 @@ pipeline { @@ -166,7 +171,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'px4_fmu-v3'
}
@ -176,6 +181,7 @@ pipeline { @@ -176,6 +181,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'px4_fmu-v3_test'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v3_test/px4_fmu-v3_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v3_test/px4_fmu-v3_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -224,6 +230,7 @@ pipeline { @@ -224,6 +230,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make px4_fmu-v4_test'
sh 'make px4_fmu-v4_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v4_test'
}
@ -233,7 +240,7 @@ pipeline { @@ -233,7 +240,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'px4_fmu-v4'
}
@ -243,6 +250,7 @@ pipeline { @@ -243,6 +250,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'px4_fmu-v4_test'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v4_test/px4_fmu-v4_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v4_test/px4_fmu-v4_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -289,6 +297,7 @@ pipeline { @@ -289,6 +297,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make px4_fmu-v4pro_test'
sh 'make px4_fmu-v4pro_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v4pro_test'
}
@ -298,7 +307,7 @@ pipeline { @@ -298,7 +307,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'px4_fmu-v4pro'
}
@ -308,6 +317,7 @@ pipeline { @@ -308,6 +317,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'px4_fmu-v4pro_test'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v4pro_test/px4_fmu-v4pro_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v4pro_test/px4_fmu-v4pro_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -355,6 +365,7 @@ pipeline { @@ -355,6 +365,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make px4_fmu-v5_debug'
sh 'make px4_fmu-v5_debug bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v5_debug'
}
@ -364,7 +375,7 @@ pipeline { @@ -364,7 +375,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'px4_fmu-v5'
}
@ -379,6 +390,7 @@ pipeline { @@ -379,6 +390,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set MAV_0_CONFIG 0" || true' // limit cpu usage
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set MAV_1_CONFIG 0" || true' // limit cpu usage
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save" || true'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v5_debug/px4_fmu-v5_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v5_debug/px4_fmu-v5_debug.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -430,6 +442,7 @@ pipeline { @@ -430,6 +442,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make px4_fmu-v5_optimized'
sh 'make px4_fmu-v5_optimized bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v5_optimized'
}
@ -439,7 +452,7 @@ pipeline { @@ -439,7 +452,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'px4_fmu-v5'
}
@ -449,6 +462,7 @@ pipeline { @@ -449,6 +462,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'px4_fmu-v5_optimized'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v5_optimized/px4_fmu-v5_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v5_optimized/px4_fmu-v5_optimized.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -496,6 +510,7 @@ pipeline { @@ -496,6 +510,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make px4_fmu-v5_stackcheck'
sh 'make px4_fmu-v5_stackcheck bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v5_stackcheck'
}
@ -505,7 +520,7 @@ pipeline { @@ -505,7 +520,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'px4_fmu-v5'
}
@ -520,6 +535,7 @@ pipeline { @@ -520,6 +535,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set MAV_0_CONFIG 0" || true' // limit cpu usage
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set MAV_1_CONFIG 0" || true' // limit cpu usage
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save" || true'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v5_stackcheck/px4_fmu-v5_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v5_stackcheck/px4_fmu-v5_stackcheck.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -571,6 +587,7 @@ pipeline { @@ -571,6 +587,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make px4_fmu-v5_test'
sh 'make px4_fmu-v5_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'px4_fmu-v5_test'
}
@ -580,7 +597,7 @@ pipeline { @@ -580,7 +597,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'px4_fmu-v5'
}
@ -590,6 +607,7 @@ pipeline { @@ -590,6 +607,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'px4_fmu-v5_test'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v5_test/px4_fmu-v5_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/px4_fmu-v5_test/px4_fmu-v5_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -637,6 +655,7 @@ pipeline { @@ -637,6 +655,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make modalai_fc-v1_test'
sh 'make modalai_fc-v1_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'modalai_fc-v1_test'
}
@ -646,7 +665,7 @@ pipeline { @@ -646,7 +665,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'modalai_fc-v1'
}
@ -656,6 +675,7 @@ pipeline { @@ -656,6 +675,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'modalai_fc-v1_test'
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/modalai_fc-v1_test/modalai_fc-v1_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/modalai_fc-v1_test/modalai_fc-v1_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
@ -702,6 +722,7 @@ pipeline { @@ -702,6 +722,7 @@ pipeline {
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make nxp_fmuk66-v3_test'
//sh 'make nxp_fmuk66-v3_test bootloader_elf'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'nxp_fmuk66-v3_test'
}
@ -711,7 +732,7 @@ pipeline { @@ -711,7 +732,7 @@ pipeline {
}
}
} // stage build
stage("test") {
stage("hardware") {
agent {
label 'nxp_fmuk66-v3'
}
@ -721,6 +742,7 @@ pipeline { @@ -721,6 +742,7 @@ pipeline {
sh 'export'
sh 'find /dev/serial'
unstash 'nxp_fmuk66-v3_test'
//sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/nxp_fmuk66-v3_test/nxp_fmuk66-v3_bootloader.elf'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/nxp_fmuk66-v3_test/nxp_fmuk66-v3_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}

2
boards/px4/fmu-v5/debug.cmake

@ -93,7 +93,7 @@ px4_add_board( @@ -93,7 +93,7 @@ px4_add_board(
#vmount
vtol_att_control
SYSTEMCMDS
#bl_update
bl_update
dmesg
dumpfile
esc_calib

2
boards/px4/fmu-v5/optimized.cmake

@ -98,7 +98,7 @@ px4_add_board( @@ -98,7 +98,7 @@ px4_add_board(
#vmount
#vtol_att_control
SYSTEMCMDS
#bl_update
bl_update
dmesg
#dumpfile
#esc_calib

2
boards/px4/fmu-v5/stackcheck.cmake

@ -93,7 +93,7 @@ px4_add_board( @@ -93,7 +93,7 @@ px4_add_board(
#vmount
vtol_att_control
SYSTEMCMDS
#bl_update
bl_update
dmesg
dumpfile
esc_calib

4
platforms/nuttx/CMakeLists.txt

@ -156,9 +156,9 @@ if((DEFINED ENV{SIGNING_TOOL}) AND (NOT NUTTX_DIR MATCHES "external")) @@ -156,9 +156,9 @@ if((DEFINED ENV{SIGNING_TOOL}) AND (NOT NUTTX_DIR MATCHES "external"))
COMMAND $ENV{SIGNING_TOOL} $ENV{SIGNING_ARGS} ${PX4_BINARY_OUTPUT} ${PX4_BINARY_DIR}/${PX4_BOARD}.bin
DEPENDS ${PX4_BINARY_OUTPUT}
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
)
)
else()
set(PX4_BINARY_OUTPUT ${PX4_BINARY_DIR_REL}/${PX4_BOARD}.bin)
set(PX4_BINARY_OUTPUT ${PX4_BINARY_DIR_REL}/${PX4_BOARD}.bin)
endif()
add_custom_command(OUTPUT ${PX4_BINARY_OUTPUT}

32
platforms/nuttx/cmake/jlink.cmake

@ -83,18 +83,34 @@ if(Ozone_PATH) @@ -83,18 +83,34 @@ if(Ozone_PATH)
endif()
if(bootloader_bin OR (EXISTS "${PX4_BOARD_DIR}/bootloader/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin"))
# jlink_flash_bootloader
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()
# jlink_upload_bootloader
if(JLinkGDBServerCLExe_PATH)
add_custom_target(jlink_upload_bootloader
COMMAND ${PX4_BINARY_DIR}/jlink_gdb_start.sh
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/upload_jlink_gdb.sh ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.elf
DEPENDS
${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.elf
${PX4_BINARY_DIR}/jlink_gdb_start.sh
${CMAKE_CURRENT_SOURCE_DIR}/Debug/upload_jlink_gdb.sh
WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL
)
endif()
# jlink_flash_bootloader_bin
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()
file(RELATIVE_PATH BOARD_BL_FIRMWARE_BIN ${PX4_BINARY_DIR} ${BOARD_BL_FIRMWARE_BIN})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/flash_bootloader.jlink.in ${PX4_BINARY_DIR}/flash_bootloader.jlink @ONLY)
add_custom_target(jlink_flash_bootloader
add_custom_target(jlink_flash_bootloader_bin
COMMAND ${JLinkExe_PATH} -CommandFile ${PX4_BINARY_DIR}/flash_bootloader.jlink
DEPENDS
px4

18
src/systemcmds/bl_update/CMakeLists.txt

@ -78,6 +78,15 @@ if(config_build_bootloader) @@ -78,6 +78,15 @@ if(config_build_bootloader)
)
add_custom_target(copy_bootloader_bin DEPENDS ${bootloader_bin})
# copy bootloader.elf to top level build directory
add_custom_command(
OUTPUT ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.elf
COMMAND ${CMAKE_COMMAND} -E copy ${BINARY_DIR}/${bootloader_config}.elf ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.elf
DEPENDS bootloader_firmware
WORKING_DIRECTORY ${PX4_BINARY_DIR}
)
add_custom_target(bootloader_elf DEPENDS ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.elf)
elseif(EXISTS "${PX4_BOARD_DIR}/bootloader/")
if(EXISTS ${PX4_BOARD_DIR}/bootloader/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin)
@ -92,6 +101,15 @@ elseif(EXISTS "${PX4_BOARD_DIR}/bootloader/") @@ -92,6 +101,15 @@ elseif(EXISTS "${PX4_BOARD_DIR}/bootloader/")
)
add_custom_target(copy_bootloader_bin DEPENDS ${bootloader_bin})
# generate bootloader.elf and copy to top level build directory
add_custom_command(
OUTPUT ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.elf
COMMAND ${CMAKE_OBJCOPY} -I binary -O elf32-little --change-section-address .data=0x08000000 ${board_bootloader_firmware} ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.elf
DEPENDS ${board_bootloader_firmware}
WORKING_DIRECTORY ${PX4_BINARY_DIR}
)
add_custom_target(bootloader_elf DEPENDS ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.elf)
else()
file(GLOB bootloader_bin_files ${PX4_BOARD_DIR}/bootloader/*.bin)
foreach(bin_file ${bootloader_bin_files})

Loading…
Cancel
Save