create jlink gdb upload script and use in Jenkins Hardware pipeline

This commit is contained in:
Daniel Agar 2019-02-27 18:42:54 -05:00 committed by GitHub
parent 12d29fd093
commit e7dfb375be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 116 deletions

View File

@ -169,17 +169,7 @@ pipeline {
sh 'export' sh 'export'
sh 'find /dev/serial' sh 'find /dev/serial'
unstash 'px4_fmu-v2_test' unstash 'px4_fmu-v2_test'
sh '''gdb-multiarch -nx --batch \ sh 'platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v2_test/px4_fmu-v2_test.elf'
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
build/px4_fmu-v2_test/px4_fmu-v2_test.elf
'''
sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600' sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600'
//sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`' //sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`'
} catch (Exception err) { } catch (Exception err) {
@ -203,51 +193,7 @@ pipeline {
sh 'export' sh 'export'
sh 'find /dev/serial' sh 'find /dev/serial'
unstash 'px4_fmu-v3_default' unstash 'px4_fmu-v3_default'
sh '''gdb-multiarch -nx --batch \ sh 'platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v3_default/px4_fmu-v3_default.elf'
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
build/px4_fmu-v3_default/px4_fmu-v3_default.elf
'''
sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600'
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`'
} catch (Exception err) {
// always report passed for now
currentBuild.result = 'SUCCESS'
}
} // script
}
options {
timeout(time: 600, unit: 'SECONDS')
}
}
stage('px4_fmu-v3_default (pixhack-v3)') {
agent {
label 'pixhack-v3'
}
steps {
script {
try {
sh 'export'
sh 'find /dev/serial'
unstash 'px4_fmu-v3_default'
sh '''gdb-multiarch -nx --batch \
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
build/px4_fmu-v3_default/px4_fmu-v3_default.elf
'''
sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600' sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600'
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`'
} catch (Exception err) { } catch (Exception err) {
@ -271,17 +217,7 @@ pipeline {
sh 'export' sh 'export'
sh 'find /dev/serial' sh 'find /dev/serial'
unstash 'px4_fmu-v4_default' unstash 'px4_fmu-v4_default'
sh ''' gdb-multiarch -nx --batch \ sh 'platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v4_default/px4_fmu-v4_default.elf'
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
build/px4_fmu-v4_default/px4_fmu-v4_default.elf
'''
sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600' sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600'
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`'
} catch (Exception err) { } catch (Exception err) {
@ -305,17 +241,7 @@ pipeline {
sh 'export' sh 'export'
sh 'find /dev/serial' sh 'find /dev/serial'
unstash 'px4_fmu-v4pro_default' unstash 'px4_fmu-v4pro_default'
sh '''gdb-multiarch -nx --batch \ sh 'platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v4pro_default/px4_fmu-v4pro_default.elf'
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
build/px4_fmu-v4pro_default/px4_fmu-v4pro_default.elf
'''
sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600' sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600'
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`'
} catch (Exception err) { } catch (Exception err) {
@ -339,17 +265,7 @@ pipeline {
sh 'export' sh 'export'
sh 'find /dev/serial' sh 'find /dev/serial'
unstash 'px4_fmu-v5_default' unstash 'px4_fmu-v5_default'
sh '''gdb-multiarch -nx --batch \ sh './platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v5_default/px4_fmu-v5_default.elf'
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
build/px4_fmu-v5_default/px4_fmu-v5_default.elf
'''
sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600' sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600'
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`'
} catch (Exception err) { } catch (Exception err) {
@ -373,17 +289,7 @@ pipeline {
sh 'export' sh 'export'
sh 'find /dev/serial' sh 'find /dev/serial'
unstash 'px4_fmu-v5_stackcheck' unstash 'px4_fmu-v5_stackcheck'
sh '''gdb-multiarch -nx --batch \ sh './platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v5_stackcheck/px4_fmu-v5_stackcheck.elf'
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
build/px4_fmu-v5_stackcheck/px4_fmu-v5_stackcheck.elf
'''
sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600' sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*` --baudrate 57600'
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`' sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_TTL232R-3V3_*`'
} catch (Exception err) { } catch (Exception err) {

View File

@ -349,27 +349,24 @@ if(black_magic_probe_path)
endif() endif()
add_custom_target(jlink_upload add_custom_target(jlink_upload
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_gdb_start.sh
COMMAND ${GDB} --nx --batch COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_gdb_upload.sh $<TARGET_FILE:px4>
-iex 'set auto-load safe-path ${PX4_BINARY_DIR}' DEPENDS px4
-ex 'target remote localhost:2331'
-ex 'monitor reset'
-ex 'load'
-ex 'kill'
$<TARGET_FILE:px4>
DEPENDS px4 ${PX4_BINARY_DIR}/.gdbinit
WORKING_DIRECTORY ${PX4_BINARY_DIR} WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL USES_TERMINAL
) )
add_custom_target(jlink_debug add_custom_target(jlink_debug
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_gdb_start.sh
COMMAND ${GDB} --nh COMMAND ${GDB} -nh
-iex 'set auto-load safe-path ${PX4_BINARY_DIR}' -iex 'set auto-load safe-path ${PX4_BINARY_DIR}'
-ex 'target remote localhost:2331' -ex 'target remote localhost:2331'
-ex 'monitor reset' -ex 'monitor reset 0'
-ex 'load' -ex 'load'
-ex 'monitor reset' -ex 'compare-sections'
-ex 'monitor reset 0'
-ex 'monitor sleep 1000'
-ex 'monitor go'
-ex 'continue' -ex 'continue'
$<TARGET_FILE:px4> $<TARGET_FILE:px4>
DEPENDS px4 ${PX4_BINARY_DIR}/.gdbinit DEPENDS px4 ${PX4_BINARY_DIR}/.gdbinit

View File

@ -1,6 +1,11 @@
source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/PX4 source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/PX4
help px4
source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/NuttX source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/NuttX
help nuttx
source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/ARMv7M source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/ARMv7M
help armv7m
set mem inaccessible-by-default off set mem inaccessible-by-default off

View File

@ -1,3 +0,0 @@
#! /bin/sh
JLinkGDBServerCLExe -startserver -USB -device Cortex-M4 -if SWD -speed auto > jlink.log &

View File

@ -0,0 +1,7 @@
#! /bin/sh
killall JLinkGDBServerCLExe
# TODO: set device from nuttx config
# eg CONFIG_ARCH_CHIP_STM32F427V or CONFIG_STM32_STM32F427
JLinkGDBServerCLExe -device STM32F427II -select usb -silent -endian little -if SWD -speed auto -ir -LocalhostOnly 1 -strict -vd -singlerun &

View File

@ -0,0 +1,12 @@
#! /bin/sh
gdb-multiarch -nx -batch \
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
${1}