From b572c40ab319a64663a5736e0ef5a7e9bad07614 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 27 Feb 2019 12:33:06 -0500 Subject: [PATCH] [DO NOT MERGE] Jenkins hardware try running in parallel --- .ci/Jenkinsfile-hardware | 432 ++++--------------------------- platforms/nuttx/CMakeLists.txt | 19 +- platforms/nuttx/Debug/gdbinit.in | 5 + platforms/nuttx/Debug/jlink.sh | 7 +- 4 files changed, 70 insertions(+), 393 deletions(-) diff --git a/.ci/Jenkinsfile-hardware b/.ci/Jenkinsfile-hardware index 069d30475101..e1e5c4b575bb 100644 --- a/.ci/Jenkinsfile-hardware +++ b/.ci/Jenkinsfile-hardware @@ -5,399 +5,59 @@ pipeline { stages { stage('Build') { - - parallel { - - stage('px4_fmu-v2_test') { - agent { - docker { - image 'px4io/px4-dev-nuttx:2019-02-09' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' - } - } - steps { - sh 'export' - sh 'make distclean' - sh 'ccache -z' - sh 'git fetch --tags' - sh 'make px4_fmu-v2_default' - sh 'make sizes' - sh 'ccache -s' - stash includes: 'build/px4_fmu-v2_default/px4_fmu-v2_default.elf', name: 'px4_fmu-v2_test' - } - post { - always { - sh 'make distclean' - } - } - } - - stage('px4_fmu-v3_default') { - agent { - docker { - image 'px4io/px4-dev-nuttx:2019-02-09' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' - } - } - steps { - sh 'export' - sh 'make distclean' - sh 'ccache -z' - sh 'git fetch --tags' - sh 'make px4_fmu-v3_default' - sh 'make sizes' - sh 'ccache -s' - stash includes: 'build/px4_fmu-v3_default/px4_fmu-v3_default.elf', name: 'px4_fmu-v3_default' - } - post { - always { - sh 'make distclean' - } - } + agent { + docker { + image 'px4io/px4-dev-nuttx:2019-02-09' + args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' } - - stage('px4_fmu-v4_default') { - agent { - docker { - image 'px4io/px4-dev-nuttx:2019-02-09' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' - } - } - steps { - sh 'export' + } + steps { + sh 'export' + sh 'make distclean' + sh 'ccache -z' + sh 'git fetch --tags' + sh 'make px4_fmu-v5_default' + sh 'make sizes' + sh 'ccache -s' + stash includes: 'build/px4_fmu-v5_default/px4_fmu-v5_default.elf', name: 'px4_fmu-v5_default' + } + post { + always { sh 'make distclean' - sh 'ccache -z' - sh 'git fetch --tags' - sh 'make px4_fmu-v4_default' - sh 'make sizes' - sh 'ccache -s' - stash includes: 'build/px4_fmu-v4_default/px4_fmu-v4_default.elf', name: 'px4_fmu-v4_default' - } - post { - always { - sh 'make distclean' - } - } } - - stage('px4_fmu-v4pro_default') { - agent { - docker { - image 'px4io/px4-dev-nuttx:2019-02-09' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' - } - } - steps { - sh 'export' - sh 'make distclean' - sh 'ccache -z' - sh 'git fetch --tags' - sh 'make px4_fmu-v4pro_default' - sh 'make sizes' - sh 'ccache -s' - stash includes: 'build/px4_fmu-v4pro_default/px4_fmu-v4pro_default.elf', name: 'px4_fmu-v4pro_default' - } - post { - always { - sh 'make distclean' - } - } - } - - stage('px4_fmu-v5_default') { - agent { - docker { - image 'px4io/px4-dev-nuttx:2019-02-09' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' - } - } - steps { - sh 'export' - sh 'make distclean' - sh 'ccache -z' - sh 'git fetch --tags' - sh 'make px4_fmu-v5_default' - sh 'make sizes' - sh 'ccache -s' - stash includes: 'build/px4_fmu-v5_default/px4_fmu-v5_default.elf', name: 'px4_fmu-v5_default' - } - post { - always { - sh 'make distclean' - } - } - } - - stage('px4_fmu-v5_stackcheck') { - agent { - docker { - image 'px4io/px4-dev-nuttx:2019-02-09' - args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' - } - } - steps { - sh 'export' - sh 'make distclean' - sh 'ccache -z' - sh 'git fetch --tags' - sh 'make px4_fmu-v5_stackcheck' - sh 'make sizes' - sh 'ccache -s' - stash includes: 'build/px4_fmu-v5_stackcheck/px4_fmu-v5_stackcheck.elf', name: 'px4_fmu-v5_stackcheck' - } - post { - always { - sh 'make distclean' - } - } - } - - } // parallel + } } // stage Build stage('Flash and Run') { - - parallel { - - stage('px4_fmu-v2_test') { - agent { - label 'px4_fmu-v2' - } - steps { - script { - try { - sh 'export' - sh 'find /dev/serial' - unstash 'px4_fmu-v2_test' - 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-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/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') { - agent { - label 'px4_fmu-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/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/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-v4_default') { - agent { - label 'px4_fmu-v4' - } - steps { - script { - try { - sh 'export' - sh 'find /dev/serial' - unstash 'px4_fmu-v4_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-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/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-v4pro_default') { - agent { - label 'px4_fmu-v4pro' - } - steps { - script { - try { - sh 'export' - sh 'find /dev/serial' - unstash 'px4_fmu-v4pro_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-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/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-v5_default') { - agent { - label 'px4_fmu-v5' - } - steps { - script { - try { - sh 'export' - sh 'find /dev/serial' - unstash 'px4_fmu-v5_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-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/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-v5_stackcheck') { - agent { - label 'px4_fmu-v5' - } - steps { - script { - try { - sh 'export' - sh 'find /dev/serial' - unstash 'px4_fmu-v5_stackcheck' - 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-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/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') + agent { + label 'px4_fmu-v5' + } + steps { + parallel( + 'Flashing': { + timeout(time: 300, unit: 'SECONDS') { + sh 'export' + sh 'find /dev/serial' + unstash 'px4_fmu-v5_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 "continue" \ + build/px4_fmu-v5_default/px4_fmu-v5_default.elf + ''' + } + }, + 'Testing': { + timeout(time: 600, unit: 'SECONDS') { + 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_*`' + } } - } - - } // parallel + ) + } // steps } // stage Flash } // stages diff --git a/platforms/nuttx/CMakeLists.txt b/platforms/nuttx/CMakeLists.txt index f5f250cba179..eea08a91e74f 100644 --- a/platforms/nuttx/CMakeLists.txt +++ b/platforms/nuttx/CMakeLists.txt @@ -350,12 +350,16 @@ endif() add_custom_target(jlink_upload COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink.sh - COMMAND ${GDB} --nx --batch - -iex 'set auto-load safe-path ${PX4_BINARY_DIR}' + COMMAND ${GDB} -nx -batch -ex 'target remote localhost:2331' - -ex 'monitor reset' + -ex 'monitor reset 0' -ex 'load' + -ex 'compare-sections' + -ex 'monitor reset 0' + -ex 'monitor sleep 1000' + -ex 'monitor go' -ex 'kill' + -ex 'quit' $ DEPENDS px4 ${PX4_BINARY_DIR}/.gdbinit WORKING_DIRECTORY ${PX4_BINARY_DIR} @@ -364,12 +368,15 @@ add_custom_target(jlink_upload add_custom_target(jlink_debug COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink.sh - COMMAND ${GDB} --nh + COMMAND ${GDB} -nh -iex 'set auto-load safe-path ${PX4_BINARY_DIR}' -ex 'target remote localhost:2331' - -ex 'monitor reset' + -ex 'monitor reset 0' -ex 'load' - -ex 'monitor reset' + -ex 'compare-sections' + -ex 'monitor reset 0' + -ex 'monitor sleep 1000' + -ex 'monitor go' -ex 'continue' $ DEPENDS px4 ${PX4_BINARY_DIR}/.gdbinit diff --git a/platforms/nuttx/Debug/gdbinit.in b/platforms/nuttx/Debug/gdbinit.in index 3996e71fd573..fbc62d331eb9 100644 --- a/platforms/nuttx/Debug/gdbinit.in +++ b/platforms/nuttx/Debug/gdbinit.in @@ -1,6 +1,11 @@ source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/PX4 +help px4 + source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/NuttX +help nuttx + source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/ARMv7M +help armv7m set mem inaccessible-by-default off diff --git a/platforms/nuttx/Debug/jlink.sh b/platforms/nuttx/Debug/jlink.sh index 3d4873aff905..e0b58ee963c9 100755 --- a/platforms/nuttx/Debug/jlink.sh +++ b/platforms/nuttx/Debug/jlink.sh @@ -1,3 +1,8 @@ #! /bin/sh -JLinkGDBServerCLExe -startserver -USB -device Cortex-M4 -if SWD -speed auto > jlink.log & +killall JLinkGDBServerCLExe + + +# CONFIG_ARCH_CHIP_STM32F427V +# CONFIG_STM32_STM32F427 +JLinkGDBServerCLExe -device STM32F427II -select usb -silent -endian little -if SWD -speed auto -ir -LocalhostOnly 1 -strict -vd -singlerun &